Parse out ssrcs in REMB message (needed for ViCE) .
Review URL: https://webrtc-codereview.appspot.com/486003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2061 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -1082,10 +1082,14 @@ RTCPReceiver::HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser,
|
|||||||
RTCPPacketInformation& rtcpPacketInformation)
|
RTCPPacketInformation& rtcpPacketInformation)
|
||||||
{
|
{
|
||||||
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
|
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
|
||||||
if (pktType == RTCPUtility::kRtcpPsfbRembItemCode)
|
if (pktType == RTCPUtility::kRtcpPsfbRembCode)
|
||||||
{
|
{
|
||||||
HandleREMBItem(rtcpParser, rtcpPacketInformation);
|
pktType = rtcpParser.Iterate();
|
||||||
rtcpParser.Iterate();
|
if (pktType == RTCPUtility::kRtcpPsfbRembItemCode)
|
||||||
|
{
|
||||||
|
HandleREMBItem(rtcpParser, rtcpPacketInformation);
|
||||||
|
rtcpParser.Iterate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1117,12 +1121,11 @@ void
|
|||||||
RTCPReceiver::HandleREMBItem(RTCPUtility::RTCPParserV2& rtcpParser,
|
RTCPReceiver::HandleREMBItem(RTCPUtility::RTCPParserV2& rtcpParser,
|
||||||
RTCPPacketInformation& rtcpPacketInformation)
|
RTCPPacketInformation& rtcpPacketInformation)
|
||||||
{
|
{
|
||||||
rtcpParser.Iterate();
|
|
||||||
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
|
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
|
||||||
|
|
||||||
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRemb;
|
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpRemb;
|
||||||
rtcpPacketInformation.receiverEstimatedMaxBitrate = rtcpPacket.REMB.BitRate;
|
rtcpPacketInformation.receiverEstimatedMaxBitrate =
|
||||||
// TODO(pwestin) send up SSRCs and do a sanity check
|
rtcpPacket.REMBItem.BitRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need for critsect we have _criticalSectionRTCPReceiver
|
// no need for critsect we have _criticalSectionRTCPReceiver
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include <cmath> // ceil
|
#include <cmath> // ceil
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
// RTCPParserV2 : currently read only
|
// RTCPParserV2 : currently read only
|
||||||
|
|
||||||
@ -1095,7 +1094,9 @@ RTCPUtility::RTCPParserV2::ParseFBCommon(const RTCPCommonHeader& header)
|
|||||||
_state = State_PSFB_FIRItem;
|
_state = State_PSFB_FIRItem;
|
||||||
return true;
|
return true;
|
||||||
case 15:
|
case 15:
|
||||||
_packetType = kRtcpPsfbAppCode;
|
_packetType = kRtcpPsfbAppCode;
|
||||||
|
_packet.PSFBAPP.SenderSSRC = senderSSRC;
|
||||||
|
_packet.PSFBAPP.MediaSSRC = mediaSSRC;
|
||||||
|
|
||||||
_state = State_PSFB_AppItem;
|
_state = State_PSFB_AppItem;
|
||||||
return true;
|
return true;
|
||||||
@ -1223,11 +1224,11 @@ RTCPUtility::RTCPParserV2::ParsePsfbAppItem()
|
|||||||
EndCurrentBlock();
|
EndCurrentBlock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_packetType = kRtcpPsfbRembItemCode;
|
_packetType = kRtcpPsfbRembCode;
|
||||||
_state = State_PSFB_REMBItem;
|
_state = State_PSFB_REMBItem;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RTCPUtility::RTCPParserV2::ParsePsfbREMBItem()
|
RTCPUtility::RTCPParserV2::ParsePsfbREMBItem()
|
||||||
{
|
{
|
||||||
@ -1241,7 +1242,7 @@ RTCPUtility::RTCPParserV2::ParsePsfbREMBItem()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WebRtc_UWord8 numSSRC = *_ptrRTCPData++;
|
_packet.REMBItem.NumberOfSSRCs = *_ptrRTCPData++;
|
||||||
const WebRtc_UWord8 brExp = (_ptrRTCPData[0] >> 2) & 0x3F;
|
const WebRtc_UWord8 brExp = (_ptrRTCPData[0] >> 2) & 0x3F;
|
||||||
|
|
||||||
WebRtc_UWord32 brMantissa = (_ptrRTCPData[0] & 0x03) << 16;
|
WebRtc_UWord32 brMantissa = (_ptrRTCPData[0] & 0x03) << 16;
|
||||||
@ -1249,9 +1250,26 @@ RTCPUtility::RTCPParserV2::ParsePsfbREMBItem()
|
|||||||
brMantissa += (_ptrRTCPData[2]);
|
brMantissa += (_ptrRTCPData[2]);
|
||||||
|
|
||||||
_ptrRTCPData += 3; // Fwd read data
|
_ptrRTCPData += 3; // Fwd read data
|
||||||
_packet.REMB.BitRate = (brMantissa << brExp);
|
_packet.REMBItem.BitRate = (brMantissa << brExp);
|
||||||
|
|
||||||
_ptrRTCPData += 4 * numSSRC; // Ignore the SSRCs for now
|
const ptrdiff_t length_ssrcs = _ptrRTCPBlockEnd - _ptrRTCPData;
|
||||||
|
if (length_ssrcs < 4 * _packet.REMBItem.NumberOfSSRCs)
|
||||||
|
{
|
||||||
|
_state = State_TopLevel;
|
||||||
|
|
||||||
|
EndCurrentBlock();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_packetType = kRtcpPsfbRembItemCode;
|
||||||
|
|
||||||
|
for (int i = 0; i < _packet.REMBItem.NumberOfSSRCs; i++)
|
||||||
|
{
|
||||||
|
_packet.REMBItem.SSRCs[i] = *_ptrRTCPData++ << 24;
|
||||||
|
_packet.REMBItem.SSRCs[i] += *_ptrRTCPData++ << 16;
|
||||||
|
_packet.REMBItem.SSRCs[i] += *_ptrRTCPData++ << 8;
|
||||||
|
_packet.REMBItem.SSRCs[i] += *_ptrRTCPData++;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,9 +179,16 @@ namespace RTCPUtility {
|
|||||||
WebRtc_UWord16 NumberOfValidBits;
|
WebRtc_UWord16 NumberOfValidBits;
|
||||||
WebRtc_UWord8 NativeBitString[RTCP_RPSI_DATA_SIZE];
|
WebRtc_UWord8 NativeBitString[RTCP_RPSI_DATA_SIZE];
|
||||||
};
|
};
|
||||||
struct RTCPPacketPSFBREMB
|
struct RTCPPacketPSFBAPP
|
||||||
|
{
|
||||||
|
WebRtc_UWord32 SenderSSRC;
|
||||||
|
WebRtc_UWord32 MediaSSRC;
|
||||||
|
};
|
||||||
|
struct RTCPPacketPSFBREMBItem
|
||||||
{
|
{
|
||||||
WebRtc_UWord32 BitRate;
|
WebRtc_UWord32 BitRate;
|
||||||
|
WebRtc_UWord8 NumberOfSSRCs;
|
||||||
|
WebRtc_UWord32 SSRCs[MAX_NUMBER_OF_REMB_FEEDBACK_SSRCS];
|
||||||
};
|
};
|
||||||
// generic name APP
|
// generic name APP
|
||||||
struct RTCPPacketAPP
|
struct RTCPPacketAPP
|
||||||
@ -210,7 +217,8 @@ namespace RTCPUtility {
|
|||||||
RTCPPacketPSFBSLI SLI;
|
RTCPPacketPSFBSLI SLI;
|
||||||
RTCPPacketPSFBSLIItem SLIItem;
|
RTCPPacketPSFBSLIItem SLIItem;
|
||||||
RTCPPacketPSFBRPSI RPSI;
|
RTCPPacketPSFBRPSI RPSI;
|
||||||
RTCPPacketPSFBREMB REMB;
|
RTCPPacketPSFBAPP PSFBAPP;
|
||||||
|
RTCPPacketPSFBREMBItem REMBItem;
|
||||||
|
|
||||||
RTCPPacketRTPFBTMMBR TMMBR;
|
RTCPPacketRTPFBTMMBR TMMBR;
|
||||||
RTCPPacketRTPFBTMMBRItem TMMBRItem;
|
RTCPPacketRTPFBTMMBRItem TMMBRItem;
|
||||||
@ -251,6 +259,7 @@ namespace RTCPUtility {
|
|||||||
kRtcpPsfbSliCode,
|
kRtcpPsfbSliCode,
|
||||||
kRtcpPsfbSliItemCode,
|
kRtcpPsfbSliItemCode,
|
||||||
kRtcpPsfbAppCode,
|
kRtcpPsfbAppCode,
|
||||||
|
kRtcpPsfbRembCode,
|
||||||
kRtcpPsfbRembItemCode,
|
kRtcpPsfbRembItemCode,
|
||||||
|
|
||||||
// RFC5104
|
// RFC5104
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -31,6 +31,7 @@ enum { RTCP_NUMBER_OF_SR = 60 };
|
|||||||
|
|
||||||
enum { MAX_NUMBER_OF_TEMPORAL_ID = 8 }; // RFC
|
enum { MAX_NUMBER_OF_TEMPORAL_ID = 8 }; // RFC
|
||||||
enum { MAX_NUMBER_OF_DEPENDENCY_QUALITY_ID = 128 };// RFC
|
enum { MAX_NUMBER_OF_DEPENDENCY_QUALITY_ID = 128 };// RFC
|
||||||
|
enum { MAX_NUMBER_OF_REMB_FEEDBACK_SSRCS = 255 };
|
||||||
|
|
||||||
enum { BW_HISTORY_SIZE = 35};
|
enum { BW_HISTORY_SIZE = 35};
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const WebRtc_Word32 id,
|
|||||||
_rtpReceiver(id, audio, clock, this),
|
_rtpReceiver(id, audio, clock, this),
|
||||||
_rtcpSender(id, audio, clock, this),
|
_rtcpSender(id, audio, clock, this),
|
||||||
_rtcpReceiver(id, clock, this),
|
_rtcpReceiver(id, clock, this),
|
||||||
|
_bandwidthManagement(id),
|
||||||
_owns_clock(false),
|
_owns_clock(false),
|
||||||
_clock(*clock),
|
_clock(*clock),
|
||||||
_id(id),
|
_id(id),
|
||||||
@ -104,7 +105,6 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const WebRtc_Word32 id,
|
|||||||
_deadOrAliveActive(false),
|
_deadOrAliveActive(false),
|
||||||
_deadOrAliveTimeoutMS(0),
|
_deadOrAliveTimeoutMS(0),
|
||||||
_deadOrAliveLastTimer(0),
|
_deadOrAliveLastTimer(0),
|
||||||
_bandwidthManagement(id),
|
|
||||||
_receivedNTPsecsAudio(0),
|
_receivedNTPsecsAudio(0),
|
||||||
_receivedNTPfracAudio(0),
|
_receivedNTPfracAudio(0),
|
||||||
_RTCPArrivalTimeSecsAudio(0),
|
_RTCPArrivalTimeSecsAudio(0),
|
||||||
|
@ -480,7 +480,7 @@ public:
|
|||||||
WebRtc_UWord32* available_bandwidth) const;
|
WebRtc_UWord32* available_bandwidth) const;
|
||||||
|
|
||||||
virtual void SetRemoteSSRC(const WebRtc_UWord32 SSRC);
|
virtual void SetRemoteSSRC(const WebRtc_UWord32 SSRC);
|
||||||
|
|
||||||
virtual WebRtc_UWord32 SendTimeOfSendReport(const WebRtc_UWord32 sendReport);
|
virtual WebRtc_UWord32 SendTimeOfSendReport(const WebRtc_UWord32 sendReport);
|
||||||
|
|
||||||
virtual RateControlRegion OnOverUseStateUpdate(const RateControlInput& rateControlInput);
|
virtual RateControlRegion OnOverUseStateUpdate(const RateControlInput& rateControlInput);
|
||||||
@ -546,6 +546,8 @@ protected:
|
|||||||
RTCPSender _rtcpSender;
|
RTCPSender _rtcpSender;
|
||||||
RTCPReceiver _rtcpReceiver;
|
RTCPReceiver _rtcpReceiver;
|
||||||
|
|
||||||
|
BandwidthManagement _bandwidthManagement;
|
||||||
|
|
||||||
bool _owns_clock;
|
bool _owns_clock;
|
||||||
RtpRtcpClock& _clock;
|
RtpRtcpClock& _clock;
|
||||||
private:
|
private:
|
||||||
@ -573,8 +575,6 @@ private:
|
|||||||
WebRtc_UWord32 _deadOrAliveLastTimer;
|
WebRtc_UWord32 _deadOrAliveLastTimer;
|
||||||
|
|
||||||
// receive side
|
// receive side
|
||||||
BandwidthManagement _bandwidthManagement;
|
|
||||||
|
|
||||||
WebRtc_UWord32 _receivedNTPsecsAudio;
|
WebRtc_UWord32 _receivedNTPsecsAudio;
|
||||||
WebRtc_UWord32 _receivedNTPfracAudio;
|
WebRtc_UWord32 _receivedNTPfracAudio;
|
||||||
WebRtc_UWord32 _RTCPArrivalTimeSecsAudio;
|
WebRtc_UWord32 _RTCPArrivalTimeSecsAudio;
|
||||||
|
Reference in New Issue
Block a user