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}
uint GetCSRCCount(void) const
Definition: rtpdatapacket.h:47
bool IsValid(void) const override
IsValid() must return true before any data access methods are called, other than GetDataReference() a...
bool HasExtension(void) const
Definition: rtpdatapacket.h:46
uint GetVersion(void) const
Definition: rtpdatapacket.h:44
QByteArray m_data
Definition: udppacket.h:42
unsigned int uint
Definition: freesurround.h:24
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39