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 |
11 #include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_is
acfix.h" | 11 #include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_is
acfix.h" |
12 | 12 |
13 #include "webrtc/common_types.h" | |
14 #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h" | 13 #include "webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h" |
15 | 14 |
16 namespace webrtc { | 15 namespace webrtc { |
17 | 16 |
18 const uint16_t IsacFix::kFixSampleRate; | 17 const uint16_t IsacFix::kFixSampleRate; |
19 | 18 |
20 // Explicit instantiation: | 19 // Explicit instantiation: |
21 template class AudioEncoderIsacT<IsacFix>; | 20 template class AudioEncoderIsacT<IsacFix>; |
22 template class AudioDecoderIsacT<IsacFix>; | 21 template class AudioDecoderIsacT<IsacFix>; |
23 | 22 |
24 namespace { | |
25 AudioEncoderIsacFix::Config CreateConfig(const CodecInst& codec_inst, | |
26 LockedIsacBandwidthInfo* bwinfo) { | |
27 AudioEncoderIsacFix::Config config; | |
28 config.bwinfo = bwinfo; | |
29 config.payload_type = codec_inst.pltype; | |
30 config.sample_rate_hz = codec_inst.plfreq; | |
31 config.frame_size_ms = | |
32 rtc::CheckedDivExact(1000 * codec_inst.pacsize, config.sample_rate_hz); | |
33 if (codec_inst.rate != -1) | |
34 config.bit_rate = codec_inst.rate; | |
35 config.adaptive_mode = (codec_inst.rate == -1); | |
36 return config; | |
37 } | |
38 } // namespace | |
39 | |
40 AudioEncoderMutableIsacFix::AudioEncoderMutableIsacFix( | |
41 const CodecInst& codec_inst, | |
42 LockedIsacBandwidthInfo* bwinfo) | |
43 : AudioEncoderMutableImpl<AudioEncoderIsacFix>( | |
44 CreateConfig(codec_inst, bwinfo)) {} | |
45 | |
46 void AudioEncoderMutableIsacFix::SetMaxPayloadSize(int max_payload_size_bytes) { | |
47 auto conf = config(); | |
48 conf.max_payload_size_bytes = max_payload_size_bytes; | |
49 Reconstruct(conf); | |
50 } | |
51 | |
52 void AudioEncoderMutableIsacFix::SetMaxRate(int max_rate_bps) { | |
53 auto conf = config(); | |
54 conf.max_bit_rate = max_rate_bps; | |
55 Reconstruct(conf); | |
56 } | |
57 | |
58 } // namespace webrtc | 23 } // namespace webrtc |
OLD | NEW |