| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 400 } |
| 401 | 401 |
| 402 void SendStatisticsProxy::OnSetRates(uint32_t bitrate_bps, int framerate) { | 402 void SendStatisticsProxy::OnSetRates(uint32_t bitrate_bps, int framerate) { |
| 403 rtc::CritScope lock(&crit_); | 403 rtc::CritScope lock(&crit_); |
| 404 stats_.target_media_bitrate_bps = bitrate_bps; | 404 stats_.target_media_bitrate_bps = bitrate_bps; |
| 405 } | 405 } |
| 406 | 406 |
| 407 void SendStatisticsProxy::OnSendEncodedImage( | 407 void SendStatisticsProxy::OnSendEncodedImage( |
| 408 const EncodedImage& encoded_image, | 408 const EncodedImage& encoded_image, |
| 409 const RTPVideoHeader* rtp_video_header) { | 409 const RTPVideoHeader* rtp_video_header) { |
| 410 size_t simulcast_idx = | 410 size_t simulcast_idx = rtp_video_header ? rtp_video_header->simulcastIdx : 0; |
| 411 rtp_video_header != nullptr ? rtp_video_header->simulcastIdx : 0; | |
| 412 if (simulcast_idx >= config_.rtp.ssrcs.size()) { | 411 if (simulcast_idx >= config_.rtp.ssrcs.size()) { |
| 413 LOG(LS_ERROR) << "Encoded image outside simulcast range (" << simulcast_idx | 412 LOG(LS_ERROR) << "Encoded image outside simulcast range (" << simulcast_idx |
| 414 << " >= " << config_.rtp.ssrcs.size() << ")."; | 413 << " >= " << config_.rtp.ssrcs.size() << ")."; |
| 415 return; | 414 return; |
| 416 } | 415 } |
| 417 uint32_t ssrc = config_.rtp.ssrcs[simulcast_idx]; | 416 uint32_t ssrc = config_.rtp.ssrcs[simulcast_idx]; |
| 418 | 417 |
| 419 rtc::CritScope lock(&crit_); | 418 rtc::CritScope lock(&crit_); |
| 420 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 419 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 421 if (stats == nullptr) | 420 if (stats == nullptr) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 443 } | 442 } |
| 444 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { | 443 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { |
| 445 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | 444 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
| 446 uma_container_->bw_limited_frame_counter_.Add(bw_limited); | 445 uma_container_->bw_limited_frame_counter_.Add(bw_limited); |
| 447 if (bw_limited) { | 446 if (bw_limited) { |
| 448 uma_container_->bw_resolutions_disabled_counter_.Add( | 447 uma_container_->bw_resolutions_disabled_counter_.Add( |
| 449 encoded_image.adapt_reason_.bw_resolutions_disabled); | 448 encoded_image.adapt_reason_.bw_resolutions_disabled); |
| 450 } | 449 } |
| 451 } | 450 } |
| 452 | 451 |
| 453 if (encoded_image.qp_ != -1 && rtp_video_header != nullptr && | 452 if (encoded_image.qp_ != -1 && rtp_video_header && |
| 454 rtp_video_header->codec == kRtpVideoVp8) { | 453 rtp_video_header->codec == kRtpVideoVp8) { |
| 455 int spatial_idx = | 454 int spatial_idx = |
| 456 (config_.rtp.ssrcs.size() == 1) ? -1 : static_cast<int>(simulcast_idx); | 455 (config_.rtp.ssrcs.size() == 1) ? -1 : static_cast<int>(simulcast_idx); |
| 457 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); | 456 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); |
| 458 } | 457 } |
| 459 | 458 |
| 460 // TODO(asapersson): This is incorrect if simulcast layers are encoded on | 459 // TODO(asapersson): This is incorrect if simulcast layers are encoded on |
| 461 // different threads and there is no guarantee that one frame of all layers | 460 // different threads and there is no guarantee that one frame of all layers |
| 462 // are encoded before the next start. | 461 // are encoded before the next start. |
| 463 if (last_sent_frame_timestamp_ > 0 && | 462 if (last_sent_frame_timestamp_ > 0 && |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 uma_container_->report_block_stats_.Store(statistics, 0, ssrc); | 509 uma_container_->report_block_stats_.Store(statistics, 0, ssrc); |
| 511 } | 510 } |
| 512 | 511 |
| 513 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {} | 512 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {} |
| 514 | 513 |
| 515 void SendStatisticsProxy::DataCountersUpdated( | 514 void SendStatisticsProxy::DataCountersUpdated( |
| 516 const StreamDataCounters& counters, | 515 const StreamDataCounters& counters, |
| 517 uint32_t ssrc) { | 516 uint32_t ssrc) { |
| 518 rtc::CritScope lock(&crit_); | 517 rtc::CritScope lock(&crit_); |
| 519 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 518 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 520 RTC_DCHECK(stats != nullptr) | 519 RTC_DCHECK(stats) << "DataCountersUpdated reported for unknown ssrc: " |
| 521 << "DataCountersUpdated reported for unknown ssrc: " << ssrc; | 520 << ssrc; |
| 522 | 521 |
| 523 stats->rtp_stats = counters; | 522 stats->rtp_stats = counters; |
| 524 if (uma_container_->first_rtp_stats_time_ms_ == -1) | 523 if (uma_container_->first_rtp_stats_time_ms_ == -1) |
| 525 uma_container_->first_rtp_stats_time_ms_ = clock_->TimeInMilliseconds(); | 524 uma_container_->first_rtp_stats_time_ms_ = clock_->TimeInMilliseconds(); |
| 526 } | 525 } |
| 527 | 526 |
| 528 void SendStatisticsProxy::Notify(const BitrateStatistics& total_stats, | 527 void SendStatisticsProxy::Notify(const BitrateStatistics& total_stats, |
| 529 const BitrateStatistics& retransmit_stats, | 528 const BitrateStatistics& retransmit_stats, |
| 530 uint32_t ssrc) { | 529 uint32_t ssrc) { |
| 531 rtc::CritScope lock(&crit_); | 530 rtc::CritScope lock(&crit_); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 return Fraction(min_required_samples, 1000.0f); | 587 return Fraction(min_required_samples, 1000.0f); |
| 589 } | 588 } |
| 590 | 589 |
| 591 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 590 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 592 int min_required_samples, float multiplier) const { | 591 int min_required_samples, float multiplier) const { |
| 593 if (num_samples < min_required_samples || num_samples == 0) | 592 if (num_samples < min_required_samples || num_samples == 0) |
| 594 return -1; | 593 return -1; |
| 595 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 594 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 596 } | 595 } |
| 597 } // namespace webrtc | 596 } // namespace webrtc |
| OLD | NEW |