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_PCM16B_AUDIO_ENCODER_PCM16B_H_
12 #define MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
13 
14 #include "modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
15 #include "rtc_base/constructormagic.h"
16 
17 namespace webrtc {
18 
19 struct CodecInst;
20 
21 class AudioEncoderPcm16B final : public AudioEncoderPcm {
22  public:
23   struct Config : public AudioEncoderPcm::Config {
24    public:
ConfigConfig25     Config() : AudioEncoderPcm::Config(107), sample_rate_hz(8000) {}
26     bool IsOk() const;
27 
28     int sample_rate_hz;
29   };
30 
AudioEncoderPcm16B(const Config & config)31   explicit AudioEncoderPcm16B(const Config& config)
32       : AudioEncoderPcm(config, config.sample_rate_hz) {}
33   explicit AudioEncoderPcm16B(const CodecInst& codec_inst);
34 
35  protected:
36   size_t EncodeCall(const int16_t* audio,
37                     size_t input_len,
38                     uint8_t* encoded) override;
39 
40   size_t BytesPerSample() const override;
41 
42   AudioEncoder::CodecType GetCodecType() const override;
43 
44  private:
45   RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcm16B);
46 };
47 
48 }  // namespace webrtc
49 
50 #endif  // MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
51