From 8224e19dd9f829e1e71fdc0c493f2b5dc5756abd Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Fri, 10 Feb 2012 12:41:57 +0000 Subject: [PATCH] Fixed incorrect packet loss reported to encoder. BUG=275 Review URL: https://webrtc-codereview.appspot.com/394004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1669 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 39 +++++++------------- src/video_engine/include/vie_rtp_rtcp.h | 6 ++- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 64ecf72c4..efbf4b683 100644 --- a/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/src/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -2724,14 +2724,11 @@ void ModuleRtpRtcpImpl::ProcessDefaultModuleBandwidth() { { // get min and max for the sending channels CriticalSectionScoped lock(_criticalSectionModulePtrs); - - std::list::iterator it = - _childModules.begin(); - while (it != _childModules.end()) { - // Get child RTP sender and ask for bitrate estimate + for (std::list::iterator it = _childModules.begin(); + it != _childModules.end(); ++ it) { + // Get child RTP sender and ask for bitrate estimate. ModuleRtpRtcpImpl* childModule = *it; if (childModule->Sending()) { - count++; RTPSender& childRtpSender = (*it)->_rtpSender; const WebRtc_UWord32 childEstimateBps = 1000 * childRtpSender.TargetSendBitrateKbit(); @@ -2741,27 +2738,19 @@ void ModuleRtpRtcpImpl::ProcessDefaultModuleBandwidth() { if (childEstimateBps > maxBitrateBps) { maxBitrateBps = childEstimateBps; } - WebRtc_UWord16 RTT = 0; - WebRtc_UWord8 fractionLost = 0; - RTPReceiver& childRtpReceiver = (*it)->_rtpReceiver; RTCPReceiver& childRtcpReceiver = (*it)->_rtcpReceiver; - childRtpReceiver.Statistics(&fractionLost, - NULL, - NULL, - NULL, - NULL, - NULL, - false); - fractionLostAcc += fractionLost; - childRtcpReceiver.RTT(childRtpReceiver.SSRC(), - &RTT, - NULL, - NULL, - NULL); - maxRoundTripTime = - (RTT > maxRoundTripTime) ? RTT : maxRoundTripTime; + + std::vector rtcp_blocks; + childRtcpReceiver.StatisticsReceived(&rtcp_blocks); + for (std::vector::iterator rit = rtcp_blocks.begin(); + rit != rtcp_blocks.end(); ++rit) { + count++; + fractionLostAcc += rit->fractionLost; + WebRtc_UWord16 RTT = 0; + childRtcpReceiver.RTT(rit->remoteSSRC, &RTT, NULL, NULL, NULL); + maxRoundTripTime = (RTT > maxRoundTripTime) ? RTT : maxRoundTripTime; + } } - it++; } } // end critsect diff --git a/src/video_engine/include/vie_rtp_rtcp.h b/src/video_engine/include/vie_rtp_rtcp.h index 5a6a4de05..edb307a6a 100644 --- a/src/video_engine/include/vie_rtp_rtcp.h +++ b/src/video_engine/include/vie_rtp_rtcp.h @@ -210,7 +210,8 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { bool sender, bool receiver) = 0; - // The function gets statistics from the received RTCP report. + // This function returns our locally created statistics of the received RTP + // stream. virtual int GetReceivedRTCPStatistics( const int video_channel, unsigned short& fraction_lost, @@ -219,7 +220,8 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { unsigned int& jitter, int& rtt_ms) const = 0; - // The function gets statistics from the RTCP report sent to the receiver. + // This function returns statistics reported by the remote client in a RTCP + // packet. virtual int GetSentRTCPStatistics(const int video_channel, unsigned short& fraction_lost, unsigned int& cumulative_lost,