OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 void BitrateController::MakeDecision( | 46 void BitrateController::MakeDecision( |
47 AudioNetworkAdaptor::EncoderRuntimeConfig* config) { | 47 AudioNetworkAdaptor::EncoderRuntimeConfig* config) { |
48 // Decision on |bitrate_bps| should not have been made. | 48 // Decision on |bitrate_bps| should not have been made. |
49 RTC_DCHECK(!config->bitrate_bps); | 49 RTC_DCHECK(!config->bitrate_bps); |
50 if (target_audio_bitrate_bps_ && overhead_bytes_per_packet_) { | 50 if (target_audio_bitrate_bps_ && overhead_bytes_per_packet_) { |
51 // Current implementation of BitrateController can only work when | 51 // Current implementation of BitrateController can only work when |
52 // |metrics.target_audio_bitrate_bps| includes overhead is enabled. This is | 52 // |metrics.target_audio_bitrate_bps| includes overhead is enabled. This is |
53 // currently governed by the following field trial. | 53 // currently governed by the following field trial. |
54 RTC_DCHECK_EQ("Enabled", webrtc::field_trial::FindFullName( | 54 RTC_DCHECK( |
55 "WebRTC-SendSideBwe-WithOverhead")); | 55 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")); |
56 if (config->frame_length_ms) | 56 if (config->frame_length_ms) |
57 frame_length_ms_ = *config->frame_length_ms; | 57 frame_length_ms_ = *config->frame_length_ms; |
58 int overhead_rate_bps = | 58 int overhead_rate_bps = |
59 *overhead_bytes_per_packet_ * 8 * 1000 / frame_length_ms_; | 59 *overhead_bytes_per_packet_ * 8 * 1000 / frame_length_ms_; |
60 bitrate_bps_ = std::max(0, *target_audio_bitrate_bps_ - overhead_rate_bps); | 60 bitrate_bps_ = std::max(0, *target_audio_bitrate_bps_ - overhead_rate_bps); |
61 } | 61 } |
62 config->bitrate_bps = rtc::Optional<int>(bitrate_bps_); | 62 config->bitrate_bps = rtc::Optional<int>(bitrate_bps_); |
63 } | 63 } |
64 | 64 |
65 } // namespace audio_network_adaptor | 65 } // namespace audio_network_adaptor |
66 } // namespace webrtc | 66 } // namespace webrtc |
OLD | NEW |