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_DTX_CONTROLLER_H_ 12 #define MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_DTX_CONTROLLER_H_ 13 14 #include "absl/types/optional.h" 15 #include "modules/audio_coding/audio_network_adaptor/controller.h" 16 #include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h" 17 18 namespace webrtc { 19 20 class DtxController final : public Controller { 21 public: 22 struct Config { 23 Config(bool initial_dtx_enabled, 24 int dtx_enabling_bandwidth_bps, 25 int dtx_disabling_bandwidth_bps); 26 bool initial_dtx_enabled; 27 // Uplink bandwidth below which DTX should be switched on. 28 int dtx_enabling_bandwidth_bps; 29 // Uplink bandwidth above which DTX should be switched off. 30 int dtx_disabling_bandwidth_bps; 31 }; 32 33 explicit DtxController(const Config& config); 34 35 ~DtxController() override; 36 37 DtxController(const DtxController&) = delete; 38 DtxController& operator=(const DtxController&) = delete; 39 40 void UpdateNetworkMetrics(const NetworkMetrics& network_metrics) override; 41 42 void MakeDecision(AudioEncoderRuntimeConfig* config) override; 43 44 private: 45 const Config config_; 46 bool dtx_enabled_; 47 absl::optional<int> uplink_bandwidth_bps_; 48 }; 49 50 } // namespace webrtc 51 52 #endif // MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_DTX_CONTROLLER_H_ 53