Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 11 #include "webrtc/video/receive_statistics_proxy.h" | 11 #include "webrtc/video/receive_statistics_proxy.h" |
| 12 | 12 |
| 13 #include <cmath> | 13 #include <cmath> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 16 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| 17 #include "webrtc/system_wrappers/include/clock.h" | 17 #include "webrtc/system_wrappers/include/clock.h" |
| 18 #include "webrtc/system_wrappers/include/metrics.h" | 18 #include "webrtc/system_wrappers/include/metrics.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 ReceiveStatisticsProxy::ReceiveStatisticsProxy( | 22 ReceiveStatisticsProxy::ReceiveStatisticsProxy( |
| 23 const VideoReceiveStream::Config& config, | 23 const VideoReceiveStream::Config* config, |
| 24 Clock* clock) | 24 Clock* clock) |
| 25 : clock_(clock), | 25 : clock_(clock), |
| 26 config_(config), | 26 config_(*config), |
| 27 // 1000ms window, scale 1000 for ms to s. | 27 // 1000ms window, scale 1000 for ms to s. |
| 28 decode_fps_estimator_(1000, 1000), | 28 decode_fps_estimator_(1000, 1000), |
| 29 renders_fps_estimator_(1000, 1000), | 29 renders_fps_estimator_(1000, 1000), |
| 30 render_fps_tracker_(100, 10u), | 30 render_fps_tracker_(100, 10u), |
| 31 render_pixel_tracker_(100, 10u) { | 31 render_pixel_tracker_(100, 10u) { |
| 32 stats_.ssrc = config.rtp.remote_ssrc; | 32 stats_.ssrc = config_.rtp.remote_ssrc; |
| 33 for (auto it : config.rtp.rtx) | 33 for (auto it : config_.rtp.rtx) |
| 34 rtx_stats_[it.second.ssrc] = StreamDataCounters(); | 34 rtx_stats_[it.second.ssrc] = StreamDataCounters(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { | 37 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { |
| 38 UpdateHistograms(); | 38 UpdateHistograms(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void ReceiveStatisticsProxy::UpdateHistograms() { | 41 void ReceiveStatisticsProxy::UpdateHistograms() { |
| 42 int fraction_lost = report_block_stats_.FractionLostInPercent(); | 42 int fraction_lost = report_block_stats_.FractionLostInPercent(); |
| 43 if (fraction_lost != -1) { | 43 if (fraction_lost != -1) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 122 RTC_LOGGED_HISTOGRAM_COUNTS_10000( |
| 123 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", | 123 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", |
| 124 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / | 124 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / |
| 125 1000)); | 125 1000)); |
| 126 if (!rtx_stats_.empty()) { | 126 if (!rtx_stats_.empty()) { |
| 127 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 127 RTC_LOGGED_HISTOGRAM_COUNTS_10000( |
| 128 "WebRTC.Video.RtxBitrateReceivedInKbps", | 128 "WebRTC.Video.RtxBitrateReceivedInKbps", |
| 129 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 129 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
| 130 1000)); | 130 1000)); |
| 131 } | 131 } |
| 132 if (config_.rtp.fec.ulpfec_payload_type != -1) { | 132 if (config_.rtp.fec.ulpfec_payload_type != -1) { |
|
mflodman
2016/06/10 14:40:55
Currently is this the only place we sue 'config_'
tommi
2016/06/10 15:42:37
That's a good point. For now, I'll add a note in
mflodman
2016/06/12 05:55:19
SGTM
| |
| 133 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 133 RTC_LOGGED_HISTOGRAM_COUNTS_10000( |
| 134 "WebRTC.Video.FecBitrateReceivedInKbps", | 134 "WebRTC.Video.FecBitrateReceivedInKbps", |
| 135 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); | 135 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); |
| 136 } | 136 } |
| 137 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; | 137 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; |
| 138 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", | 138 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", |
| 139 counters.nack_packets * 60 / elapsed_sec); | 139 counters.nack_packets * 60 / elapsed_sec); |
| 140 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", | 140 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", |
| 141 counters.fir_packets * 60 / elapsed_sec); | 141 counters.fir_packets * 60 / elapsed_sec); |
| 142 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", | 142 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 ++num_samples; | 301 ++num_samples; |
| 302 } | 302 } |
| 303 | 303 |
| 304 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 304 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 305 if (num_samples < min_required_samples || num_samples == 0) | 305 if (num_samples < min_required_samples || num_samples == 0) |
| 306 return -1; | 306 return -1; |
| 307 return sum / num_samples; | 307 return sum / num_samples; |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace webrtc | 310 } // namespace webrtc |
| OLD | NEW |