• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "rtc_base/constructor_magic.h"
18 
19 namespace webrtc {
20 
21 class DtxController final : public Controller {
22  public:
23   struct Config {
24     Config(bool initial_dtx_enabled,
25            int dtx_enabling_bandwidth_bps,
26            int dtx_disabling_bandwidth_bps);
27     bool initial_dtx_enabled;
28     // Uplink bandwidth below which DTX should be switched on.
29     int dtx_enabling_bandwidth_bps;
30     // Uplink bandwidth above which DTX should be switched off.
31     int dtx_disabling_bandwidth_bps;
32   };
33 
34   explicit DtxController(const Config& config);
35 
36   ~DtxController() override;
37 
38   void UpdateNetworkMetrics(const NetworkMetrics& network_metrics) override;
39 
40   void MakeDecision(AudioEncoderRuntimeConfig* config) override;
41 
42  private:
43   const Config config_;
44   bool dtx_enabled_;
45   absl::optional<int> uplink_bandwidth_bps_;
46   RTC_DISALLOW_COPY_AND_ASSIGN(DtxController);
47 };
48 
49 }  // namespace webrtc
50 
51 #endif  // MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_DTX_CONTROLLER_H_
52