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