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