Change CreateOrGetReportBlockInformation to have one return path.

R=mflodman@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8113 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
asapersson@webrtc.org
2015-01-21 13:07:04 +00:00
parent f938922c5c
commit df7b65ba01
2 changed files with 199 additions and 252 deletions

View File

@@ -54,7 +54,7 @@ RTCPReceiver::RTCPReceiver(int32_t id, Clock* clock, ModuleRtpRtcpImpl* owner)
_lastReceivedRrMs(0), _lastReceivedRrMs(0),
_lastIncreasedSequenceNumberMs(0), _lastIncreasedSequenceNumberMs(0),
stats_callback_(NULL) { stats_callback_(NULL) {
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
} }
RTCPReceiver::~RTCPReceiver() { RTCPReceiver::~RTCPReceiver() {
@@ -85,14 +85,12 @@ RTCPReceiver::~RTCPReceiver() {
} }
void RTCPReceiver::ChangeUniqueId(int32_t id) { void RTCPReceiver::ChangeUniqueId(int32_t id) {
_id = id; _id = id;
} }
RTCPMethod RTCPMethod RTCPReceiver::Status() const {
RTCPReceiver::Status() const CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
{ return _method;
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
return _method;
} }
void RTCPReceiver::SetRTCPStatus(RTCPMethod method) { void RTCPReceiver::SetRTCPStatus(RTCPMethod method) {
@@ -100,36 +98,32 @@ void RTCPReceiver::SetRTCPStatus(RTCPMethod method) {
_method = method; _method = method;
} }
int64_t int64_t RTCPReceiver::LastReceived() {
RTCPReceiver::LastReceived() CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
{ return _lastReceived;
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
return _lastReceived;
} }
int64_t int64_t RTCPReceiver::LastReceivedReceiverReport() const {
RTCPReceiver::LastReceivedReceiverReport() const { CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
CriticalSectionScoped lock(_criticalSectionRTCPReceiver); int64_t last_received_rr = -1;
int64_t last_received_rr = -1; for (ReceivedInfoMap::const_iterator it = _receivedInfoMap.begin();
for (ReceivedInfoMap::const_iterator it = _receivedInfoMap.begin(); it != _receivedInfoMap.end(); ++it) {
it != _receivedInfoMap.end(); ++it) { if (it->second->lastTimeReceived > last_received_rr) {
if (it->second->lastTimeReceived > last_received_rr) { last_received_rr = it->second->lastTimeReceived;
last_received_rr = it->second->lastTimeReceived;
}
} }
return last_received_rr; }
return last_received_rr;
} }
int32_t RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) {
CriticalSectionScoped lock(_criticalSectionRTCPReceiver); CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
// new SSRC reset old reports // new SSRC reset old reports
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
_lastReceivedSRNTPsecs = 0; _lastReceivedSRNTPsecs = 0;
_lastReceivedSRNTPfrac = 0; _lastReceivedSRNTPfrac = 0;
_remoteSSRC = ssrc; _remoteSSRC = ssrc;
return 0;
} }
uint32_t RTCPReceiver::RemoteSSRC() const { uint32_t RTCPReceiver::RemoteSSRC() const {
@@ -393,7 +387,6 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
// The source of the packet sender, same as of SR? or is this a CE? // The source of the packet sender, same as of SR? or is this a CE?
const uint32_t remoteSSRC = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.SenderSSRC:rtcpPacket.SR.SenderSSRC; const uint32_t remoteSSRC = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.SenderSSRC:rtcpPacket.SR.SenderSSRC;
const uint8_t numberOfReportBlocks = (rtcpPacketType == RTCPUtility::kRtcpRrCode) ? rtcpPacket.RR.NumberOfReportBlocks:rtcpPacket.SR.NumberOfReportBlocks;
rtcpPacketInformation.remoteSSRC = remoteSSRC; rtcpPacketInformation.remoteSSRC = remoteSSRC;
@@ -449,7 +442,7 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
while (rtcpPacketType == RTCPUtility::kRtcpReportBlockItemCode) while (rtcpPacketType == RTCPUtility::kRtcpReportBlockItemCode)
{ {
HandleReportBlock(rtcpPacket, rtcpPacketInformation, remoteSSRC, numberOfReportBlocks); HandleReportBlock(rtcpPacket, rtcpPacketInformation, remoteSSRC);
rtcpPacketType = rtcpParser.Iterate(); rtcpPacketType = rtcpParser.Iterate();
} }
} }
@@ -458,8 +451,7 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
void RTCPReceiver::HandleReportBlock( void RTCPReceiver::HandleReportBlock(
const RTCPUtility::RTCPPacket& rtcpPacket, const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation, RTCPPacketInformation& rtcpPacketInformation,
uint32_t remoteSSRC, uint32_t remoteSSRC)
uint8_t numberOfReportBlocks)
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver) { EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver) {
// This will be called once per report block in the RTCP packet. // This will be called once per report block in the RTCP packet.
// We filter out all report blocks that are not for us. // We filter out all report blocks that are not for us.
@@ -576,19 +568,12 @@ void RTCPReceiver::HandleReportBlock(
RTCPReportBlockInformation* RTCPReceiver::CreateOrGetReportBlockInformation( RTCPReportBlockInformation* RTCPReceiver::CreateOrGetReportBlockInformation(
uint32_t remote_ssrc, uint32_t remote_ssrc,
uint32_t source_ssrc) { uint32_t source_ssrc) {
ReportBlockMap::iterator it = _receivedReportBlockMap.find(source_ssrc); RTCPReportBlockInformation* info =
if (it != _receivedReportBlockMap.end()) { GetReportBlockInformation(remote_ssrc, source_ssrc);
ReportBlockInfoMap* info_map = &(it->second); if (info == NULL) {
ReportBlockInfoMap::iterator it_info = info_map->find(remote_ssrc); info = new RTCPReportBlockInformation;
if (it_info != info_map->end()) { _receivedReportBlockMap[source_ssrc][remote_ssrc] = info;
return it_info->second;
}
RTCPReportBlockInformation* info = new RTCPReportBlockInformation;
(*info_map)[remote_ssrc] = info;
return info;
} }
RTCPReportBlockInformation* info = new RTCPReportBlockInformation;
_receivedReportBlockMap[source_ssrc][remote_ssrc] = info;
return info; return info;
} }
@@ -774,15 +759,12 @@ int32_t RTCPReceiver::BoundingSet(bool &tmmbrOwner, TMMBRSet* boundingSetRec) {
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser) {
RTCPReceiver::HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser) RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
{ while (pktType == RTCPUtility::kRtcpSdesChunkCode) {
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); HandleSDESChunk(rtcpParser);
while (pktType == RTCPUtility::kRtcpSdesChunkCode) pktType = rtcpParser.Iterate();
{ }
HandleSDESChunk(rtcpParser);
pktType = rtcpParser.Iterate();
}
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
@@ -801,56 +783,47 @@ void RTCPReceiver::HandleSDESChunk(RTCPUtility::RTCPParserV2& rtcpParser) {
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{ if (main_ssrc_ != rtcpPacket.NACK.MediaSSRC) {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); // Not to us.
if (main_ssrc_ != rtcpPacket.NACK.MediaSSRC) rtcpParser.Iterate();
{ return;
// Not to us. }
rtcpParser.Iterate(); rtcpPacketInformation.ResetNACKPacketIdArray();
return;
}
rtcpPacketInformation.ResetNACKPacketIdArray();
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpRtpfbNackItemCode) while (pktType == RTCPUtility::kRtcpRtpfbNackItemCode) {
{ HandleNACKItem(rtcpPacket, rtcpPacketInformation);
HandleNACKItem(rtcpPacket, rtcpPacketInformation); pktType = rtcpParser.Iterate();
pktType = rtcpParser.Iterate(); }
}
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) { if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
++packet_type_counter_.nack_packets; ++packet_type_counter_.nack_packets;
packet_type_counter_.nack_requests = nack_stats_.requests(); packet_type_counter_.nack_requests = nack_stats_.requests();
packet_type_counter_.unique_nack_requests = nack_stats_.unique_requests(); packet_type_counter_.unique_nack_requests = nack_stats_.unique_requests();
} }
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void
RTCPReceiver::HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket, RTCPReceiver::HandleNACKItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) RTCPPacketInformation& rtcpPacketInformation) {
{ rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID);
rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID); nack_stats_.ReportRequest(rtcpPacket.NACKItem.PacketID);
nack_stats_.ReportRequest(rtcpPacket.NACKItem.PacketID);
uint16_t bitMask = rtcpPacket.NACKItem.BitMask; uint16_t bitMask = rtcpPacket.NACKItem.BitMask;
if(bitMask) if (bitMask) {
{ for (int i=1; i <= 16; ++i) {
for(int i=1; i <= 16; ++i) if (bitMask & 0x01) {
{ rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID + i);
if(bitMask & 0x01) nack_stats_.ReportRequest(rtcpPacket.NACKItem.PacketID + i);
{ }
rtcpPacketInformation.AddNACKPacket(rtcpPacket.NACKItem.PacketID + i); bitMask = bitMask >>1;
nack_stats_.ReportRequest(rtcpPacket.NACKItem.PacketID + i);
}
bitMask = bitMask >>1;
}
} }
}
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpNack; rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpNack;
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
@@ -1028,46 +1001,40 @@ void RTCPReceiver::HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser,
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
uint32_t senderSSRC = rtcpPacket.TMMBR.SenderSSRC; uint32_t senderSSRC = rtcpPacket.TMMBR.SenderSSRC;
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(senderSSRC); RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(senderSSRC);
if (ptrReceiveInfo == NULL) if (ptrReceiveInfo == NULL) {
{ // This remote SSRC must be saved before.
// This remote SSRC must be saved before. rtcpParser.Iterate();
rtcpParser.Iterate(); return;
return; }
} if (rtcpPacket.TMMBR.MediaSSRC) {
if(rtcpPacket.TMMBR.MediaSSRC) // rtcpPacket.TMMBR.MediaSSRC SHOULD be 0 if same as SenderSSRC
{ // in relay mode this is a valid number
// rtcpPacket.TMMBR.MediaSSRC SHOULD be 0 if same as SenderSSRC senderSSRC = rtcpPacket.TMMBR.MediaSSRC;
// in relay mode this is a valid number }
senderSSRC = rtcpPacket.TMMBR.MediaSSRC;
}
// Use packet length to calc max number of TMMBR blocks // Use packet length to calc max number of TMMBR blocks
// each TMMBR block is 8 bytes // each TMMBR block is 8 bytes
ptrdiff_t maxNumOfTMMBRBlocks = rtcpParser.LengthLeft() / 8; ptrdiff_t maxNumOfTMMBRBlocks = rtcpParser.LengthLeft() / 8;
// sanity // sanity, we can't have more than what's in one packet
if(maxNumOfTMMBRBlocks > 200) // we can't have more than what's in one packet if (maxNumOfTMMBRBlocks > 200) {
{ assert(false);
assert(false); rtcpParser.Iterate();
rtcpParser.Iterate(); return;
return; }
} ptrReceiveInfo->VerifyAndAllocateTMMBRSet((uint32_t)maxNumOfTMMBRBlocks);
ptrReceiveInfo->VerifyAndAllocateTMMBRSet((uint32_t)maxNumOfTMMBRBlocks);
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpRtpfbTmmbrItemCode) while (pktType == RTCPUtility::kRtcpRtpfbTmmbrItemCode) {
{ HandleTMMBRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation, senderSSRC);
HandleTMMBRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation, senderSSRC); pktType = rtcpParser.Iterate();
pktType = rtcpParser.Iterate(); }
}
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
@@ -1075,93 +1042,79 @@ void RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket, const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation, RTCPPacketInformation& rtcpPacketInformation,
uint32_t senderSSRC) { uint32_t senderSSRC) {
if (main_ssrc_ == rtcpPacket.TMMBRItem.SSRC && if (main_ssrc_ == rtcpPacket.TMMBRItem.SSRC &&
rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0) rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0) {
{ receiveInfo.InsertTMMBRItem(senderSSRC, rtcpPacket.TMMBRItem,
receiveInfo.InsertTMMBRItem(senderSSRC, rtcpPacket.TMMBRItem, _clock->TimeInMilliseconds());
_clock->TimeInMilliseconds()); rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbr;
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbr; }
}
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{ RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); rtcpPacket.TMMBN.SenderSSRC);
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(rtcpPacket.TMMBN.SenderSSRC); if (ptrReceiveInfo == NULL) {
if (ptrReceiveInfo == NULL) // This remote SSRC must be saved before.
{
// This remote SSRC must be saved before.
rtcpParser.Iterate();
return;
}
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbn;
// Use packet length to calc max number of TMMBN blocks
// each TMMBN block is 8 bytes
ptrdiff_t maxNumOfTMMBNBlocks = rtcpParser.LengthLeft() / 8;
// sanity
if(maxNumOfTMMBNBlocks > 200) // we cant have more than what's in one packet
{
assert(false);
rtcpParser.Iterate();
return;
}
ptrReceiveInfo->VerifyAndAllocateBoundingSet((uint32_t)maxNumOfTMMBNBlocks);
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpRtpfbTmmbnItemCode)
{
HandleTMMBNItem(*ptrReceiveInfo, rtcpPacket);
pktType = rtcpParser.Iterate();
}
}
// no need for critsect we have _criticalSectionRTCPReceiver
void
RTCPReceiver::HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation)
{
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSrReq;
rtcpParser.Iterate(); rtcpParser.Iterate();
return;
}
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbn;
// Use packet length to calc max number of TMMBN blocks
// each TMMBN block is 8 bytes
ptrdiff_t maxNumOfTMMBNBlocks = rtcpParser.LengthLeft() / 8;
// sanity, we cant have more than what's in one packet
if (maxNumOfTMMBNBlocks > 200) {
assert(false);
rtcpParser.Iterate();
return;
}
ptrReceiveInfo->VerifyAndAllocateBoundingSet((uint32_t)maxNumOfTMMBNBlocks);
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpRtpfbTmmbnItemCode) {
HandleTMMBNItem(*ptrReceiveInfo, rtcpPacket);
pktType = rtcpParser.Iterate();
}
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleSR_REQ(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleTMMBNItem(RTCPReceiveInformation& receiveInfo, RTCPPacketInformation& rtcpPacketInformation) {
const RTCPUtility::RTCPPacket& rtcpPacket) rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSrReq;
{ rtcpParser.Iterate();
receiveInfo.TmmbnBoundingSet.AddEntry(
rtcpPacket.TMMBNItem.MaxTotalMediaBitRate,
rtcpPacket.TMMBNItem.MeasuredOverhead,
rtcpPacket.TMMBNItem.SSRC);
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleTMMBNItem(RTCPReceiveInformation& receiveInfo,
RTCPReceiver::HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser, const RTCPUtility::RTCPPacket& rtcpPacket) {
RTCPPacketInformation& rtcpPacketInformation) receiveInfo.TmmbnBoundingSet.AddEntry(
{ rtcpPacket.TMMBNItem.MaxTotalMediaBitRate,
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); rtcpPacket.TMMBNItem.MeasuredOverhead,
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); rtcpPacket.TMMBNItem.SSRC);
while (pktType == RTCPUtility::kRtcpPsfbSliItemCode)
{
HandleSLIItem(rtcpPacket, rtcpPacketInformation);
pktType = rtcpParser.Iterate();
}
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleSLIItem(const RTCPUtility::RTCPPacket& rtcpPacket, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{ RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
// in theory there could be multiple slices lost while (pktType == RTCPUtility::kRtcpPsfbSliItemCode) {
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSli; // received signal that we need to refresh a slice HandleSLIItem(rtcpPacket, rtcpPacketInformation);
rtcpPacketInformation.sliPictureId = rtcpPacket.SLIItem.PictureId; pktType = rtcpParser.Iterate();
}
}
// no need for critsect we have _criticalSectionRTCPReceiver
void RTCPReceiver::HandleSLIItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) {
// in theory there could be multiple slices lost
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpSli; // received signal that we need to refresh a slice
rtcpPacketInformation.sliPictureId = rtcpPacket.SLIItem.PictureId;
} }
void void
@@ -1207,27 +1160,22 @@ void RTCPReceiver::HandlePsfbApp(RTCPUtility::RTCPParserV2& rtcpParser,
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleIJ(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleIJ(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpExtendedIjItemCode) while (pktType == RTCPUtility::kRtcpExtendedIjItemCode) {
{ HandleIJItem(rtcpPacket, rtcpPacketInformation);
HandleIJItem(rtcpPacket, rtcpPacketInformation); pktType = rtcpParser.Iterate();
pktType = rtcpParser.Iterate(); }
}
} }
void void RTCPReceiver::HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPReceiver::HandleIJItem(const RTCPUtility::RTCPPacket& rtcpPacket, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTransmissionTimeOffset;
{ rtcpPacketInformation.interArrivalJitter =
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTransmissionTimeOffset; rtcpPacket.ExtendedJitterReportItem.Jitter;
rtcpPacketInformation.interArrivalJitter =
rtcpPacket.ExtendedJitterReportItem.Jitter;
} }
void RTCPReceiver::HandleREMBItem( void RTCPReceiver::HandleREMBItem(
@@ -1286,28 +1234,24 @@ void RTCPReceiver::HandleFIRItem(RTCPReceiveInformation* receiveInfo,
} }
} }
void void RTCPReceiver::HandleAPP(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleAPP(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpApp; rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpApp;
rtcpPacketInformation.applicationSubType = rtcpPacket.APP.SubType; rtcpPacketInformation.applicationSubType = rtcpPacket.APP.SubType;
rtcpPacketInformation.applicationName = rtcpPacket.APP.Name; rtcpPacketInformation.applicationName = rtcpPacket.APP.Name;
rtcpParser.Iterate(); rtcpParser.Iterate();
} }
void void RTCPReceiver::HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleAPPItem(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation) const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
rtcpPacketInformation.AddApplicationData(rtcpPacket.APP.Data, rtcpPacket.APP.Size); rtcpPacketInformation.AddApplicationData(rtcpPacket.APP.Data, rtcpPacket.APP.Size);
rtcpParser.Iterate(); rtcpParser.Iterate();
} }
int32_t RTCPReceiver::UpdateTMMBR() { int32_t RTCPReceiver::UpdateTMMBR() {
@@ -1401,10 +1345,10 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpFir)) { (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpFir)) {
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) { if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) {
LOG(LS_VERBOSE) << "Incoming PLI from SSRC " LOG(LS_VERBOSE) << "Incoming PLI from SSRC "
<< rtcpPacketInformation.remoteSSRC; << rtcpPacketInformation.remoteSSRC;
} else { } else {
LOG(LS_VERBOSE) << "Incoming FIR from SSRC " LOG(LS_VERBOSE) << "Incoming FIR from SSRC "
<< rtcpPacketInformation.remoteSSRC; << rtcpPacketInformation.remoteSSRC;
} }
_cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc); _cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc);
} }
@@ -1420,7 +1364,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
if (_cbRtcpBandwidthObserver) { if (_cbRtcpBandwidthObserver) {
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb) { if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb) {
LOG(LS_VERBOSE) << "Incoming REMB: " LOG(LS_VERBOSE) << "Incoming REMB: "
<< rtcpPacketInformation.receiverEstimatedMaxBitrate; << rtcpPacketInformation.receiverEstimatedMaxBitrate;
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate( _cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(
rtcpPacketInformation.receiverEstimatedMaxBitrate); rtcpPacketInformation.receiverEstimatedMaxBitrate);
} }

View File

@@ -43,7 +43,7 @@ public:
void SetSsrcs(uint32_t main_ssrc, void SetSsrcs(uint32_t main_ssrc,
const std::set<uint32_t>& registered_ssrcs); const std::set<uint32_t>& registered_ssrcs);
void SetRelaySSRC(uint32_t ssrc); void SetRelaySSRC(uint32_t ssrc);
int32_t SetRemoteSSRC(uint32_t ssrc); void SetRemoteSSRC(uint32_t ssrc);
uint32_t RemoteSSRC() const; uint32_t RemoteSSRC() const;
uint32_t RelaySSRC() const; uint32_t RelaySSRC() const;
@@ -55,7 +55,8 @@ public:
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2 *rtcpParser); RTCPUtility::RTCPParserV2 *rtcpParser);
void TriggerCallbacksFromRTCPPacket(RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); void TriggerCallbacksFromRTCPPacket(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
// get received cname // get received cname
int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const; int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const;
@@ -119,16 +120,17 @@ protected:
uint32_t remoteSSRC); uint32_t remoteSSRC);
RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC); RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC);
void UpdateReceiveInformation( RTCPHelp::RTCPReceiveInformation& receiveInformation); void UpdateReceiveInformation(
RTCPHelp::RTCPReceiveInformation& receiveInformation);
void HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, void HandleSenderReceiverReport(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
void HandleReportBlock( void HandleReportBlock(
const RTCPUtility::RTCPPacket& rtcpPacket, const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, RTCPHelp::RTCPPacketInformation& rtcpPacketInformation,
uint32_t remoteSSRC, uint32_t remoteSSRC);
uint8_t numberOfReportBlocks);
void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser); void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser);
@@ -149,8 +151,9 @@ protected:
const RTCPUtility::RTCPPacket& packet, const RTCPUtility::RTCPPacket& packet,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
void HandleXRVOIPMetric(RTCPUtility::RTCPParserV2& rtcpParser, void HandleXRVOIPMetric(
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
void HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser, void HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);