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