DCHECK send DataCountersUpdated for valid SSRCs.

Also updates RTPSender to not update RTX stats when RTX is disabled.

BUG=
R=stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8489}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8489 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2015-02-24 22:37:52 +00:00
parent 903182bd8e
commit 49096de442
3 changed files with 12 additions and 10 deletions

View File

@ -1054,17 +1054,20 @@ uint16_t RTPSender::IncrementSequenceNumber() {
void RTPSender::ResetDataCounters() { void RTPSender::ResetDataCounters() {
uint32_t ssrc; uint32_t ssrc;
uint32_t ssrc_rtx; uint32_t ssrc_rtx;
bool report_rtx;
{ {
CriticalSectionScoped ssrc_lock(send_critsect_.get()); CriticalSectionScoped ssrc_lock(send_critsect_.get());
ssrc = ssrc_; ssrc = ssrc_;
ssrc_rtx = ssrc_rtx_; ssrc_rtx = ssrc_rtx_;
report_rtx = rtx_ != kRtxOff;
} }
CriticalSectionScoped lock(statistics_crit_.get()); CriticalSectionScoped lock(statistics_crit_.get());
rtp_stats_ = StreamDataCounters(); rtp_stats_ = StreamDataCounters();
rtx_rtp_stats_ = StreamDataCounters(); rtx_rtp_stats_ = StreamDataCounters();
if (rtp_stats_callback_) { if (rtp_stats_callback_) {
rtp_stats_callback_->DataCountersUpdated(rtp_stats_, ssrc); 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);
} }
} }

View File

@ -12,6 +12,8 @@
#include <map> #include <map>
#include "webrtc/base/checks.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/logging.h"
@ -134,6 +136,8 @@ void SendStatisticsProxy::DataCountersUpdated(
uint32_t ssrc) { uint32_t ssrc) {
CriticalSectionScoped lock(crit_.get()); CriticalSectionScoped lock(crit_.get());
SsrcStats* stats = GetStatsEntry(ssrc); SsrcStats* stats = GetStatsEntry(ssrc);
DCHECK(stats != NULL) << "DataCountersUpdated reported for unknown ssrc: "
<< ssrc;
if (stats == NULL) if (stats == NULL)
return; return;

View File

@ -300,7 +300,7 @@ TEST_F(SendStatisticsProxyTest, SendSideDelay) {
} }
TEST_F(SendStatisticsProxyTest, NoSubstreams) { TEST_F(SendStatisticsProxyTest, NoSubstreams) {
uint32_t exluded_ssrc = uint32_t excluded_ssrc =
std::max( std::max(
*std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()), *std::max_element(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end()),
*std::max_element(config_.rtp.rtx.ssrcs.begin(), *std::max_element(config_.rtp.rtx.ssrcs.begin(),
@ -309,24 +309,19 @@ TEST_F(SendStatisticsProxyTest, NoSubstreams) {
// From RtcpStatisticsCallback. // From RtcpStatisticsCallback.
RtcpStatistics rtcp_stats; RtcpStatistics rtcp_stats;
RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get(); RtcpStatisticsCallback* rtcp_callback = statistics_proxy_.get();
rtcp_callback->StatisticsUpdated(rtcp_stats, exluded_ssrc); rtcp_callback->StatisticsUpdated(rtcp_stats, excluded_ssrc);
// From StreamDataCountersCallback.
StreamDataCounters rtp_stats;
StreamDataCountersCallback* rtp_callback = statistics_proxy_.get();
rtp_callback->DataCountersUpdated(rtp_stats, exluded_ssrc);
// From BitrateStatisticsObserver. // From BitrateStatisticsObserver.
BitrateStatistics total; BitrateStatistics total;
BitrateStatistics retransmit; BitrateStatistics retransmit;
BitrateStatisticsObserver* bitrate_observer = statistics_proxy_.get(); BitrateStatisticsObserver* bitrate_observer = statistics_proxy_.get();
bitrate_observer->Notify(total, retransmit, exluded_ssrc); bitrate_observer->Notify(total, retransmit, excluded_ssrc);
// From FrameCountObserver. // From FrameCountObserver.
FrameCountObserver* fps_observer = statistics_proxy_.get(); FrameCountObserver* fps_observer = statistics_proxy_.get();
FrameCounts frame_counts; FrameCounts frame_counts;
frame_counts.key_frames = 1; 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(); VideoSendStream::Stats stats = statistics_proxy_->GetStats();
EXPECT_TRUE(stats.substreams.empty()); EXPECT_TRUE(stats.substreams.empty());