OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 return false; | 22 return false; |
23 return AudioEncoderPcm::Config::IsOk(); | 23 return AudioEncoderPcm::Config::IsOk(); |
24 } | 24 } |
25 | 25 |
26 int16_t AudioEncoderPcm16B::EncodeCall(const int16_t* audio, | 26 int16_t AudioEncoderPcm16B::EncodeCall(const int16_t* audio, |
27 size_t input_len, | 27 size_t input_len, |
28 uint8_t* encoded) { | 28 uint8_t* encoded) { |
29 return WebRtcPcm16b_Encode(audio, static_cast<int16_t>(input_len), encoded); | 29 return WebRtcPcm16b_Encode(audio, static_cast<int16_t>(input_len), encoded); |
30 } | 30 } |
31 | 31 |
| 32 int AudioEncoderPcm16B::BytesPerSample() const { |
| 33 return 2; |
| 34 } |
| 35 |
32 namespace { | 36 namespace { |
33 AudioEncoderPcm16B::Config CreateConfig(const CodecInst& codec_inst) { | 37 AudioEncoderPcm16B::Config CreateConfig(const CodecInst& codec_inst) { |
34 AudioEncoderPcm16B::Config config; | 38 AudioEncoderPcm16B::Config config; |
35 config.num_channels = codec_inst.channels; | 39 config.num_channels = codec_inst.channels; |
36 config.sample_rate_hz = codec_inst.plfreq; | 40 config.sample_rate_hz = codec_inst.plfreq; |
37 config.frame_size_ms = rtc::CheckedDivExact( | 41 config.frame_size_ms = rtc::CheckedDivExact( |
38 codec_inst.pacsize, rtc::CheckedDivExact(config.sample_rate_hz, 1000)); | 42 codec_inst.pacsize, rtc::CheckedDivExact(config.sample_rate_hz, 1000)); |
39 config.payload_type = codec_inst.pltype; | 43 config.payload_type = codec_inst.pltype; |
40 return config; | 44 return config; |
41 } | 45 } |
42 } // namespace | 46 } // namespace |
43 | 47 |
44 AudioEncoderMutablePcm16B::AudioEncoderMutablePcm16B( | 48 AudioEncoderMutablePcm16B::AudioEncoderMutablePcm16B( |
45 const CodecInst& codec_inst) | 49 const CodecInst& codec_inst) |
46 : AudioEncoderMutableImpl<AudioEncoderPcm16B>(CreateConfig(codec_inst)) { | 50 : AudioEncoderMutableImpl<AudioEncoderPcm16B>(CreateConfig(codec_inst)) { |
47 } | 51 } |
48 | 52 |
49 } // namespace webrtc | 53 } // namespace webrtc |
OLD | NEW |