1 /* 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_BITRATE_CONTROLLER_H_ 12 #define MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_BITRATE_CONTROLLER_H_ 13 14 #include <stddef.h> 15 16 #include "absl/types/optional.h" 17 #include "modules/audio_coding/audio_network_adaptor/controller.h" 18 #include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h" 19 #include "rtc_base/constructor_magic.h" 20 21 namespace webrtc { 22 namespace audio_network_adaptor { 23 24 class BitrateController final : public Controller { 25 public: 26 struct Config { 27 Config(int initial_bitrate_bps, 28 int initial_frame_length_ms, 29 int fl_increase_overhead_offset, 30 int fl_decrease_overhead_offset); 31 ~Config(); 32 int initial_bitrate_bps; 33 int initial_frame_length_ms; 34 int fl_increase_overhead_offset; 35 int fl_decrease_overhead_offset; 36 }; 37 38 explicit BitrateController(const Config& config); 39 40 ~BitrateController() override; 41 42 void UpdateNetworkMetrics(const NetworkMetrics& network_metrics) override; 43 44 void MakeDecision(AudioEncoderRuntimeConfig* config) override; 45 46 private: 47 const Config config_; 48 int bitrate_bps_; 49 int frame_length_ms_; 50 absl::optional<int> target_audio_bitrate_bps_; 51 absl::optional<size_t> overhead_bytes_per_packet_; 52 RTC_DISALLOW_COPY_AND_ASSIGN(BitrateController); 53 }; 54 55 } // namespace audio_network_adaptor 56 } // namespace webrtc 57 58 #endif // MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_BITRATE_CONTROLLER_H_ 59