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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 stats_.ssrc = config_.rtp.remote_ssrc; | 33 stats_.ssrc = config_.rtp.remote_ssrc; |
34 for (auto it : config_.rtp.rtx) | 34 for (auto it : config_.rtp.rtx) |
35 rtx_stats_[it.second.ssrc] = StreamDataCounters(); | 35 rtx_stats_[it.second.ssrc] = StreamDataCounters(); |
36 } | 36 } |
37 | 37 |
38 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { | 38 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { |
39 UpdateHistograms(); | 39 UpdateHistograms(); |
40 } | 40 } |
41 | 41 |
42 void ReceiveStatisticsProxy::UpdateHistograms() { | 42 void ReceiveStatisticsProxy::UpdateHistograms() { |
43 RTC_LOGGED_HISTOGRAM_COUNTS_100000( | 43 RTC_HISTOGRAM_COUNTS_100000( |
44 "WebRTC.Video.ReceiveStreamLifetimeInSeconds", | 44 "WebRTC.Video.ReceiveStreamLifetimeInSeconds", |
45 (clock_->TimeInMilliseconds() - start_ms_) / 1000); | 45 (clock_->TimeInMilliseconds() - start_ms_) / 1000); |
46 | 46 |
47 int fraction_lost = report_block_stats_.FractionLostInPercent(); | 47 int fraction_lost = report_block_stats_.FractionLostInPercent(); |
48 if (fraction_lost != -1) { | 48 if (fraction_lost != -1) { |
49 RTC_LOGGED_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", | 49 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", |
50 fraction_lost); | 50 fraction_lost); |
51 } | 51 } |
52 const int kMinRequiredSamples = 200; | 52 const int kMinRequiredSamples = 200; |
53 int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount()); | 53 int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount()); |
54 if (samples > kMinRequiredSamples) { | 54 if (samples > kMinRequiredSamples) { |
55 RTC_LOGGED_HISTOGRAM_COUNTS_100( | 55 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond", |
56 "WebRTC.Video.RenderFramesPerSecond", | 56 round(render_fps_tracker_.ComputeTotalRate())); |
57 round(render_fps_tracker_.ComputeTotalRate())); | 57 RTC_HISTOGRAM_COUNTS_100000( |
58 RTC_LOGGED_HISTOGRAM_COUNTS_100000( | |
59 "WebRTC.Video.RenderSqrtPixelsPerSecond", | 58 "WebRTC.Video.RenderSqrtPixelsPerSecond", |
60 round(render_pixel_tracker_.ComputeTotalRate())); | 59 round(render_pixel_tracker_.ComputeTotalRate())); |
61 } | 60 } |
62 int width = render_width_counter_.Avg(kMinRequiredSamples); | 61 int width = render_width_counter_.Avg(kMinRequiredSamples); |
63 int height = render_height_counter_.Avg(kMinRequiredSamples); | 62 int height = render_height_counter_.Avg(kMinRequiredSamples); |
64 if (width != -1) { | 63 if (width != -1) { |
65 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", | 64 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width); |
66 width); | 65 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height); |
67 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", | |
68 height); | |
69 } | 66 } |
70 int sync_offset_ms = sync_offset_counter_.Avg(kMinRequiredSamples); | 67 int sync_offset_ms = sync_offset_counter_.Avg(kMinRequiredSamples); |
71 if (sync_offset_ms != -1) { | 68 if (sync_offset_ms != -1) { |
72 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs", | 69 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs", sync_offset_ms); |
73 sync_offset_ms); | |
74 } | 70 } |
75 | 71 |
76 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); | 72 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); |
77 if (qp != -1) | 73 if (qp != -1) |
78 RTC_LOGGED_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); | 74 RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); |
79 | 75 |
80 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and | 76 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and |
81 // not per frame. Change decode time to include every frame. | 77 // not per frame. Change decode time to include every frame. |
82 const int kMinRequiredDecodeSamples = 5; | 78 const int kMinRequiredDecodeSamples = 5; |
83 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); | 79 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); |
84 if (decode_ms != -1) | 80 if (decode_ms != -1) |
85 RTC_LOGGED_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); | 81 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); |
86 | 82 |
87 int jb_delay_ms = jitter_buffer_delay_counter_.Avg(kMinRequiredDecodeSamples); | 83 int jb_delay_ms = jitter_buffer_delay_counter_.Avg(kMinRequiredDecodeSamples); |
88 if (jb_delay_ms != -1) { | 84 if (jb_delay_ms != -1) { |
89 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs", | 85 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs", |
90 jb_delay_ms); | 86 jb_delay_ms); |
91 } | 87 } |
92 int target_delay_ms = target_delay_counter_.Avg(kMinRequiredDecodeSamples); | 88 int target_delay_ms = target_delay_counter_.Avg(kMinRequiredDecodeSamples); |
93 if (target_delay_ms != -1) { | 89 if (target_delay_ms != -1) { |
94 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs", | 90 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs", target_delay_ms); |
95 target_delay_ms); | |
96 } | 91 } |
97 int current_delay_ms = current_delay_counter_.Avg(kMinRequiredDecodeSamples); | 92 int current_delay_ms = current_delay_counter_.Avg(kMinRequiredDecodeSamples); |
98 if (current_delay_ms != -1) { | 93 if (current_delay_ms != -1) { |
99 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs", | 94 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs", |
100 current_delay_ms); | 95 current_delay_ms); |
101 } | 96 } |
102 | 97 |
103 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples); | 98 int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples); |
104 if (delay_ms != -1) | 99 if (delay_ms != -1) |
105 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); | 100 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms); |
106 | 101 |
107 StreamDataCounters rtp = stats_.rtp_stats; | 102 StreamDataCounters rtp = stats_.rtp_stats; |
108 StreamDataCounters rtx; | 103 StreamDataCounters rtx; |
109 for (auto it : rtx_stats_) | 104 for (auto it : rtx_stats_) |
110 rtx.Add(it.second); | 105 rtx.Add(it.second); |
111 StreamDataCounters rtp_rtx = rtp; | 106 StreamDataCounters rtp_rtx = rtp; |
112 rtp_rtx.Add(rtx); | 107 rtp_rtx.Add(rtx); |
113 int64_t elapsed_sec = | 108 int64_t elapsed_sec = |
114 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; | 109 rtp_rtx.TimeSinceFirstPacketInMs(clock_->TimeInMilliseconds()) / 1000; |
115 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 110 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
116 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 111 RTC_HISTOGRAM_COUNTS_10000( |
117 "WebRTC.Video.BitrateReceivedInKbps", | 112 "WebRTC.Video.BitrateReceivedInKbps", |
118 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 113 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
119 1000)); | 114 1000)); |
120 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 115 RTC_HISTOGRAM_COUNTS_10000( |
121 "WebRTC.Video.MediaBitrateReceivedInKbps", | 116 "WebRTC.Video.MediaBitrateReceivedInKbps", |
122 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 117 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
123 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 118 RTC_HISTOGRAM_COUNTS_10000( |
124 "WebRTC.Video.PaddingBitrateReceivedInKbps", | 119 "WebRTC.Video.PaddingBitrateReceivedInKbps", |
125 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / | 120 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / |
126 1000)); | 121 1000)); |
127 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 122 RTC_HISTOGRAM_COUNTS_10000( |
128 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", | 123 "WebRTC.Video.RetransmittedBitrateReceivedInKbps", |
129 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / | 124 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / |
130 1000)); | 125 1000)); |
131 if (!rtx_stats_.empty()) { | 126 if (!rtx_stats_.empty()) { |
132 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 127 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateReceivedInKbps", |
133 "WebRTC.Video.RtxBitrateReceivedInKbps", | 128 static_cast<int>(rtx.transmitted.TotalBytes() * |
134 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 129 8 / elapsed_sec / 1000)); |
135 1000)); | |
136 } | 130 } |
137 if (config_.rtp.fec.ulpfec_payload_type != -1) { | 131 if (config_.rtp.fec.ulpfec_payload_type != -1) { |
138 RTC_LOGGED_HISTOGRAM_COUNTS_10000( | 132 RTC_HISTOGRAM_COUNTS_10000( |
139 "WebRTC.Video.FecBitrateReceivedInKbps", | 133 "WebRTC.Video.FecBitrateReceivedInKbps", |
140 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); | 134 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); |
141 } | 135 } |
142 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; | 136 const RtcpPacketTypeCounter& counters = stats_.rtcp_packet_type_counts; |
143 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", | 137 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", |
144 counters.nack_packets * 60 / elapsed_sec); | 138 counters.nack_packets * 60 / elapsed_sec); |
145 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", | 139 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", |
146 counters.fir_packets * 60 / elapsed_sec); | 140 counters.fir_packets * 60 / elapsed_sec); |
147 RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", | 141 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", |
148 counters.pli_packets * 60 / elapsed_sec); | 142 counters.pli_packets * 60 / elapsed_sec); |
149 if (counters.nack_requests > 0) { | 143 if (counters.nack_requests > 0) { |
150 RTC_LOGGED_HISTOGRAM_PERCENTAGE( | 144 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", |
151 "WebRTC.Video.UniqueNackRequestsSentInPercent", | 145 counters.UniqueNackRequestsInPercent()); |
152 counters.UniqueNackRequestsInPercent()); | |
153 } | 146 } |
154 } | 147 } |
155 } | 148 } |
156 | 149 |
157 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { | 150 VideoReceiveStream::Stats ReceiveStatisticsProxy::GetStats() const { |
158 rtc::CritScope lock(&crit_); | 151 rtc::CritScope lock(&crit_); |
159 return stats_; | 152 return stats_; |
160 } | 153 } |
161 | 154 |
162 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { | 155 void ReceiveStatisticsProxy::OnIncomingPayloadType(int payload_type) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 ++num_samples; | 301 ++num_samples; |
309 } | 302 } |
310 | 303 |
311 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 304 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
312 if (num_samples < min_required_samples || num_samples == 0) | 305 if (num_samples < min_required_samples || num_samples == 0) |
313 return -1; | 306 return -1; |
314 return sum / num_samples; | 307 return sum / num_samples; |
315 } | 308 } |
316 | 309 |
317 } // namespace webrtc | 310 } // namespace webrtc |
OLD | NEW |