| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 if (!stats) | 499 if (!stats) |
| 500 return; | 500 return; |
| 501 | 501 |
| 502 stats->width = encoded_image._encodedWidth; | 502 stats->width = encoded_image._encodedWidth; |
| 503 stats->height = encoded_image._encodedHeight; | 503 stats->height = encoded_image._encodedHeight; |
| 504 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 504 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
| 505 | 505 |
| 506 uma_container_->key_frame_counter_.Add(encoded_image._frameType == | 506 uma_container_->key_frame_counter_.Add(encoded_image._frameType == |
| 507 kVideoFrameKey); | 507 kVideoFrameKey); |
| 508 stats_.bw_limited_resolution = | 508 stats_.bw_limited_resolution = |
| 509 encoded_image.adapt_reason_.bw_resolutions_disabled > 0 || | 509 stats_.bw_limited_resolution || |
| 510 quality_downscales_ > 0; | 510 encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
| 511 | 511 |
| 512 if (quality_downscales_ != -1) { | 512 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { |
| 513 uma_container_->quality_limited_frame_counter_.Add(quality_downscales_ > 0); | 513 bool downscaled = |
| 514 if (quality_downscales_ > 0) | 514 encoded_image.adapt_reason_.quality_resolution_downscales > 0; |
| 515 uma_container_->quality_downscales_counter_.Add(quality_downscales_); | 515 uma_container_->quality_limited_frame_counter_.Add(downscaled); |
| 516 if (downscaled) { |
| 517 uma_container_->quality_downscales_counter_.Add( |
| 518 encoded_image.adapt_reason_.quality_resolution_downscales); |
| 519 } |
| 516 } | 520 } |
| 517 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { | 521 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { |
| 518 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | 522 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
| 519 uma_container_->bw_limited_frame_counter_.Add(bw_limited); | 523 uma_container_->bw_limited_frame_counter_.Add(bw_limited); |
| 520 if (bw_limited) { | 524 if (bw_limited) { |
| 521 uma_container_->bw_resolutions_disabled_counter_.Add( | 525 uma_container_->bw_resolutions_disabled_counter_.Add( |
| 522 encoded_image.adapt_reason_.bw_resolutions_disabled); | 526 encoded_image.adapt_reason_.bw_resolutions_disabled); |
| 523 } | 527 } |
| 524 } | 528 } |
| 525 | 529 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 580 |
| 577 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { | 581 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { |
| 578 rtc::CritScope lock(&crit_); | 582 rtc::CritScope lock(&crit_); |
| 579 uma_container_->input_frame_rate_tracker_.AddSamples(1); | 583 uma_container_->input_frame_rate_tracker_.AddSamples(1); |
| 580 uma_container_->input_fps_counter_.Add(1); | 584 uma_container_->input_fps_counter_.Add(1); |
| 581 uma_container_->input_width_counter_.Add(width); | 585 uma_container_->input_width_counter_.Add(width); |
| 582 uma_container_->input_height_counter_.Add(height); | 586 uma_container_->input_height_counter_.Add(height); |
| 583 uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution); | 587 uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution); |
| 584 } | 588 } |
| 585 | 589 |
| 586 void SendStatisticsProxy::SetResolutionRestrictionStats( | 590 void SendStatisticsProxy::SetResolutionRestrictionStats(bool bandwidth, |
| 587 bool scaling_enabled, | 591 bool cpu) { |
| 588 bool cpu_restricted, | |
| 589 int num_quality_downscales) { | |
| 590 rtc::CritScope lock(&crit_); | 592 rtc::CritScope lock(&crit_); |
| 591 if (scaling_enabled) { | 593 stats_.bw_limited_resolution = bandwidth; |
| 592 quality_downscales_ = num_quality_downscales; | 594 stats_.cpu_limited_resolution = cpu; |
| 593 stats_.bw_limited_resolution = quality_downscales_ > 0; | |
| 594 stats_.cpu_limited_resolution = cpu_restricted; | |
| 595 } else { | |
| 596 stats_.bw_limited_resolution = false; | |
| 597 stats_.cpu_limited_resolution = false; | |
| 598 quality_downscales_ = -1; | |
| 599 } | |
| 600 } | 595 } |
| 601 | 596 |
| 602 void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( | 597 void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( |
| 603 bool cpu_restricted_resolution) { | 598 bool cpu_restricted_resolution) { |
| 604 rtc::CritScope lock(&crit_); | 599 rtc::CritScope lock(&crit_); |
| 605 stats_.cpu_limited_resolution = cpu_restricted_resolution; | 600 stats_.cpu_limited_resolution = cpu_restricted_resolution; |
| 606 ++stats_.number_of_cpu_adapt_changes; | 601 ++stats_.number_of_cpu_adapt_changes; |
| 607 } | 602 } |
| 608 | 603 |
| 609 void SendStatisticsProxy::OnQualityRestrictedResolutionChanged( | 604 void SendStatisticsProxy::OnQualityRestrictedResolutionChanged( |
| 610 int num_quality_downscales) { | 605 bool restricted) { |
| 611 rtc::CritScope lock(&crit_); | 606 rtc::CritScope lock(&crit_); |
| 612 quality_downscales_ = num_quality_downscales; | 607 uma_container_->quality_downscales_counter_.Add(restricted); |
| 613 stats_.bw_limited_resolution = quality_downscales_ > 0; | 608 stats_.bw_limited_resolution = restricted; |
| 614 } | 609 } |
| 615 | 610 |
| 616 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( | 611 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |
| 617 uint32_t ssrc, | 612 uint32_t ssrc, |
| 618 const RtcpPacketTypeCounter& packet_counter) { | 613 const RtcpPacketTypeCounter& packet_counter) { |
| 619 rtc::CritScope lock(&crit_); | 614 rtc::CritScope lock(&crit_); |
| 620 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 615 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 621 if (!stats) | 616 if (!stats) |
| 622 return; | 617 return; |
| 623 | 618 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 return Fraction(min_required_samples, 1000.0f); | 716 return Fraction(min_required_samples, 1000.0f); |
| 722 } | 717 } |
| 723 | 718 |
| 724 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 719 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 725 int min_required_samples, float multiplier) const { | 720 int min_required_samples, float multiplier) const { |
| 726 if (num_samples < min_required_samples || num_samples == 0) | 721 if (num_samples < min_required_samples || num_samples == 0) |
| 727 return -1; | 722 return -1; |
| 728 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 723 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 729 } | 724 } |
| 730 } // namespace webrtc | 725 } // namespace webrtc |
| OLD | NEW |