diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc index 0991cc40f..5f5a71ae5 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc @@ -1054,17 +1054,20 @@ uint16_t RTPSender::IncrementSequenceNumber() { void RTPSender::ResetDataCounters() { uint32_t ssrc; uint32_t ssrc_rtx; + bool report_rtx; { CriticalSectionScoped ssrc_lock(send_critsect_.get()); ssrc = ssrc_; ssrc_rtx = ssrc_rtx_; + report_rtx = rtx_ != kRtxOff; } CriticalSectionScoped lock(statistics_crit_.get()); rtp_stats_ = StreamDataCounters(); rtx_rtp_stats_ = StreamDataCounters(); if (rtp_stats_callback_) { rtp_stats_callback_->DataCountersUpdated(rtp_stats_, ssrc); - rtp_stats_callback_->DataCountersUpdated(rtx_rtp_stats_, ssrc_rtx); + if (report_rtx) + rtp_stats_callback_->DataCountersUpdated(rtx_rtp_stats_, ssrc_rtx); } } diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 5e5d2e877..00a1f0d2b 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -12,6 +12,8 @@ #include +#include "webrtc/base/checks.h" + #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/logging.h" @@ -134,6 +136,8 @@ void SendStatisticsProxy::DataCountersUpdated( uint32_t ssrc) { CriticalSectionScoped lock(crit_.get()); SsrcStats* stats = GetStatsEntry(ssrc); + DCHECK(stats != NULL) << "DataCountersUpdated reported for unknown ssrc: " + << ssrc; if (stats == NULL) return; diff --git a/webrtc/video/send_statistics_proxy_unittest.cc b/webrtc/video/send_statistics_proxy_unittest.cc index 4450a59f1..2a154f356 100644 --- a/webrtc/video/send_statistics_proxy_unittest.cc +++ b/webrtc/video/send_statistics_proxy_unittest.cc @@ -300,7 +300,7 @@ TEST_F(SendStatisticsProxyTest, SendSideDelay) { } TEST_F(SendStatisticsProxyTest, NoSubstreams) { - uint32_t exluded_ssrc = + uint32_t excluded_ssrc = std::max( *std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()), *std::max_element(config_.rtp.rtx.ssrcs.begin(), @@ -309,24 +309,19 @@ TEST_F(SendStatisticsProxyTest, NoSubstreams) { // From RtcpStatisticsCallback. RtcpStatistics rtcp_stats; RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get(); - rtcp_callback->StatisticsUpdated(rtcp_stats, exluded_ssrc); - - // From StreamDataCountersCallback. - StreamDataCounters rtp_stats; - StreamDataCountersCallback* rtp_callback = statistics_proxy_.get(); - rtp_callback->DataCountersUpdated(rtp_stats, exluded_ssrc); + rtcp_callback->StatisticsUpdated(rtcp_stats, excluded_ssrc); // From BitrateStatisticsObserver. BitrateStatistics total; BitrateStatistics retransmit; BitrateStatisticsObserver* bitrate_observer = statistics_proxy_.get(); - bitrate_observer->Notify(total, retransmit, exluded_ssrc); + bitrate_observer->Notify(total, retransmit, excluded_ssrc); // From FrameCountObserver. FrameCountObserver* fps_observer = statistics_proxy_.get(); FrameCounts frame_counts; frame_counts.key_frames = 1; - fps_observer->FrameCountUpdated(frame_counts, exluded_ssrc); + fps_observer->FrameCountUpdated(frame_counts, excluded_ssrc); VideoSendStream::Stats stats = statistics_proxy_->GetStats(); EXPECT_TRUE(stats.substreams.empty());