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

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

Issue 2430603003: Implement qpSum stat for video send ssrc stats. (Closed)
Patch Set: Statscollector send ssrc unittest for qp_sum Created 4 years, 2 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
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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { 489 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) {
490 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; 490 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0;
491 uma_container_->bw_limited_frame_counter_.Add(bw_limited); 491 uma_container_->bw_limited_frame_counter_.Add(bw_limited);
492 if (bw_limited) { 492 if (bw_limited) {
493 uma_container_->bw_resolutions_disabled_counter_.Add( 493 uma_container_->bw_resolutions_disabled_counter_.Add(
494 encoded_image.adapt_reason_.bw_resolutions_disabled); 494 encoded_image.adapt_reason_.bw_resolutions_disabled);
495 } 495 }
496 } 496 }
497 497
498 if (encoded_image.qp_ != -1 && codec_info) { 498 if (encoded_image.qp_ != -1) {
499 if (codec_info->codecType == kVideoCodecVP8) { 499 stats_.qp_sum += encoded_image.qp_;
500 int spatial_idx = (rtp_config_.ssrcs.size() == 1) 500
501 ? -1 501 if (codec_info) {
502 : static_cast<int>(simulcast_idx); 502 if (codec_info->codecType == kVideoCodecVP8) {
503 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); 503 int spatial_idx = (rtp_config_.ssrcs.size() == 1)
504 } else if (codec_info->codecType == kVideoCodecVP9) { 504 ? -1
505 int spatial_idx = (codec_info->codecSpecific.VP9.num_spatial_layers == 1) 505 : static_cast<int>(simulcast_idx);
506 ? -1 506 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_);
507 : codec_info->codecSpecific.VP9.spatial_idx; 507 } else if (codec_info->codecType == kVideoCodecVP9) {
508 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_); 508 int spatial_idx =
509 (codec_info->codecSpecific.VP9.num_spatial_layers == 1)
510 ? -1
511 : codec_info->codecSpecific.VP9.spatial_idx;
512 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_);
513 }
hbos 2016/10/20 17:08:21 We should perhaps add QP counters for H264 as well
sakal 2016/10/21 08:59:43 I think it would be better you filed the bug since
509 } 514 }
510 } 515 }
511 516
512 // TODO(asapersson): This is incorrect if simulcast layers are encoded on 517 // TODO(asapersson): This is incorrect if simulcast layers are encoded on
513 // different threads and there is no guarantee that one frame of all layers 518 // different threads and there is no guarantee that one frame of all layers
514 // are encoded before the next start. 519 // are encoded before the next start.
515 if (last_sent_frame_timestamp_ > 0 && 520 if (last_sent_frame_timestamp_ > 0 &&
516 encoded_image._timeStamp != last_sent_frame_timestamp_) { 521 encoded_image._timeStamp != last_sent_frame_timestamp_) {
517 uma_container_->sent_frame_rate_tracker_.AddSamples(1); 522 uma_container_->sent_frame_rate_tracker_.AddSamples(1);
518 uma_container_->sent_width_counter_.Add( 523 uma_container_->sent_width_counter_.Add(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return Fraction(min_required_samples, 1000.0f); 650 return Fraction(min_required_samples, 1000.0f);
646 } 651 }
647 652
648 int SendStatisticsProxy::BoolSampleCounter::Fraction( 653 int SendStatisticsProxy::BoolSampleCounter::Fraction(
649 int min_required_samples, float multiplier) const { 654 int min_required_samples, float multiplier) const {
650 if (num_samples < min_required_samples || num_samples == 0) 655 if (num_samples < min_required_samples || num_samples == 0)
651 return -1; 656 return -1;
652 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 657 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
653 } 658 }
654 } // namespace webrtc 659 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698