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

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

Issue 1523293002: Add histogram stats for average QP per frame for VP8 (for sent video streams): (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (delay_ms != -1) 186 if (delay_ms != -1)
187 RTC_LOGGED_HISTOGRAMS_COUNTS_100000( 187 RTC_LOGGED_HISTOGRAMS_COUNTS_100000(
188 kIndex, uma_prefix_ + "SendSideDelayInMs", delay_ms); 188 kIndex, uma_prefix_ + "SendSideDelayInMs", delay_ms);
189 189
190 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); 190 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
191 if (max_delay_ms != -1) { 191 if (max_delay_ms != -1) {
192 RTC_LOGGED_HISTOGRAMS_COUNTS_100000( 192 RTC_LOGGED_HISTOGRAMS_COUNTS_100000(
193 kIndex, uma_prefix_ + "SendSideDelayMaxInMs", max_delay_ms); 193 kIndex, uma_prefix_ + "SendSideDelayMaxInMs", max_delay_ms);
194 } 194 }
195 195
196 for (const auto& it : qp_counters_) {
197 int qp = it.second.vp8.Avg(kMinRequiredSamples);
198 if (qp != -1) {
199 int spatial_idx = it.first;
200 if (spatial_idx == -1) {
201 RTC_LOGGED_HISTOGRAMS_COUNTS_200(kIndex, uma_prefix_ + "Encoded.Qp.Vp8",
202 qp);
203 } else if (spatial_idx == 0) {
204 RTC_LOGGED_HISTOGRAMS_COUNTS_200(kIndex,
205 uma_prefix_ + "Encoded.Qp.Vp8.S0", qp);
206 } else if (spatial_idx == 1) {
207 RTC_LOGGED_HISTOGRAMS_COUNTS_200(kIndex,
208 uma_prefix_ + "Encoded.Qp.Vp8.S1", qp);
209 } else if (spatial_idx == 2) {
210 RTC_LOGGED_HISTOGRAMS_COUNTS_200(kIndex,
211 uma_prefix_ + "Encoded.Qp.Vp8.S2", qp);
212 } else {
213 LOG(LS_WARNING) << "QP stats not recorded for VP8 spatial idx "
214 << spatial_idx;
215 }
216 }
217 }
218
196 if (first_rtcp_stats_time_ms_ != -1) { 219 if (first_rtcp_stats_time_ms_ != -1) {
197 int64_t elapsed_sec = 220 int64_t elapsed_sec =
198 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; 221 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000;
199 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { 222 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) {
200 int fraction_lost = report_block_stats_.FractionLostInPercent(); 223 int fraction_lost = report_block_stats_.FractionLostInPercent();
201 if (fraction_lost != -1) { 224 if (fraction_lost != -1) {
202 RTC_LOGGED_HISTOGRAMS_PERCENTAGE( 225 RTC_LOGGED_HISTOGRAMS_PERCENTAGE(
203 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); 226 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
204 } 227 }
205 228
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 443 }
421 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { 444 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) {
422 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; 445 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0;
423 uma_container_->bw_limited_frame_counter_.Add(bw_limited); 446 uma_container_->bw_limited_frame_counter_.Add(bw_limited);
424 if (bw_limited) { 447 if (bw_limited) {
425 uma_container_->bw_resolutions_disabled_counter_.Add( 448 uma_container_->bw_resolutions_disabled_counter_.Add(
426 encoded_image.adapt_reason_.bw_resolutions_disabled); 449 encoded_image.adapt_reason_.bw_resolutions_disabled);
427 } 450 }
428 } 451 }
429 452
453 if (encoded_image.qp_ != -1 && rtp_video_header != nullptr &&
454 rtp_video_header->codec == kRtpVideoVp8) {
455 int spatial_idx =
456 (config_.rtp.ssrcs.size() == 1) ? -1 : static_cast<int>(simulcast_idx);
457 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_);
458 }
459
430 // TODO(asapersson): This is incorrect if simulcast layers are encoded on 460 // TODO(asapersson): This is incorrect if simulcast layers are encoded on
431 // different threads and there is no guarantee that one frame of all layers 461 // different threads and there is no guarantee that one frame of all layers
432 // are encoded before the next start. 462 // are encoded before the next start.
433 if (last_sent_frame_timestamp_ > 0 && 463 if (last_sent_frame_timestamp_ > 0 &&
434 encoded_image._timeStamp != last_sent_frame_timestamp_) { 464 encoded_image._timeStamp != last_sent_frame_timestamp_) {
435 uma_container_->sent_frame_rate_tracker_.AddSamples(1); 465 uma_container_->sent_frame_rate_tracker_.AddSamples(1);
436 uma_container_->sent_width_counter_.Add( 466 uma_container_->sent_width_counter_.Add(
437 uma_container_->max_sent_width_per_timestamp_); 467 uma_container_->max_sent_width_per_timestamp_);
438 uma_container_->sent_height_counter_.Add( 468 uma_container_->sent_height_counter_.Add(
439 uma_container_->max_sent_height_per_timestamp_); 469 uma_container_->max_sent_height_per_timestamp_);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return Fraction(min_required_samples, 1000.0f); 588 return Fraction(min_required_samples, 1000.0f);
559 } 589 }
560 590
561 int SendStatisticsProxy::BoolSampleCounter::Fraction( 591 int SendStatisticsProxy::BoolSampleCounter::Fraction(
562 int min_required_samples, float multiplier) const { 592 int min_required_samples, float multiplier) const {
563 if (num_samples < min_required_samples || num_samples == 0) 593 if (num_samples < min_required_samples || num_samples == 0)
564 return -1; 594 return -1;
565 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 595 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
566 } 596 }
567 } // namespace webrtc 597 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698