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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 480 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
481 if (!stats) | 481 if (!stats) |
482 return; | 482 return; |
483 | 483 |
484 stats->width = encoded_image._encodedWidth; | 484 stats->width = encoded_image._encodedWidth; |
485 stats->height = encoded_image._encodedHeight; | 485 stats->height = encoded_image._encodedHeight; |
486 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 486 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
487 | 487 |
488 uma_container_->key_frame_counter_.Add(encoded_image._frameType == | 488 uma_container_->key_frame_counter_.Add(encoded_image._frameType == |
489 kVideoFrameKey); | 489 kVideoFrameKey); |
490 | |
491 stats_.bw_limited_resolution = | 490 stats_.bw_limited_resolution = |
492 encoded_image.adapt_reason_.quality_resolution_downscales > 0 || | 491 stats_.bw_limited_resolution || |
493 encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | 492 encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
494 | 493 |
495 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { | 494 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { |
496 bool downscaled = | 495 bool downscaled = |
497 encoded_image.adapt_reason_.quality_resolution_downscales > 0; | 496 encoded_image.adapt_reason_.quality_resolution_downscales > 0; |
498 uma_container_->quality_limited_frame_counter_.Add(downscaled); | 497 uma_container_->quality_limited_frame_counter_.Add(downscaled); |
499 if (downscaled) { | 498 if (downscaled) { |
500 uma_container_->quality_downscales_counter_.Add( | 499 uma_container_->quality_downscales_counter_.Add( |
501 encoded_image.adapt_reason_.quality_resolution_downscales); | 500 encoded_image.adapt_reason_.quality_resolution_downscales); |
502 } | 501 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 } | 561 } |
563 | 562 |
564 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { | 563 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { |
565 rtc::CritScope lock(&crit_); | 564 rtc::CritScope lock(&crit_); |
566 uma_container_->input_frame_rate_tracker_.AddSamples(1); | 565 uma_container_->input_frame_rate_tracker_.AddSamples(1); |
567 uma_container_->input_width_counter_.Add(width); | 566 uma_container_->input_width_counter_.Add(width); |
568 uma_container_->input_height_counter_.Add(height); | 567 uma_container_->input_height_counter_.Add(height); |
569 uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution); | 568 uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution); |
570 } | 569 } |
571 | 570 |
572 void SendStatisticsProxy::SetCpuRestrictedResolution( | 571 void SendStatisticsProxy::SetResolutionRestrictionStats(bool bandwidth, |
573 bool cpu_restricted_resolution) { | 572 bool cpu) { |
574 rtc::CritScope lock(&crit_); | 573 rtc::CritScope lock(&crit_); |
575 stats_.cpu_limited_resolution = cpu_restricted_resolution; | 574 stats_.bw_limited_resolution = bandwidth; |
| 575 stats_.cpu_limited_resolution = cpu; |
576 } | 576 } |
577 | 577 |
578 void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( | 578 void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( |
579 bool cpu_restricted_resolution) { | 579 bool cpu_restricted_resolution) { |
580 rtc::CritScope lock(&crit_); | 580 rtc::CritScope lock(&crit_); |
581 stats_.cpu_limited_resolution = cpu_restricted_resolution; | 581 stats_.cpu_limited_resolution = cpu_restricted_resolution; |
582 ++stats_.number_of_cpu_adapt_changes; | 582 ++stats_.number_of_cpu_adapt_changes; |
583 } | 583 } |
584 | 584 |
| 585 void SendStatisticsProxy::OnQualityRestrictedResolutionChanged( |
| 586 bool restricted) { |
| 587 rtc::CritScope lock(&crit_); |
| 588 uma_container_->quality_downscales_counter_.Add(restricted); |
| 589 stats_.bw_limited_resolution = restricted; |
| 590 } |
| 591 |
585 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( | 592 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |
586 uint32_t ssrc, | 593 uint32_t ssrc, |
587 const RtcpPacketTypeCounter& packet_counter) { | 594 const RtcpPacketTypeCounter& packet_counter) { |
588 rtc::CritScope lock(&crit_); | 595 rtc::CritScope lock(&crit_); |
589 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 596 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
590 if (!stats) | 597 if (!stats) |
591 return; | 598 return; |
592 | 599 |
593 stats->rtcp_packet_type_counts = packet_counter; | 600 stats->rtcp_packet_type_counts = packet_counter; |
594 if (uma_container_->first_rtcp_stats_time_ms_ == -1) | 601 if (uma_container_->first_rtcp_stats_time_ms_ == -1) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 return Fraction(min_required_samples, 1000.0f); | 691 return Fraction(min_required_samples, 1000.0f); |
685 } | 692 } |
686 | 693 |
687 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 694 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
688 int min_required_samples, float multiplier) const { | 695 int min_required_samples, float multiplier) const { |
689 if (num_samples < min_required_samples || num_samples == 0) | 696 if (num_samples < min_required_samples || num_samples == 0) |
690 return -1; | 697 return -1; |
691 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 698 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
692 } | 699 } |
693 } // namespace webrtc | 700 } // namespace webrtc |
OLD | NEW |