Some documenting comments and debug lines, mostly just trying to understand what the code does
This commit is contained in:
parent
238a25a302
commit
04800afaf5
|
@ -262,6 +262,11 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen )
|
||||||
int rtpHeaderSize = 12 + rtpHeader->cc * 4;
|
int rtpHeaderSize = 12 + rtpHeader->cc * 4;
|
||||||
// No need to check for nal type as non fragmented packets already have 001 start sequence appended
|
// No need to check for nal type as non fragmented packets already have 001 start sequence appended
|
||||||
bool h264FragmentEnd = (mCodecId == AV_CODEC_ID_H264) && (packet[rtpHeaderSize+1] & 0x40);
|
bool h264FragmentEnd = (mCodecId == AV_CODEC_ID_H264) && (packet[rtpHeaderSize+1] & 0x40);
|
||||||
|
// M stands for Market, it is the 8th bit
|
||||||
|
// The interpretation of the marker is defined by a profile. It is intended
|
||||||
|
// to allow significant events such as frame boundaries to be marked in the
|
||||||
|
// packet stream. A profile may define additional marker bits or specify
|
||||||
|
// that there is no marker bit by changing the number of bits in the payload type field.
|
||||||
bool thisM = rtpHeader->m || h264FragmentEnd;
|
bool thisM = rtpHeader->m || h264FragmentEnd;
|
||||||
|
|
||||||
if ( updateSeq( ntohs(rtpHeader->seqN) ) )
|
if ( updateSeq( ntohs(rtpHeader->seqN) ) )
|
||||||
|
@ -275,15 +280,18 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen )
|
||||||
if( mCodecId == AV_CODEC_ID_H264 )
|
if( mCodecId == AV_CODEC_ID_H264 )
|
||||||
{
|
{
|
||||||
int nalType = (packet[rtpHeaderSize] & 0x1f);
|
int nalType = (packet[rtpHeaderSize] & 0x1f);
|
||||||
|
Debug( 3, "Have H264 frame: nal type is %d", nalType );
|
||||||
|
|
||||||
switch (nalType)
|
switch (nalType)
|
||||||
{
|
{
|
||||||
case 24:
|
case 24: // STAP-A
|
||||||
{
|
{
|
||||||
extraHeader = 2;
|
extraHeader = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 25: case 26: case 27:
|
case 25: // STAP-B
|
||||||
|
case 26: // MTAP-16
|
||||||
|
case 27: // MTAP-24
|
||||||
{
|
{
|
||||||
extraHeader = 3;
|
extraHeader = 3;
|
||||||
break;
|
break;
|
||||||
|
@ -304,6 +312,9 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen )
|
||||||
extraHeader = 2;
|
extraHeader = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
Debug(3, "Unhandled nalType %d", nalType );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append NAL frame start code
|
// Append NAL frame start code
|
||||||
|
@ -311,6 +322,8 @@ bool RtpSource::handlePacket( const unsigned char *packet, size_t packetLen )
|
||||||
mFrame.append( "\x0\x0\x1", 3 );
|
mFrame.append( "\x0\x0\x1", 3 );
|
||||||
}
|
}
|
||||||
mFrame.append( packet+rtpHeaderSize+extraHeader, packetLen-rtpHeaderSize-extraHeader );
|
mFrame.append( packet+rtpHeaderSize+extraHeader, packetLen-rtpHeaderSize-extraHeader );
|
||||||
|
} else {
|
||||||
|
Debug( 3, "NOT H264 frame: type is %d", mCodecId );
|
||||||
}
|
}
|
||||||
|
|
||||||
Hexdump( 4, mFrame.head(), 16 );
|
Hexdump( 4, mFrame.head(), 16 );
|
||||||
|
|
Loading…
Reference in New Issue