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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 if (!stats_.qp_sum) |
500 int spatial_idx = (rtp_config_.ssrcs.size() == 1) | 500 stats_.qp_sum = rtc::Optional<uint64_t>(0); |
501 ? -1 | 501 *stats_.qp_sum += encoded_image.qp_; |
502 : static_cast<int>(simulcast_idx); | 502 |
503 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); | 503 if (codec_info) { |
504 } else if (codec_info->codecType == kVideoCodecVP9) { | 504 if (codec_info->codecType == kVideoCodecVP8) { |
505 int spatial_idx = (codec_info->codecSpecific.VP9.num_spatial_layers == 1) | 505 int spatial_idx = (rtp_config_.ssrcs.size() == 1) |
506 ? -1 | 506 ? -1 |
507 : codec_info->codecSpecific.VP9.spatial_idx; | 507 : static_cast<int>(simulcast_idx); |
508 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_); | 508 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); |
509 } else if (codec_info->codecType == kVideoCodecVP9) { | |
510 int spatial_idx = | |
511 (codec_info->codecSpecific.VP9.num_spatial_layers == 1) | |
512 ? -1 | |
513 : codec_info->codecSpecific.VP9.spatial_idx; | |
514 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_); | |
515 } | |
hta-webrtc
2016/10/27 12:22:35
I don't understand the code here - it seems that f
hbos
2016/10/28 09:25:13
This confuses me too.
| |
509 } | 516 } |
510 } | 517 } |
511 | 518 |
512 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 519 // 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 | 520 // different threads and there is no guarantee that one frame of all layers |
514 // are encoded before the next start. | 521 // are encoded before the next start. |
515 if (last_sent_frame_timestamp_ > 0 && | 522 if (last_sent_frame_timestamp_ > 0 && |
516 encoded_image._timeStamp != last_sent_frame_timestamp_) { | 523 encoded_image._timeStamp != last_sent_frame_timestamp_) { |
517 uma_container_->sent_frame_rate_tracker_.AddSamples(1); | 524 uma_container_->sent_frame_rate_tracker_.AddSamples(1); |
518 uma_container_->sent_width_counter_.Add( | 525 uma_container_->sent_width_counter_.Add( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 return Fraction(min_required_samples, 1000.0f); | 652 return Fraction(min_required_samples, 1000.0f); |
646 } | 653 } |
647 | 654 |
648 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 655 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
649 int min_required_samples, float multiplier) const { | 656 int min_required_samples, float multiplier) const { |
650 if (num_samples < min_required_samples || num_samples == 0) | 657 if (num_samples < min_required_samples || num_samples == 0) |
651 return -1; | 658 return -1; |
652 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 659 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
653 } | 660 } |
654 } // namespace webrtc | 661 } // namespace webrtc |
OLD | NEW |