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 |
11 #include "webrtc/modules/audio_coding/audio_network_adaptor/bitrate_controller.h
" | 11 #include "webrtc/modules/audio_coding/audio_network_adaptor/bitrate_controller.h
" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/rtc_base/checks.h" |
16 #include "webrtc/system_wrappers/include/field_trial.h" | 16 #include "webrtc/system_wrappers/include/field_trial.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 namespace audio_network_adaptor { | 19 namespace audio_network_adaptor { |
20 | 20 |
21 BitrateController::Config::Config(int initial_bitrate_bps, | 21 BitrateController::Config::Config(int initial_bitrate_bps, |
22 int initial_frame_length_ms) | 22 int initial_frame_length_ms) |
23 : initial_bitrate_bps(initial_bitrate_bps), | 23 : initial_bitrate_bps(initial_bitrate_bps), |
24 initial_frame_length_ms(initial_frame_length_ms) {} | 24 initial_frame_length_ms(initial_frame_length_ms) {} |
25 | 25 |
(...skipping 30 matching lines...) Expand all Loading... |
56 frame_length_ms_ = *config->frame_length_ms; | 56 frame_length_ms_ = *config->frame_length_ms; |
57 int overhead_rate_bps = | 57 int overhead_rate_bps = |
58 *overhead_bytes_per_packet_ * 8 * 1000 / frame_length_ms_; | 58 *overhead_bytes_per_packet_ * 8 * 1000 / frame_length_ms_; |
59 bitrate_bps_ = std::max(0, *target_audio_bitrate_bps_ - overhead_rate_bps); | 59 bitrate_bps_ = std::max(0, *target_audio_bitrate_bps_ - overhead_rate_bps); |
60 } | 60 } |
61 config->bitrate_bps = rtc::Optional<int>(bitrate_bps_); | 61 config->bitrate_bps = rtc::Optional<int>(bitrate_bps_); |
62 } | 62 } |
63 | 63 |
64 } // namespace audio_network_adaptor | 64 } // namespace audio_network_adaptor |
65 } // namespace webrtc | 65 } // namespace webrtc |
OLD | NEW |