• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2014 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_CODECS_CNG_AUDIO_ENCODER_CNG_H_
12 #define MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_
13 
14 #include <stddef.h>
15 
16 #include <memory>
17 
18 #include "api/audio_codecs/audio_encoder.h"
19 #include "common_audio/vad/include/vad.h"
20 
21 namespace webrtc {
22 
23 struct AudioEncoderCngConfig {
24   // Moveable, not copyable.
25   AudioEncoderCngConfig();
26   AudioEncoderCngConfig(AudioEncoderCngConfig&&);
27   ~AudioEncoderCngConfig();
28 
29   bool IsOk() const;
30 
31   size_t num_channels = 1;
32   int payload_type = 13;
33   std::unique_ptr<AudioEncoder> speech_encoder;
34   Vad::Aggressiveness vad_mode = Vad::kVadNormal;
35   int sid_frame_interval_ms = 100;
36   int num_cng_coefficients = 8;
37   // The Vad pointer is mainly for testing. If a NULL pointer is passed, the
38   // AudioEncoderCng creates (and destroys) a Vad object internally. If an
39   // object is passed, the AudioEncoderCng assumes ownership of the Vad
40   // object.
41   Vad* vad = nullptr;
42 };
43 
44 std::unique_ptr<AudioEncoder> CreateComfortNoiseEncoder(
45     AudioEncoderCngConfig&& config);
46 
47 }  // namespace webrtc
48 
49 #endif  // MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_
50