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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 if (!stats) | 470 if (!stats) |
471 return; | 471 return; |
472 | 472 |
473 stats->width = encoded_image._encodedWidth; | 473 stats->width = encoded_image._encodedWidth; |
474 stats->height = encoded_image._encodedHeight; | 474 stats->height = encoded_image._encodedHeight; |
475 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 475 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
476 | 476 |
477 uma_container_->key_frame_counter_.Add(encoded_image._frameType == | 477 uma_container_->key_frame_counter_.Add(encoded_image._frameType == |
478 kVideoFrameKey); | 478 kVideoFrameKey); |
479 | 479 |
480 stats_.bw_limited_resolution = | 480 if (stats_.bw_limited_resolution) { |
481 encoded_image.adapt_reason_.quality_resolution_downscales > 0 || | |
482 encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | |
483 | |
484 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { | |
485 bool downscaled = | |
486 encoded_image.adapt_reason_.quality_resolution_downscales > 0; | |
487 uma_container_->quality_limited_frame_counter_.Add(downscaled); | |
488 if (downscaled) { | |
489 uma_container_->quality_downscales_counter_.Add( | |
490 encoded_image.adapt_reason_.quality_resolution_downscales); | |
491 } | |
492 } | |
493 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { | |
494 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | 481 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
495 uma_container_->bw_limited_frame_counter_.Add(bw_limited); | 482 uma_container_->bw_limited_frame_counter_.Add(bw_limited); |
496 if (bw_limited) { | 483 if (bw_limited) { |
497 uma_container_->bw_resolutions_disabled_counter_.Add( | 484 uma_container_->bw_resolutions_disabled_counter_.Add( |
498 encoded_image.adapt_reason_.bw_resolutions_disabled); | 485 encoded_image.adapt_reason_.bw_resolutions_disabled); |
499 } | 486 } |
500 } | 487 } |
501 | 488 |
502 if (encoded_image.qp_ != -1 && codec_info) { | 489 if (encoded_image.qp_ != -1 && codec_info) { |
503 if (codec_info->codecType == kVideoCodecVP8) { | 490 if (codec_info->codecType == kVideoCodecVP8) { |
(...skipping 29 matching lines...) Expand all Loading... |
533 uma_container_->max_sent_height_per_timestamp_ = | 520 uma_container_->max_sent_height_per_timestamp_ = |
534 std::max(uma_container_->max_sent_height_per_timestamp_, | 521 std::max(uma_container_->max_sent_height_per_timestamp_, |
535 static_cast<int>(encoded_image._encodedHeight)); | 522 static_cast<int>(encoded_image._encodedHeight)); |
536 } | 523 } |
537 | 524 |
538 int SendStatisticsProxy::GetSendFrameRate() const { | 525 int SendStatisticsProxy::GetSendFrameRate() const { |
539 rtc::CritScope lock(&crit_); | 526 rtc::CritScope lock(&crit_); |
540 return stats_.encode_frame_rate; | 527 return stats_.encode_frame_rate; |
541 } | 528 } |
542 | 529 |
543 void SendStatisticsProxy::OnIncomingFrame(int width, | 530 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { |
544 int height, | |
545 bool is_cpu_restricted) { | |
546 rtc::CritScope lock(&crit_); | 531 rtc::CritScope lock(&crit_); |
547 uma_container_->input_frame_rate_tracker_.AddSamples(1); | 532 uma_container_->input_frame_rate_tracker_.AddSamples(1); |
548 uma_container_->input_width_counter_.Add(width); | 533 uma_container_->input_width_counter_.Add(width); |
549 uma_container_->input_height_counter_.Add(height); | 534 uma_container_->input_height_counter_.Add(height); |
550 uma_container_->cpu_limited_frame_counter_.Add(is_cpu_restricted); | 535 uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution); |
551 } | 536 } |
552 | 537 |
553 void SendStatisticsProxy::SetCpuRestrictedResolution( | 538 void SendStatisticsProxy::SetResolutionRestrictionStats(bool bandwidth, |
554 bool cpu_restricted_resolution) { | 539 bool cpu) { |
555 rtc::CritScope lock(&crit_); | 540 rtc::CritScope lock(&crit_); |
556 stats_.cpu_limited_resolution = cpu_restricted_resolution; | 541 stats_.bw_limited_resolution = bandwidth; |
| 542 stats_.cpu_limited_resolution = cpu; |
557 } | 543 } |
558 | 544 |
559 void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( | 545 void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( |
560 bool cpu_restricted_resolution) { | 546 bool cpu_restricted_resolution) { |
561 rtc::CritScope lock(&crit_); | 547 rtc::CritScope lock(&crit_); |
562 stats_.cpu_limited_resolution = cpu_restricted_resolution; | 548 stats_.cpu_limited_resolution = cpu_restricted_resolution; |
563 ++stats_.number_of_cpu_adapt_changes; | 549 ++stats_.number_of_cpu_adapt_changes; |
564 } | 550 } |
565 | 551 |
| 552 void SendStatisticsProxy::OnQualityRestrictedResolutionChanged( |
| 553 bool restricted) { |
| 554 rtc::CritScope lock(&crit_); |
| 555 uma_container_->quality_downscales_counter_.Add(restricted); |
| 556 stats_.bw_limited_resolution = restricted; |
| 557 } |
| 558 |
566 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( | 559 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |
567 uint32_t ssrc, | 560 uint32_t ssrc, |
568 const RtcpPacketTypeCounter& packet_counter) { | 561 const RtcpPacketTypeCounter& packet_counter) { |
569 rtc::CritScope lock(&crit_); | 562 rtc::CritScope lock(&crit_); |
570 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 563 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
571 if (!stats) | 564 if (!stats) |
572 return; | 565 return; |
573 | 566 |
574 stats->rtcp_packet_type_counts = packet_counter; | 567 stats->rtcp_packet_type_counts = packet_counter; |
575 if (uma_container_->first_rtcp_stats_time_ms_ == -1) | 568 if (uma_container_->first_rtcp_stats_time_ms_ == -1) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 return Fraction(min_required_samples, 1000.0f); | 658 return Fraction(min_required_samples, 1000.0f); |
666 } | 659 } |
667 | 660 |
668 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 661 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
669 int min_required_samples, float multiplier) const { | 662 int min_required_samples, float multiplier) const { |
670 if (num_samples < min_required_samples || num_samples == 0) | 663 if (num_samples < min_required_samples || num_samples == 0) |
671 return -1; | 664 return -1; |
672 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 665 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
673 } | 666 } |
674 } // namespace webrtc | 667 } // namespace webrtc |
OLD | NEW |