Add NACK and RPSI packet types to RTCP packet builder.

Fixes bug found when parsing received RPSI packet.

BUG=2450
R=mflodman@webrtc.org, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/17419004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6194 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
asapersson@webrtc.org
2014-05-20 09:53:51 +00:00
parent 2db9f45038
commit a826006132
6 changed files with 574 additions and 149 deletions

View File

@ -1266,31 +1266,27 @@ RTCPUtility::RTCPParserV2::ParseFBCommon(const RTCPCommonHeader& header)
}
}
bool
RTCPUtility::RTCPParserV2::ParseRPSIItem()
{
// RFC 4585 6.3.3. Reference Picture Selection Indication (RPSI)
/*
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PB |0| Payload Type| Native RPSI bit string |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| defined per codec ... | Padding (0) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
bool RTCPUtility::RTCPParserV2::ParseRPSIItem() {
// RFC 4585 6.3.3. Reference Picture Selection Indication (RPSI).
//
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | PB |0| Payload Type| Native RPSI bit string |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | defined per codec ... | Padding (0) |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
const ptrdiff_t length = _ptrRTCPBlockEnd - _ptrRTCPData;
if (length < 4)
{
if (length < 4) {
_state = State_TopLevel;
EndCurrentBlock();
return false;
}
if(length > 2+RTCP_RPSI_DATA_SIZE)
{
if (length > 2 + RTCP_RPSI_DATA_SIZE) {
_state = State_TopLevel;
EndCurrentBlock();
@ -1299,12 +1295,14 @@ RTCPUtility::RTCPParserV2::ParseRPSIItem()
_packetType = kRtcpPsfbRpsiCode;
uint8_t paddingBits = *_ptrRTCPData++;
uint8_t padding_bits = *_ptrRTCPData++;
_packet.RPSI.PayloadType = *_ptrRTCPData++;
memcpy(_packet.RPSI.NativeBitString, _ptrRTCPData, length-2);
memcpy(_packet.RPSI.NativeBitString, _ptrRTCPData, length - 2);
_ptrRTCPData += length - 2;
_packet.RPSI.NumberOfValidBits = uint16_t(length-2)*8 - paddingBits;
_packet.RPSI.NumberOfValidBits =
static_cast<uint16_t>(length - 2) * 8 - padding_bits;
return true;
}