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

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

Issue 1788783002: Add macros for ability to log samples that are added to histograms (RTC_LOGGED_*). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 9 months 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
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 23 matching lines...) Expand all
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) {
44 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", 44 RTC_LHISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent",
45 fraction_lost); 45 fraction_lost);
46 } 46 }
47 const int kMinRequiredSamples = 200; 47 const int kMinRequiredSamples = 200;
48 int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount()); 48 int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount());
49 if (samples > kMinRequiredSamples) { 49 if (samples > kMinRequiredSamples) {
50 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond", 50 RTC_LHISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond",
51 round(render_fps_tracker_.ComputeTotalRate())); 51 round(render_fps_tracker_.ComputeTotalRate()));
52 RTC_HISTOGRAM_COUNTS_100000( 52 RTC_LHISTOGRAM_COUNTS_100000(
53 "WebRTC.Video.RenderSqrtPixelsPerSecond", 53 "WebRTC.Video.RenderSqrtPixelsPerSecond",
54 round(render_pixel_tracker_.ComputeTotalRate())); 54 round(render_pixel_tracker_.ComputeTotalRate()));
55 } 55 }
56 int width = render_width_counter_.Avg(kMinRequiredSamples); 56 int width = render_width_counter_.Avg(kMinRequiredSamples);
57 int height = render_height_counter_.Avg(kMinRequiredSamples); 57 int height = render_height_counter_.Avg(kMinRequiredSamples);
58 if (width != -1) { 58 if (width != -1) {
59 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width); 59 RTC_LHISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width);
60 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height); 60 RTC_LHISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height);
61 } 61 }
62 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); 62 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
63 if (qp != -1) 63 if (qp != -1)
64 RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); 64 RTC_LHISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp);
65 65
66 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and 66 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and
67 // not per frame. Change decode time to include every frame. 67 // not per frame. Change decode time to include every frame.
68 const int kMinRequiredDecodeSamples = 5; 68 const int kMinRequiredDecodeSamples = 5;
69 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); 69 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples);
70 if (decode_ms != -1) 70 if (decode_ms != -1)
71 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); 71 RTC_LHISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms);
72 72
73 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples); 73 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples);
74 if (delay_ms != -1) 74 if (delay_ms != -1)
75 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); 75 RTC_LHISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
76 76
77 StreamDataCounters rtp = stats_.rtp_stats; 77 StreamDataCounters rtp = stats_.rtp_stats;
78 StreamDataCounters rtx; 78 StreamDataCounters rtx;
79 for (auto it : rtx_stats_) 79 for (auto it : rtx_stats_)
80 rtx.Add(it.second); 80 rtx.Add(it.second);
81 StreamDataCounters rtp_rtx = rtp; 81 StreamDataCounters rtp_rtx = rtp;
82 rtp_rtx.Add(rtx); 82 rtp_rtx.Add(rtx);
83 int64_t elapsed_sec = 83 int64_t elapsed_sec =
84 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; 84 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000;
85 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 85 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
86 RTC_HISTOGRAM_COUNTS_10000( 86 RTC_LHISTOGRAM_COUNTS_10000(
87 "WebRTC.Video.BitrateReceivedInKbps", 87 "WebRTC.Video.BitrateReceivedInKbps",
88 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 88 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
89 1000)); 89 1000));
90 RTC_HISTOGRAM_COUNTS_10000( 90 RTC_LHISTOGRAM_COUNTS_10000(
91 "WebRTC.Video.MediaBitrateReceivedInKbps", 91 "WebRTC.Video.MediaBitrateReceivedInKbps",
92 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); 92 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
93 RTC_HISTOGRAM_COUNTS_10000( 93 RTC_LHISTOGRAM_COUNTS_10000(
94 "WebRTC.Video.PaddingBitrateReceivedInKbps", 94 "WebRTC.Video.PaddingBitrateReceivedInKbps",
95 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 95 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
96 1000)); 96 1000));
97 RTC_HISTOGRAM_COUNTS_10000( 97 RTC_LHISTOGRAM_COUNTS_10000(
98 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", 98 "WebRTC.Video.RetransmittedBitrateReceivedInKbps",
99 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / 99 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec /
100 1000)); 100 1000));
101 if (!rtx_stats_.empty()) { 101 if (!rtx_stats_.empty()) {
102 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateReceivedInKbps", 102 RTC_LHISTOGRAM_COUNTS_10000(
103 static_cast<int>(rtx.transmitted.TotalBytes() * 103 "WebRTC.Video.RtxBitrateReceivedInKbps",
104 8 / elapsed_sec / 1000)); 104 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
105 1000));
105 } 106 }
106 if (config_.rtp.fec.ulpfec_payload_type != -1) { 107 if (config_.rtp.fec.ulpfec_payload_type != -1) {
107 RTC_HISTOGRAM_COUNTS_10000( 108 RTC_LHISTOGRAM_COUNTS_10000(
108 "WebRTC.Video.FecBitrateReceivedInKbps", 109 "WebRTC.Video.FecBitrateReceivedInKbps",
109 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); 110 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000));
110 } 111 }
111 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; 112 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts;
112 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", 113 RTC_LHISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute",
113 counters.nack_packets * 60 / elapsed_sec); 114 counters.nack_packets * 60 / elapsed_sec);
114 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", 115 RTC_LHISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute",
115 counters.fir_packets * 60 / elapsed_sec); 116 counters.fir_packets * 60 / elapsed_sec);
116 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", 117 RTC_LHISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute",
117 counters.pli_packets * 60 / elapsed_sec); 118 counters.pli_packets * 60 / elapsed_sec);
118 if (counters.nack_requests > 0) { 119 if (counters.nack_requests > 0) {
119 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", 120 RTC_LHISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent",
120 counters.UniqueNackRequestsInPercent()); 121 counters.UniqueNackRequestsInPercent());
121 } 122 }
122 } 123 }
123 } 124 }
124 125
125 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { 126 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const {
126 rtc::CritScope lock(&crit_); 127 rtc::CritScope lock(&crit_);
127 return stats_; 128 return stats_;
128 } 129 }
129 130
130 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { 131 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 ++num_samples; 271 ++num_samples;
271 } 272 }
272 273
273 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 274 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
274 if (num_samples < min_required_samples || num_samples == 0) 275 if (num_samples < min_required_samples || num_samples == 0)
275 return -1; 276 return -1;
276 return sum / num_samples; 277 return sum / num_samples;
277 } 278 }
278 279
279 } // namespace webrtc 280 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698