• 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 #include "modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
12 
13 #include "modules/audio_coding/codecs/pcm16b/pcm16b.h"
14 #include "rtc_base/checks.h"
15 
16 namespace webrtc {
17 
EncodeCall(const int16_t * audio,size_t input_len,uint8_t * encoded)18 size_t AudioEncoderPcm16B::EncodeCall(const int16_t* audio,
19                                       size_t input_len,
20                                       uint8_t* encoded) {
21   return WebRtcPcm16b_Encode(audio, input_len, encoded);
22 }
23 
BytesPerSample() const24 size_t AudioEncoderPcm16B::BytesPerSample() const {
25   return 2;
26 }
27 
GetCodecType() const28 AudioEncoder::CodecType AudioEncoderPcm16B::GetCodecType() const {
29   return CodecType::kOther;
30 }
31 
IsOk() const32 bool AudioEncoderPcm16B::Config::IsOk() const {
33   if ((sample_rate_hz != 8000) && (sample_rate_hz != 16000) &&
34       (sample_rate_hz != 32000) && (sample_rate_hz != 48000))
35     return false;
36   return AudioEncoderPcm::Config::IsOk();
37 }
38 
39 }  // namespace webrtc
40