summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc')
-rw-r--r--chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc98
1 files changed, 43 insertions, 55 deletions
diff --git a/chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
index a95fddede25..896bd5f4d3a 100644
--- a/chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/chromium/third_party/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -18,7 +18,7 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
@@ -57,7 +57,6 @@ RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock,
_lastIncreasedSequenceNumberMs(0),
stats_callback_(NULL) {
memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo));
- WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
}
RTCPReceiver::~RTCPReceiver() {
@@ -82,8 +81,6 @@ RTCPReceiver::~RTCPReceiver() {
delete first->second;
_receivedCnameMap.erase(first);
}
- WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, _id,
- "%s deleted", __FUNCTION__);
}
void
@@ -178,8 +175,7 @@ int32_t RTCPReceiver::ResetRTT(const uint32_t remoteSSRC) {
RTCPReportBlockInformation* reportBlock =
GetReportBlockInformation(remoteSSRC);
if (reportBlock == NULL) {
- WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
- "\tfailed to GetReportBlockInformation(%u)", remoteSSRC);
+ LOG(LS_WARNING) << "Failed to reset rtt for ssrc " << remoteSSRC;
return -1;
}
reportBlock->RTT = 0;
@@ -282,22 +278,14 @@ bool RTCPReceiver::LastReceivedXrReferenceTimeInfo(
return true;
}
-int32_t
-RTCPReceiver::SenderInfoReceived(RTCPSenderInfo* senderInfo) const
-{
- if(senderInfo == NULL)
- {
- WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id, "%s invalid argument", __FUNCTION__);
- return -1;
- }
- CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
- if(_lastReceivedSRNTPsecs == 0)
- {
- WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, "%s No received SR", __FUNCTION__);
- return -1;
- }
- memcpy(senderInfo, &(_remoteSenderInfo), sizeof(RTCPSenderInfo));
- return 0;
+int32_t RTCPReceiver::SenderInfoReceived(RTCPSenderInfo* senderInfo) const {
+ assert(senderInfo);
+ CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
+ if (_lastReceivedSRNTPsecs == 0) {
+ return -1;
+ }
+ memcpy(senderInfo, &(_remoteSenderInfo), sizeof(RTCPSenderInfo));
+ return 0;
}
// statistics
@@ -317,6 +305,12 @@ int32_t RTCPReceiver::StatisticsReceived(
return 0;
}
+void RTCPReceiver::GetPacketTypeCounter(
+ RtcpPacketTypeCounter* packet_counter) const {
+ CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
+ *packet_counter = packet_type_counter_;
+}
+
int32_t
RTCPReceiver::IncomingRTCPPacket(RTCPPacketInformation& rtcpPacketInformation,
RTCPUtility::RTCPParserV2* rtcpParser)
@@ -480,11 +474,12 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser,
}
// no need for critsect we have _criticalSectionRTCPReceiver
-void
-RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
- RTCPPacketInformation& rtcpPacketInformation,
- const uint32_t remoteSSRC,
- const uint8_t numberOfReportBlocks) {
+void RTCPReceiver::HandleReportBlock(
+ const RTCPUtility::RTCPPacket& rtcpPacket,
+ RTCPPacketInformation& rtcpPacketInformation,
+ const uint32_t remoteSSRC,
+ const uint8_t numberOfReportBlocks)
+ EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver) {
// This will be called once per report block in the RTCP packet.
// We filter out all report blocks that are not for us.
// Each packet has max 31 RR blocks.
@@ -511,8 +506,8 @@ RTCPReceiver::HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPReportBlockInformation* reportBlock =
CreateReportBlockInformation(remoteSSRC);
if (reportBlock == NULL) {
- WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
- "\tfailed to CreateReportBlockInformation(%u)", remoteSSRC);
+ LOG(LS_WARNING) << "Failed to CreateReportBlockInformation("
+ << remoteSSRC << ")";
return;
}
@@ -772,9 +767,6 @@ int32_t RTCPReceiver::BoundingSet(bool &tmmbrOwner, TMMBRSet* boundingSetRec) {
}
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
if (receiveInfo == NULL) {
- WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
- "%s failed to get RTCPReceiveInformation",
- __FUNCTION__);
return -1;
}
if (receiveInfo->TmmbnBoundingSet.lengthOfSet() > 0) {
@@ -838,6 +830,10 @@ RTCPReceiver::HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
HandleNACKItem(rtcpPacket, rtcpPacketInformation);
pktType = rtcpParser.Iterate();
}
+
+ if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
+ ++packet_type_counter_.nack_packets;
+ }
}
// no need for critsect we have _criticalSectionRTCPReceiver
@@ -940,7 +936,8 @@ void RTCPReceiver::HandleXrDlrrReportBlock(
void RTCPReceiver::HandleXrDlrrReportBlockItem(
const RTCPUtility::RTCPPacket& packet,
- RTCPPacketInformation& rtcpPacketInformation) {
+ RTCPPacketInformation& rtcpPacketInformation)
+ EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver) {
if (registered_ssrcs_.find(packet.XRDLRRReportBlockItem.SSRC) ==
registered_ssrcs_.end()) {
// Not to us.
@@ -1026,6 +1023,7 @@ void RTCPReceiver::HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser,
if (main_ssrc_ == rtcpPacket.PLI.MediaSSRC) {
TRACE_EVENT_INSTANT0("webrtc_rtp", "PLI");
+ ++packet_type_counter_.pli_packets;
// Received a signal that we need to send a new key frame.
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpPli;
}
@@ -1268,6 +1266,9 @@ void RTCPReceiver::HandleFIRItem(RTCPReceiveInformation* receiveInfo,
if (main_ssrc_ != rtcpPacket.FIRItem.SSRC) {
return;
}
+
+ ++packet_type_counter_.fir_packets;
+
// rtcpPacket.FIR.MediaSSRC SHOULD be 0 but we ignore to check it
// we don't know who this originate from
if (receiveInfo) {
@@ -1332,8 +1333,7 @@ int32_t RTCPReceiver::UpdateTMMBR() {
TMMBRSet* boundingSet = NULL;
numBoundingSet = FindTMMBRBoundingSet(boundingSet);
if (numBoundingSet == -1) {
- WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id,
- "Failed to find TMMBR bounding set.");
+ LOG(LS_WARNING) << "Failed to find TMMBR bounding set.";
return -1;
}
// Set bounding set
@@ -1353,8 +1353,6 @@ int32_t RTCPReceiver::UpdateTMMBR() {
CriticalSectionScoped lock(_criticalSectionFeedbacks);
if (_cbRtcpBandwidthObserver) {
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(bitrate * 1000);
- WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id,
- "Set TMMBR request:%d kbps", bitrate);
}
}
return 0;
@@ -1379,9 +1377,6 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
// Process TMMBR and REMB first to avoid multiple callbacks
// to OnNetworkChanged.
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpTmmbr) {
- WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
- "SIG [RTCP] Incoming TMMBR to id:%d", _id);
-
// Might trigger a OnReceivedBandwidthEstimateUpdate.
UpdateTMMBR();
}
@@ -1396,9 +1391,8 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
}
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
if (rtcpPacketInformation.nackSequenceNumbers.size() > 0) {
- WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
- "SIG [RTCP] Incoming NACK length:%d",
- rtcpPacketInformation.nackSequenceNumbers.size());
+ LOG(LS_VERBOSE) << "Incoming NACK length: "
+ << rtcpPacketInformation.nackSequenceNumbers.size();
_rtpRtcp.OnReceivedNACK(rtcpPacketInformation.nackSequenceNumbers);
}
}
@@ -1413,13 +1407,11 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) ||
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpFir)) {
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) {
- WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
- "SIG [RTCP] Incoming PLI from SSRC:0x%x",
- rtcpPacketInformation.remoteSSRC);
+ LOG(LS_VERBOSE) << "Incoming PLI from SSRC "
+ << rtcpPacketInformation.remoteSSRC;
} else {
- WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
- "SIG [RTCP] Incoming FIR from SSRC:0x%x",
- rtcpPacketInformation.remoteSSRC);
+ LOG(LS_VERBOSE) << "Incoming FIR from SSRC "
+ << rtcpPacketInformation.remoteSSRC;
}
_cbRtcpIntraFrameObserver->OnReceivedIntraFrameRequest(local_ssrc);
}
@@ -1434,9 +1426,8 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
}
if (_cbRtcpBandwidthObserver) {
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb) {
- WEBRTC_TRACE(kTraceStateInfo, kTraceRtpRtcp, _id,
- "SIG [RTCP] Incoming REMB:%d",
- rtcpPacketInformation.receiverEstimatedMaxBitrate);
+ LOG(LS_VERBOSE) << "Incoming REMB: "
+ << rtcpPacketInformation.receiverEstimatedMaxBitrate;
_cbRtcpBandwidthObserver->OnReceivedEstimatedBitrate(
rtcpPacketInformation.receiverEstimatedMaxBitrate);
}
@@ -1532,9 +1523,6 @@ int32_t RTCPReceiver::TMMBRReceived(const uint32_t size,
while (receiveInfoIt != _receivedInfoMap.end()) {
RTCPReceiveInformation* receiveInfo = receiveInfoIt->second;
if(receiveInfo == NULL) {
- WEBRTC_TRACE(kTraceError, kTraceRtpRtcp, _id,
- "%s failed to get RTCPReceiveInformation",
- __FUNCTION__);
return -1;
}
num += receiveInfo->TmmbrSet.lengthOfSet();