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/constructor_magic.h" 16 17 namespace webrtc { 18 19 class AudioEncoderPcm16B final : public AudioEncoderPcm { 20 public: 21 struct Config : public AudioEncoderPcm::Config { 22 public: ConfigConfig23 Config() : AudioEncoderPcm::Config(107), sample_rate_hz(8000) {} 24 bool IsOk() const; 25 26 int sample_rate_hz; 27 }; 28 AudioEncoderPcm16B(const Config & config)29 explicit AudioEncoderPcm16B(const Config& config) 30 : AudioEncoderPcm(config, config.sample_rate_hz) {} 31 32 protected: 33 size_t EncodeCall(const int16_t* audio, 34 size_t input_len, 35 uint8_t* encoded) override; 36 37 size_t BytesPerSample() const override; 38 39 AudioEncoder::CodecType GetCodecType() const override; 40 41 private: 42 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcm16B); 43 }; 44 45 } // namespace webrtc 46 47 #endif // MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_ 48