MythTV  master
rtpdatapacket.cpp
Go to the documentation of this file.
1 #include "rtpdatapacket.h"
2 
4 
6 {
7  if (m_data.size() < 12)
8  {
9  return false;
10  }
11  if (2 != GetVersion())
12  {
13  LOG(VB_GENERAL, LOG_INFO, QString("Version incorrect %1")
14  .arg(GetVersion()));
15  return false;
16  }
17 
18  int off = 12 + (4 * GetCSRCCount());
19  if (off > m_data.size())
20  {
21  LOG(VB_GENERAL, LOG_INFO, QString("off %1 > sz %2")
22  .arg(off).arg(m_data.size()));
23  return false;
24  }
25  if (HasExtension())
26  {
27  uint ext_size = m_data[off+2] << 8 | m_data[off+3];
28  off += 4 * (1 + ext_size);
29  }
30  if (off > m_data.size())
31  {
32  LOG(VB_GENERAL, LOG_INFO, QString("off + ext %1 > sz %2")
33  .arg(off).arg(m_data.size()));
34  return false;
35  }
36  m_off = off;
37 
38  return true;
39 }
rtpdatapacket.h
RTPDataPacket::GetVersion
uint GetVersion(void) const
Definition: rtpdatapacket.h:44
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
UDPPacket::m_data
QByteArray m_data
Definition: udppacket.h:42
mythlogging.h
RTPDataPacket::GetCSRCCount
uint GetCSRCCount(void) const
Definition: rtpdatapacket.h:47
RTPDataPacket::m_off
uint m_off
Definition: rtpdatapacket.h:95
RTPDataPacket::HasExtension
bool HasExtension(void) const
Definition: rtpdatapacket.h:46
RTPDataPacket::IsValid
bool IsValid(void) const override
IsValid() must return true before any data access methods are called, other than GetDataReference() a...
Definition: rtpdatapacket.cpp:5
uint
unsigned int uint
Definition: freesurround.h:24