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

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

Issue 2437323002: Add qp counter for H264 in SendStatisticsProxy. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S1", 243 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S1",
244 qp_vp9); 244 qp_vp9);
245 } else if (spatial_idx == 2) { 245 } else if (spatial_idx == 2) {
246 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S2", 246 RTC_HISTOGRAMS_COUNTS_500(kIndex, uma_prefix_ + "Encoded.Qp.Vp9.S2",
247 qp_vp9); 247 qp_vp9);
248 } else { 248 } else {
249 LOG(LS_WARNING) << "QP stats not recorded for VP9 spatial layer " 249 LOG(LS_WARNING) << "QP stats not recorded for VP9 spatial layer "
250 << spatial_idx; 250 << spatial_idx;
251 } 251 }
252 } 252 }
253 int qp_h264 = it.second.h264.Avg(kMinRequiredMetricsSamples);
254 if (qp_h264 != -1) {
255 int spatial_idx = it.first;
256 RTC_DCHECK_EQ(-1, spatial_idx);
257 RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "Encoded.Qp.H264",
258 qp_h264);
259 }
253 } 260 }
254 261
255 if (first_rtcp_stats_time_ms_ != -1) { 262 if (first_rtcp_stats_time_ms_ != -1) {
256 int64_t elapsed_sec = 263 int64_t elapsed_sec =
257 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000; 264 (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000;
258 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { 265 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) {
259 int fraction_lost = report_block_stats_.FractionLostInPercent(); 266 int fraction_lost = report_block_stats_.FractionLostInPercent();
260 if (fraction_lost != -1) { 267 if (fraction_lost != -1) {
261 RTC_HISTOGRAMS_PERCENTAGE( 268 RTC_HISTOGRAMS_PERCENTAGE(
262 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost); 269 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 int spatial_idx = (rtp_config_.ssrcs.size() == 1) 520 int spatial_idx = (rtp_config_.ssrcs.size() == 1)
514 ? -1 521 ? -1
515 : static_cast<int>(simulcast_idx); 522 : static_cast<int>(simulcast_idx);
516 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); 523 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_);
517 } else if (codec_info->codecType == kVideoCodecVP9) { 524 } else if (codec_info->codecType == kVideoCodecVP9) {
518 int spatial_idx = 525 int spatial_idx =
519 (codec_info->codecSpecific.VP9.num_spatial_layers == 1) 526 (codec_info->codecSpecific.VP9.num_spatial_layers == 1)
520 ? -1 527 ? -1
521 : codec_info->codecSpecific.VP9.spatial_idx; 528 : codec_info->codecSpecific.VP9.spatial_idx;
522 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_); 529 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_);
530 } else if (codec_info->codecType == kVideoCodecH264) {
531 int spatial_idx = -1;
532 uma_container_->qp_counters_[spatial_idx].h264.Add(encoded_image.qp_);
523 } 533 }
524 } 534 }
525 } 535 }
526 536
527 // TODO(asapersson): This is incorrect if simulcast layers are encoded on 537 // TODO(asapersson): This is incorrect if simulcast layers are encoded on
528 // different threads and there is no guarantee that one frame of all layers 538 // different threads and there is no guarantee that one frame of all layers
529 // are encoded before the next start. 539 // are encoded before the next start.
530 if (last_sent_frame_timestamp_ > 0 && 540 if (last_sent_frame_timestamp_ > 0 &&
531 encoded_image._timeStamp != last_sent_frame_timestamp_) { 541 encoded_image._timeStamp != last_sent_frame_timestamp_) {
532 uma_container_->sent_frame_rate_tracker_.AddSamples(1); 542 uma_container_->sent_frame_rate_tracker_.AddSamples(1);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 return Fraction(min_required_samples, 1000.0f); 684 return Fraction(min_required_samples, 1000.0f);
675 } 685 }
676 686
677 int SendStatisticsProxy::BoolSampleCounter::Fraction( 687 int SendStatisticsProxy::BoolSampleCounter::Fraction(
678 int min_required_samples, float multiplier) const { 688 int min_required_samples, float multiplier) const {
679 if (num_samples < min_required_samples || num_samples == 0) 689 if (num_samples < min_required_samples || num_samples == 0)
680 return -1; 690 return -1;
681 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 691 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
682 } 692 }
683 } // namespace webrtc 693 } // 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