Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: webrtc/video/send_statistics_proxy.cc

Issue 2525293002: Sent bitrate stats are incorrect if FlexFEC is configured. (Closed)
Patch Set: address comment Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ssrc == rtp_config_.flexfec.flexfec_ssrc; 425 ssrc == rtp_config_.flexfec.flexfec_ssrc;
426 bool is_rtx = 426 bool is_rtx =
427 std::find(rtp_config_.rtx.ssrcs.begin(), rtp_config_.rtx.ssrcs.end(), 427 std::find(rtp_config_.rtx.ssrcs.begin(), rtp_config_.rtx.ssrcs.end(),
428 ssrc) != rtp_config_.rtx.ssrcs.end(); 428 ssrc) != rtp_config_.rtx.ssrcs.end();
429 if (!is_media && !is_flexfec && !is_rtx) 429 if (!is_media && !is_flexfec && !is_rtx)
430 return nullptr; 430 return nullptr;
431 431
432 // Insert new entry and return ptr. 432 // Insert new entry and return ptr.
433 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc]; 433 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc];
434 entry->is_rtx = is_rtx; 434 entry->is_rtx = is_rtx;
435 entry->is_flexfec = is_flexfec;
435 436
436 return entry; 437 return entry;
437 } 438 }
438 439
439 void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) { 440 void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) {
440 rtc::CritScope lock(&crit_); 441 rtc::CritScope lock(&crit_);
441 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 442 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
442 if (!stats) 443 if (!stats)
443 return; 444 return;
444 445
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {} 611 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {}
611 612
612 void SendStatisticsProxy::DataCountersUpdated( 613 void SendStatisticsProxy::DataCountersUpdated(
613 const StreamDataCounters& counters, 614 const StreamDataCounters& counters,
614 uint32_t ssrc) { 615 uint32_t ssrc) {
615 rtc::CritScope lock(&crit_); 616 rtc::CritScope lock(&crit_);
616 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 617 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
617 RTC_DCHECK(stats) << "DataCountersUpdated reported for unknown ssrc: " 618 RTC_DCHECK(stats) << "DataCountersUpdated reported for unknown ssrc: "
618 << ssrc; 619 << ssrc;
619 620
621 if (stats->is_flexfec) {
622 // The same counters are reported for both the media ssrc and flexfec ssrc.
623 // Bitrate stats are summed for all SSRCs. Use fec stats from media update.
624 return;
625 }
626
620 stats->rtp_stats = counters; 627 stats->rtp_stats = counters;
621 if (uma_container_->first_rtp_stats_time_ms_ == -1) 628 if (uma_container_->first_rtp_stats_time_ms_ == -1)
622 uma_container_->first_rtp_stats_time_ms_ = clock_->TimeInMilliseconds(); 629 uma_container_->first_rtp_stats_time_ms_ = clock_->TimeInMilliseconds();
623 } 630 }
624 631
625 void SendStatisticsProxy::Notify(uint32_t total_bitrate_bps, 632 void SendStatisticsProxy::Notify(uint32_t total_bitrate_bps,
626 uint32_t retransmit_bitrate_bps, 633 uint32_t retransmit_bitrate_bps,
627 uint32_t ssrc) { 634 uint32_t ssrc) {
628 rtc::CritScope lock(&crit_); 635 rtc::CritScope lock(&crit_);
629 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 636 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 return Fraction(min_required_samples, 1000.0f); 692 return Fraction(min_required_samples, 1000.0f);
686 } 693 }
687 694
688 int SendStatisticsProxy::BoolSampleCounter::Fraction( 695 int SendStatisticsProxy::BoolSampleCounter::Fraction(
689 int min_required_samples, float multiplier) const { 696 int min_required_samples, float multiplier) const {
690 if (num_samples < min_required_samples || num_samples == 0) 697 if (num_samples < min_required_samples || num_samples == 0)
691 return -1; 698 return -1;
692 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 699 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
693 } 700 }
694 } // namespace webrtc 701 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698