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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 encode_time_(kEncodeTimeWeigthFactor), | 83 encode_time_(kEncodeTimeWeigthFactor), |
84 uma_container_( | 84 uma_container_( |
85 new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) { | 85 new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) { |
86 } | 86 } |
87 | 87 |
88 SendStatisticsProxy::~SendStatisticsProxy() { | 88 SendStatisticsProxy::~SendStatisticsProxy() { |
89 rtc::CritScope lock(&crit_); | 89 rtc::CritScope lock(&crit_); |
90 uma_container_->UpdateHistograms(rtp_config_, stats_); | 90 uma_container_->UpdateHistograms(rtp_config_, stats_); |
91 | 91 |
92 int64_t elapsed_sec = (clock_->TimeInMilliseconds() - start_ms_) / 1000; | 92 int64_t elapsed_sec = (clock_->TimeInMilliseconds() - start_ms_) / 1000; |
93 RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendStreamLifetimeInSeconds", | 93 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendStreamLifetimeInSeconds", |
94 elapsed_sec); | 94 elapsed_sec); |
95 | 95 |
96 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) | 96 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) |
97 UpdateCodecTypeHistogram(payload_name_); | 97 UpdateCodecTypeHistogram(payload_name_); |
98 } | 98 } |
99 | 99 |
100 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( | 100 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( |
101 const char* prefix, | 101 const char* prefix, |
102 const VideoSendStream::Stats& stats, | 102 const VideoSendStream::Stats& stats, |
103 Clock* const clock) | 103 Clock* const clock) |
104 : uma_prefix_(prefix), | 104 : uma_prefix_(prefix), |
(...skipping 25 matching lines...) Expand all Loading... |
130 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( | 130 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( |
131 const VideoSendStream::Config::Rtp& rtp_config, | 131 const VideoSendStream::Config::Rtp& rtp_config, |
132 const VideoSendStream::Stats& current_stats) { | 132 const VideoSendStream::Stats& current_stats) { |
133 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); | 133 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); |
134 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; | 134 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; |
135 const int kMinRequiredSamples = 200; | 135 const int kMinRequiredSamples = 200; |
136 int in_width = input_width_counter_.Avg(kMinRequiredSamples); | 136 int in_width = input_width_counter_.Avg(kMinRequiredSamples); |
137 int in_height = input_height_counter_.Avg(kMinRequiredSamples); | 137 int in_height = input_height_counter_.Avg(kMinRequiredSamples); |
138 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); | 138 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); |
139 if (in_width != -1) { | 139 if (in_width != -1) { |
140 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 140 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputWidthInPixels", |
141 kIndex, uma_prefix_ + "InputWidthInPixels", in_width); | 141 in_width); |
142 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 142 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputHeightInPixels", |
143 kIndex, uma_prefix_ + "InputHeightInPixels", in_height); | 143 in_height); |
144 RTC_LOGGED_HISTOGRAMS_COUNTS_100( | 144 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "InputFramesPerSecond", |
145 kIndex, uma_prefix_ + "InputFramesPerSecond", in_fps); | 145 in_fps); |
146 } | 146 } |
147 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); | 147 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); |
148 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); | 148 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); |
149 int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); | 149 int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); |
150 if (sent_width != -1) { | 150 if (sent_width != -1) { |
151 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 151 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentWidthInPixels", |
152 kIndex, uma_prefix_ + "SentWidthInPixels", sent_width); | 152 sent_width); |
153 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 153 RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentHeightInPixels", |
154 kIndex, uma_prefix_ + "SentHeightInPixels", sent_height); | 154 sent_height); |
155 RTC_LOGGED_HISTOGRAMS_COUNTS_100( | 155 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "SentFramesPerSecond", |
156 kIndex, uma_prefix_ + "SentFramesPerSecond", sent_fps); | 156 sent_fps); |
157 } | 157 } |
158 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); | 158 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); |
159 if (encode_ms != -1) { | 159 if (encode_ms != -1) { |
160 RTC_LOGGED_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", | 160 RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", |
161 encode_ms); | 161 encode_ms); |
162 } | 162 } |
163 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); | 163 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); |
164 if (key_frames_permille != -1) { | 164 if (key_frames_permille != -1) { |
165 RTC_LOGGED_HISTOGRAMS_COUNTS_1000( | 165 RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "KeyFramesSentInPermille", |
166 kIndex, uma_prefix_ + "KeyFramesSentInPermille", key_frames_permille); | 166 key_frames_permille); |
167 } | 167 } |
168 int quality_limited = | 168 int quality_limited = |
169 quality_limited_frame_counter_.Percent(kMinRequiredSamples); | 169 quality_limited_frame_counter_.Percent(kMinRequiredSamples); |
170 if (quality_limited != -1) { | 170 if (quality_limited != -1) { |
171 RTC_LOGGED_HISTOGRAMS_PERCENTAGE( | 171 RTC_HISTOGRAMS_PERCENTAGE(kIndex, |
172 kIndex, uma_prefix_ + "QualityLimitedResolutionInPercent", | 172 uma_prefix_ + "QualityLimitedResolutionInPercent", |
173 quality_limited); | 173 quality_limited); |
174 } | 174 } |
175 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); | 175 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); |
176 if (downscales != -1) { | 176 if (downscales != -1) { |
177 RTC_LOGGED_HISTOGRAMS_ENUMERATION( | 177 RTC_HISTOGRAMS_ENUMERATION( |
178 kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, | 178 kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, |
179 20); | 179 20); |
180 } | 180 } |
181 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); | 181 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); |
182 if (bw_limited != -1) { | 182 if (bw_limited != -1) { |
183 RTC_LOGGED_HISTOGRAMS_PERCENTAGE( | 183 RTC_HISTOGRAMS_PERCENTAGE( |
184 kIndex, uma_prefix_ + "BandwidthLimitedResolutionInPercent", | 184 kIndex, uma_prefix_ + "BandwidthLimitedResolutionInPercent", |
185 bw_limited); | 185 bw_limited); |
186 } | 186 } |
187 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); | 187 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); |
188 if (num_disabled != -1) { | 188 if (num_disabled != -1) { |
189 RTC_LOGGED_HISTOGRAMS_ENUMERATION( | 189 RTC_HISTOGRAMS_ENUMERATION( |
190 kIndex, uma_prefix_ + "BandwidthLimitedResolutionsDisabled", | 190 kIndex, uma_prefix_ + "BandwidthLimitedResolutionsDisabled", |
191 num_disabled, 10); | 191 num_disabled, 10); |
192 } | 192 } |
193 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); | 193 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); |
194 if (delay_ms != -1) | 194 if (delay_ms != -1) |
195 RTC_LOGGED_HISTOGRAMS_COUNTS_100000( | 195 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", |
196 kIndex, uma_prefix_ + "SendSideDelayInMs", delay_ms); | 196 delay_ms); |
197 | 197 |
198 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); | 198 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); |
199 if (max_delay_ms != -1) { | 199 if (max_delay_ms != -1) { |
200 RTC_LOGGED_HISTOGRAMS_COUNTS_100000( | 200 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", |
201 kIndex, uma_prefix_ + "SendSideDelayMaxInMs", max_delay_ms); | 201 max_delay_ms); |
202 } | 202 } |
203 | 203 |
204 for (const auto& it : qp_counters_) { | 204 for (const auto& it : qp_counters_) { |
205 int qp_vp8 = it.second.vp8.Avg(kMinRequiredSamples); | 205 int qp_vp8 = it.second.vp8.Avg(kMinRequiredSamples); |
206 if (qp_vp8 != -1) { | 206 if (qp_vp8 != -1) { |
207 int spatial_idx = it.first; | 207 int spatial_idx = it.first; |
208 if (spatial_idx == -1) { | 208 if (spatial_idx == -1) { |
209 RTC_LOGGED_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8", | 209 RTC_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8", |
210 qp_vp8); | 210 qp_vp8); |
211 } else if (spatial_idx == 0) { | 211 } else if (spatial_idx == 0) { |
212 RTC_LOGGED_HISTOGRAMS_COUNTS_200( | 212 RTC_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8.S0", |
213 kIndex, uma_prefix_ + "Encoded.Qp.Vp8.S0", qp_vp8); | 213 qp_vp8); |
214 } else if (spatial_idx == 1) { | 214 } else if (spatial_idx == 1) { |
215 RTC_LOGGED_HISTOGRAMS_COUNTS_200( | 215 RTC_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8.S1", |
216 kIndex, uma_prefix_ + "Encoded.Qp.Vp8.S1", qp_vp8); | 216 qp_vp8); |
217 } else if (spatial_idx == 2) { | 217 } else if (spatial_idx == 2) { |
218 RTC_LOGGED_HISTOGRAMS_COUNTS_200( | 218 RTC_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8.S2", |
219 kIndex, uma_prefix_ + "Encoded.Qp.Vp8.S2", qp_vp8); | 219 qp_vp8); |
220 } else { | 220 } else { |
221 LOG(LS_WARNING) << "QP stats not recorded for VP8 spatial idx " | 221 LOG(LS_WARNING) << "QP stats not recorded for VP8 spatial idx " |
222 << spatial_idx; | 222 << spatial_idx; |
223 } | 223 } |
224 } | 224 } |
225 int qp_vp9 = it.second.vp9.Avg(kMinRequiredSamples); | 225 int qp_vp9 = it.second.vp9.Avg(kMinRequiredSamples); |
226 if (qp_vp9 != -1) { | 226 if (qp_vp9 != -1) { |
227 int spatial_idx = it.first; | 227 int spatial_idx = it.first; |
228 if (spatial_idx == -1) { | 228 if (spatial_idx == -1) { |
229 RTC_LOGGED_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9", | 229 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9", |
230 qp_vp9); | 230 qp_vp9); |
231 } else if (spatial_idx == 0) { | 231 } else if (spatial_idx == 0) { |
232 RTC_LOGGED_HISTOGRAMS_COUNTS_500( | 232 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S0", |
233 kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S0", qp_vp9); | 233 qp_vp9); |
234 } else if (spatial_idx == 1) { | 234 } else if (spatial_idx == 1) { |
235 RTC_LOGGED_HISTOGRAMS_COUNTS_500( | 235 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S1", |
236 kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S1", qp_vp9); | 236 qp_vp9); |
237 } else if (spatial_idx == 2) { | 237 } else if (spatial_idx == 2) { |
238 RTC_LOGGED_HISTOGRAMS_COUNTS_500( | 238 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S2", |
239 kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S2", qp_vp9); | 239 qp_vp9); |
240 } else { | 240 } else { |
241 LOG(LS_WARNING) << "QP stats not recorded for VP9 spatial layer " | 241 LOG(LS_WARNING) << "QP stats not recorded for VP9 spatial layer " |
242 << spatial_idx; | 242 << spatial_idx; |
243 } | 243 } |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 if (first_rtcp_stats_time_ms_ != -1) { | 247 if (first_rtcp_stats_time_ms_ != -1) { |
248 int64_t elapsed_sec = | 248 int64_t elapsed_sec = |
249 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; | 249 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; |
250 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 250 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
251 int fraction_lost = report_block_stats_.FractionLostInPercent(); | 251 int fraction_lost = report_block_stats_.FractionLostInPercent(); |
252 if (fraction_lost != -1) { | 252 if (fraction_lost != -1) { |
253 RTC_LOGGED_HISTOGRAMS_PERCENTAGE( | 253 RTC_HISTOGRAMS_PERCENTAGE( |
254 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); | 254 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); |
255 } | 255 } |
256 | 256 |
257 // The RTCP packet type counters, delivered via the | 257 // The RTCP packet type counters, delivered via the |
258 // RtcpPacketTypeCounterObserver interface, are aggregates over the entire | 258 // RtcpPacketTypeCounterObserver interface, are aggregates over the entire |
259 // life of the send stream and are not reset when switching content type. | 259 // life of the send stream and are not reset when switching content type. |
260 // For the purpose of these statistics though, we want new counts when | 260 // For the purpose of these statistics though, we want new counts when |
261 // switching since we switch histogram name. On every reset of the | 261 // switching since we switch histogram name. On every reset of the |
262 // UmaSamplesContainer, we save the initial state of the counters, so that | 262 // UmaSamplesContainer, we save the initial state of the counters, so that |
263 // we can calculate the delta here and aggregate over all ssrcs. | 263 // we can calculate the delta here and aggregate over all ssrcs. |
264 RtcpPacketTypeCounter counters; | 264 RtcpPacketTypeCounter counters; |
265 for (uint32_t ssrc : rtp_config.ssrcs) { | 265 for (uint32_t ssrc : rtp_config.ssrcs) { |
266 auto kv = current_stats.substreams.find(ssrc); | 266 auto kv = current_stats.substreams.find(ssrc); |
267 if (kv == current_stats.substreams.end()) | 267 if (kv == current_stats.substreams.end()) |
268 continue; | 268 continue; |
269 | 269 |
270 RtcpPacketTypeCounter stream_counters = | 270 RtcpPacketTypeCounter stream_counters = |
271 kv->second.rtcp_packet_type_counts; | 271 kv->second.rtcp_packet_type_counts; |
272 kv = start_stats_.substreams.find(ssrc); | 272 kv = start_stats_.substreams.find(ssrc); |
273 if (kv != start_stats_.substreams.end()) | 273 if (kv != start_stats_.substreams.end()) |
274 stream_counters.Subtract(kv->second.rtcp_packet_type_counts); | 274 stream_counters.Subtract(kv->second.rtcp_packet_type_counts); |
275 | 275 |
276 counters.Add(stream_counters); | 276 counters.Add(stream_counters); |
277 } | 277 } |
278 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 278 RTC_HISTOGRAMS_COUNTS_10000(kIndex, |
279 kIndex, uma_prefix_ + "NackPacketsReceivedPerMinute", | 279 uma_prefix_ + "NackPacketsReceivedPerMinute", |
280 counters.nack_packets * 60 / elapsed_sec); | 280 counters.nack_packets * 60 / elapsed_sec); |
281 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 281 RTC_HISTOGRAMS_COUNTS_10000(kIndex, |
282 kIndex, uma_prefix_ + "FirPacketsReceivedPerMinute", | 282 uma_prefix_ + "FirPacketsReceivedPerMinute", |
283 counters.fir_packets * 60 / elapsed_sec); | 283 counters.fir_packets * 60 / elapsed_sec); |
284 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 284 RTC_HISTOGRAMS_COUNTS_10000(kIndex, |
285 kIndex, uma_prefix_ + "PliPacketsReceivedPerMinute", | 285 uma_prefix_ + "PliPacketsReceivedPerMinute", |
286 counters.pli_packets * 60 / elapsed_sec); | 286 counters.pli_packets * 60 / elapsed_sec); |
287 if (counters.nack_requests > 0) { | 287 if (counters.nack_requests > 0) { |
288 RTC_LOGGED_HISTOGRAMS_PERCENTAGE( | 288 RTC_HISTOGRAMS_PERCENTAGE( |
289 kIndex, uma_prefix_ + "UniqueNackRequestsReceivedInPercent", | 289 kIndex, uma_prefix_ + "UniqueNackRequestsReceivedInPercent", |
290 counters.UniqueNackRequestsInPercent()); | 290 counters.UniqueNackRequestsInPercent()); |
291 } | 291 } |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 if (first_rtp_stats_time_ms_ != -1) { | 295 if (first_rtp_stats_time_ms_ != -1) { |
296 int64_t elapsed_sec = | 296 int64_t elapsed_sec = |
297 (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000; | 297 (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000; |
298 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 298 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
299 StreamDataCounters rtp; | 299 StreamDataCounters rtp; |
300 StreamDataCounters rtx; | 300 StreamDataCounters rtx; |
301 AccumulateRtxStats(current_stats, rtp_config.rtx.ssrcs, &rtp, &rtx); | 301 AccumulateRtxStats(current_stats, rtp_config.rtx.ssrcs, &rtp, &rtx); |
302 StreamDataCounters start_rtp; | 302 StreamDataCounters start_rtp; |
303 StreamDataCounters start_rtx; | 303 StreamDataCounters start_rtx; |
304 AccumulateRtxStats(start_stats_, rtp_config.rtx.ssrcs, &start_rtp, | 304 AccumulateRtxStats(start_stats_, rtp_config.rtx.ssrcs, &start_rtp, |
305 &start_rtx); | 305 &start_rtx); |
306 rtp.Subtract(start_rtp); | 306 rtp.Subtract(start_rtp); |
307 rtx.Subtract(start_rtx); | 307 rtx.Subtract(start_rtx); |
308 StreamDataCounters rtp_rtx = rtp; | 308 StreamDataCounters rtp_rtx = rtp; |
309 rtp_rtx.Add(rtx); | 309 rtp_rtx.Add(rtx); |
310 | 310 |
311 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 311 RTC_HISTOGRAMS_COUNTS_10000( |
312 kIndex, uma_prefix_ + "BitrateSentInKbps", | 312 kIndex, uma_prefix_ + "BitrateSentInKbps", |
313 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 313 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
314 1000)); | 314 1000)); |
315 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 315 RTC_HISTOGRAMS_COUNTS_10000( |
316 kIndex, uma_prefix_ + "MediaBitrateSentInKbps", | 316 kIndex, uma_prefix_ + "MediaBitrateSentInKbps", |
317 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 317 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
318 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 318 RTC_HISTOGRAMS_COUNTS_10000( |
319 kIndex, uma_prefix_ + "PaddingBitrateSentInKbps", | 319 kIndex, uma_prefix_ + "PaddingBitrateSentInKbps", |
320 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / | 320 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / |
321 1000)); | 321 1000)); |
322 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 322 RTC_HISTOGRAMS_COUNTS_10000( |
323 kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps", | 323 kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps", |
324 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / | 324 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / |
325 elapsed_sec / 1000)); | 325 elapsed_sec / 1000)); |
326 if (!rtp_config.rtx.ssrcs.empty()) { | 326 if (!rtp_config.rtx.ssrcs.empty()) { |
327 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 327 RTC_HISTOGRAMS_COUNTS_10000( |
328 kIndex, uma_prefix_ + "RtxBitrateSentInKbps", | 328 kIndex, uma_prefix_ + "RtxBitrateSentInKbps", |
329 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 329 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
330 1000)); | 330 1000)); |
331 } | 331 } |
332 if (rtp_config.fec.red_payload_type != -1) { | 332 if (rtp_config.fec.red_payload_type != -1) { |
333 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 333 RTC_HISTOGRAMS_COUNTS_10000(kIndex, |
334 kIndex, uma_prefix_ + "FecBitrateSentInKbps", | 334 uma_prefix_ + "FecBitrateSentInKbps", |
335 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / | 335 static_cast<int>(rtp_rtx.fec.TotalBytes() * |
336 1000)); | 336 8 / elapsed_sec / 1000)); |
337 } | 337 } |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 void SendStatisticsProxy::SetContentType( | 342 void SendStatisticsProxy::SetContentType( |
343 VideoEncoderConfig::ContentType content_type) { | 343 VideoEncoderConfig::ContentType content_type) { |
344 rtc::CritScope lock(&crit_); | 344 rtc::CritScope lock(&crit_); |
345 if (content_type_ != content_type) { | 345 if (content_type_ != content_type) { |
346 uma_container_->UpdateHistograms(rtp_config_, stats_); | 346 uma_container_->UpdateHistograms(rtp_config_, stats_); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 return Fraction(min_required_samples, 1000.0f); | 641 return Fraction(min_required_samples, 1000.0f); |
642 } | 642 } |
643 | 643 |
644 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 644 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
645 int min_required_samples, float multiplier) const { | 645 int min_required_samples, float multiplier) const { |
646 if (num_samples < min_required_samples || num_samples == 0) | 646 if (num_samples < min_required_samples || num_samples == 0) |
647 return -1; | 647 return -1; |
648 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 648 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
649 } | 649 } |
650 } // namespace webrtc | 650 } // namespace webrtc |
OLD | NEW |