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/send_statistics_proxy.h" | 11 #include "webrtc/video/send_statistics_proxy.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <cmath> | 14 #include <cmath> |
15 #include <map> | 15 #include <map> |
16 #include <vector> | |
16 | 17 |
17 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
18 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
19 #include "webrtc/system_wrappers/include/metrics.h" | 20 #include "webrtc/system_wrappers/include/metrics.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 namespace { | 23 namespace { |
23 const float kEncodeTimeWeigthFactor = 0.5f; | 24 const float kEncodeTimeWeigthFactor = 0.5f; |
24 | 25 |
25 // Used by histograms. Values of entries should not be changed. | 26 // Used by histograms. Values of entries should not be changed. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); | 185 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); |
185 if (delay_ms != -1) | 186 if (delay_ms != -1) |
186 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", | 187 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", |
187 delay_ms); | 188 delay_ms); |
188 | 189 |
189 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); | 190 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); |
190 if (max_delay_ms != -1) { | 191 if (max_delay_ms != -1) { |
191 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", | 192 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", |
192 max_delay_ms); | 193 max_delay_ms); |
193 } | 194 } |
195 for (const auto& it : qp_counters_) { | |
196 int qp = it.second.vp8.Avg(kMinRequiredSamples); | |
197 if (qp != -1) | |
198 RTC_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8", qp); | |
pbos-webrtc
2016/03/22 15:35:12
Should these be reported separately per simulcast
åsapersson
2016/03/23 10:57:33
Have updated to use a separate histogram per spati
| |
199 } | |
194 | 200 |
195 if (first_rtcp_stats_time_ms_ != -1) { | 201 if (first_rtcp_stats_time_ms_ != -1) { |
196 int64_t elapsed_sec = | 202 int64_t elapsed_sec = |
197 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; | 203 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; |
198 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 204 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
199 int fraction_lost = report_block_stats_.FractionLostInPercent(); | 205 int fraction_lost = report_block_stats_.FractionLostInPercent(); |
200 if (fraction_lost != -1) { | 206 if (fraction_lost != -1) { |
201 RTC_HISTOGRAMS_PERCENTAGE( | 207 RTC_HISTOGRAMS_PERCENTAGE( |
202 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); | 208 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); |
203 } | 209 } |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 } | 425 } |
420 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { | 426 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { |
421 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | 427 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
422 uma_container_->bw_limited_frame_counter_.Add(bw_limited); | 428 uma_container_->bw_limited_frame_counter_.Add(bw_limited); |
423 if (bw_limited) { | 429 if (bw_limited) { |
424 uma_container_->bw_resolutions_disabled_counter_.Add( | 430 uma_container_->bw_resolutions_disabled_counter_.Add( |
425 encoded_image.adapt_reason_.bw_resolutions_disabled); | 431 encoded_image.adapt_reason_.bw_resolutions_disabled); |
426 } | 432 } |
427 } | 433 } |
428 | 434 |
435 if (encoded_image.qp_ != -1 && rtp_video_header != nullptr) { | |
436 if (rtp_video_header->codec == kRtpVideoVp8) { | |
437 uma_container_->qp_counters_[ssrc].vp8.Add(encoded_image.qp_); | |
438 } | |
439 } | |
440 | |
429 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 441 // TODO(asapersson): This is incorrect if simulcast layers are encoded on |
430 // different threads and there is no guarantee that one frame of all layers | 442 // different threads and there is no guarantee that one frame of all layers |
431 // are encoded before the next start. | 443 // are encoded before the next start. |
432 if (last_sent_frame_timestamp_ > 0 && | 444 if (last_sent_frame_timestamp_ > 0 && |
433 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 445 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
434 uma_container_->sent_frame_rate_tracker_.AddSamples(1); | 446 uma_container_->sent_frame_rate_tracker_.AddSamples(1); |
435 uma_container_->sent_width_counter_.Add( | 447 uma_container_->sent_width_counter_.Add( |
436 uma_container_->max_sent_width_per_timestamp_); | 448 uma_container_->max_sent_width_per_timestamp_); |
437 uma_container_->sent_height_counter_.Add( | 449 uma_container_->sent_height_counter_.Add( |
438 uma_container_->max_sent_height_per_timestamp_); | 450 uma_container_->max_sent_height_per_timestamp_); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 return Fraction(min_required_samples, 1000.0f); | 569 return Fraction(min_required_samples, 1000.0f); |
558 } | 570 } |
559 | 571 |
560 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 572 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
561 int min_required_samples, float multiplier) const { | 573 int min_required_samples, float multiplier) const { |
562 if (num_samples < min_required_samples || num_samples == 0) | 574 if (num_samples < min_required_samples || num_samples == 0) |
563 return -1; | 575 return -1; |
564 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 576 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
565 } | 577 } |
566 } // namespace webrtc | 578 } // namespace webrtc |
OLD | NEW |