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_CHANNEL_CONTROLLER_H_ 12 #define MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CHANNEL_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 20 namespace webrtc { 21 22 class ChannelController final : public Controller { 23 public: 24 struct Config { 25 Config(size_t num_encoder_channels, 26 size_t intial_channels_to_encode, 27 int channel_1_to_2_bandwidth_bps, 28 int channel_2_to_1_bandwidth_bps); 29 size_t num_encoder_channels; 30 size_t intial_channels_to_encode; 31 // Uplink bandwidth above which the number of encoded channels should switch 32 // from 1 to 2. 33 int channel_1_to_2_bandwidth_bps; 34 // Uplink bandwidth below which the number of encoded channels should switch 35 // from 2 to 1. 36 int channel_2_to_1_bandwidth_bps; 37 }; 38 39 explicit ChannelController(const Config& config); 40 41 ~ChannelController() override; 42 43 ChannelController(const ChannelController&) = delete; 44 ChannelController& operator=(const ChannelController&) = delete; 45 46 void UpdateNetworkMetrics(const NetworkMetrics& network_metrics) override; 47 48 void MakeDecision(AudioEncoderRuntimeConfig* config) override; 49 50 private: 51 const Config config_; 52 size_t channels_to_encode_; 53 absl::optional<int> uplink_bandwidth_bps_; 54 }; 55 56 } // namespace webrtc 57 58 #endif // MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CHANNEL_CONTROLLER_H_ 59