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