audio_encoder_pcm16b.cc (1365B)
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 #include "modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h" 12 13 #include <cstddef> 14 #include <cstdint> 15 16 #include "api/audio_codecs/audio_encoder.h" 17 #include "modules/audio_coding/codecs/g711/audio_encoder_pcm.h" 18 #include "modules/audio_coding/codecs/pcm16b/pcm16b.h" 19 20 namespace webrtc { 21 22 size_t AudioEncoderPcm16B::EncodeCall(const int16_t* audio, 23 size_t input_len, 24 uint8_t* encoded) { 25 return WebRtcPcm16b_Encode(audio, input_len, encoded); 26 } 27 28 size_t AudioEncoderPcm16B::BytesPerSample() const { 29 return 2; 30 } 31 32 AudioEncoder::CodecType AudioEncoderPcm16B::GetCodecType() const { 33 return CodecType::kOther; 34 } 35 36 bool AudioEncoderPcm16B::Config::IsOk() const { 37 if ((sample_rate_hz != 8000) && (sample_rate_hz != 16000) && 38 (sample_rate_hz != 32000) && (sample_rate_hz != 48000)) 39 return false; 40 return AudioEncoderPcm::Config::IsOk(); 41 } 42 43 } // namespace webrtc