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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 if (rtp_config.fec.red_payload_type != -1) { | 332 if (rtp_config.fec.red_payload_type != -1) { |
333 RTC_HISTOGRAMS_COUNTS_10000(kIndex, | 333 RTC_HISTOGRAMS_COUNTS_10000(kIndex, |
334 uma_prefix_ + "FecBitrateSentInKbps", | 334 uma_prefix_ + "FecBitrateSentInKbps", |
335 static_cast<int>(rtp_rtx.fec.TotalBytes() * | 335 static_cast<int>(rtp_rtx.fec.TotalBytes() * |
336 8 / elapsed_sec / 1000)); | 336 8 / elapsed_sec / 1000)); |
337 } | 337 } |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 void SendStatisticsProxy::SetContentType( | 342 // --TODO(perkj) test now!!!! |
343 VideoEncoderConfig::ContentType content_type) { | 343 void SendStatisticsProxy::OnEncoderReconfigured( |
344 const VideoEncoderConfig& config, | |
345 const std::vector<VideoStream>& streams) { | |
346 int preferred_bitrate_bps = 0; | |
347 for (size_t i = 0; i < streams.size(); ++i) { | |
348 if (i == streams.size() - 1) { | |
349 preferred_bitrate_bps += streams[i].max_bitrate_bps; | |
350 } else { | |
351 preferred_bitrate_bps += streams[i].target_bitrate_bps; | |
352 } | |
353 } | |
sprang_webrtc
2016/09/22 13:06:16
This seems a bit roundabout.. If "preferred" targe
perkj_webrtc
2016/09/26 12:09:42
This is a stat in WebrtcVideoSendStream and and it
sprang_webrtc
2016/09/26 13:47:37
As discussed offline, move to vie encoder and use
| |
354 | |
344 rtc::CritScope lock(&crit_); | 355 rtc::CritScope lock(&crit_); |
345 if (content_type_ != content_type) { | 356 stats_.preffered_media_bitrate_bps = preferred_bitrate_bps; |
357 | |
358 if (content_type_ != config.content_type) { | |
346 uma_container_->UpdateHistograms(rtp_config_, stats_); | 359 uma_container_->UpdateHistograms(rtp_config_, stats_); |
347 uma_container_.reset( | 360 uma_container_.reset(new UmaSamplesContainer( |
348 new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_)); | 361 GetUmaPrefix(config.content_type), stats_, clock_)); |
349 content_type_ = content_type; | 362 content_type_ = config.content_type; |
350 } | 363 } |
351 } | 364 } |
352 | 365 |
353 void SendStatisticsProxy::OnEncoderStatsUpdate(uint32_t framerate, | 366 void SendStatisticsProxy::OnEncoderStatsUpdate(uint32_t framerate, |
354 uint32_t bitrate) { | 367 uint32_t bitrate) { |
355 rtc::CritScope lock(&crit_); | 368 rtc::CritScope lock(&crit_); |
356 stats_.encode_frame_rate = framerate; | 369 stats_.encode_frame_rate = framerate; |
357 stats_.media_bitrate_bps = bitrate; | 370 stats_.media_bitrate_bps = bitrate; |
358 } | 371 } |
359 | 372 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 return Fraction(min_required_samples, 1000.0f); | 654 return Fraction(min_required_samples, 1000.0f); |
642 } | 655 } |
643 | 656 |
644 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 657 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
645 int min_required_samples, float multiplier) const { | 658 int min_required_samples, float multiplier) const { |
646 if (num_samples < min_required_samples || num_samples == 0) | 659 if (num_samples < min_required_samples || num_samples == 0) |
647 return -1; | 660 return -1; |
648 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 661 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
649 } | 662 } |
650 } // namespace webrtc | 663 } // namespace webrtc |
OLD | NEW |