| 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/main/interface/audio_encoder_i
sac.h" | 11 #include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_i
sac.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 // Explicit instantiation: | 17 // Explicit instantiation: |
| 19 template class AudioEncoderIsacT<IsacFloat>; | 18 template class AudioEncoderIsacT<IsacFloat>; |
| 20 template class AudioDecoderIsacT<IsacFloat>; | 19 template class AudioDecoderIsacT<IsacFloat>; |
| 21 | 20 |
| 22 namespace { | |
| 23 AudioEncoderIsac::Config CreateConfig(const CodecInst& codec_inst, | |
| 24 LockedIsacBandwidthInfo* bwinfo) { | |
| 25 AudioEncoderIsac::Config config; | |
| 26 config.bwinfo = bwinfo; | |
| 27 config.payload_type = codec_inst.pltype; | |
| 28 config.sample_rate_hz = codec_inst.plfreq; | |
| 29 config.frame_size_ms = | |
| 30 rtc::CheckedDivExact(1000 * codec_inst.pacsize, config.sample_rate_hz); | |
| 31 if (codec_inst.rate != -1) | |
| 32 config.bit_rate = codec_inst.rate; | |
| 33 config.adaptive_mode = (codec_inst.rate == -1); | |
| 34 return config; | |
| 35 } | |
| 36 } // namespace | |
| 37 | |
| 38 AudioEncoderMutableIsacFloat::AudioEncoderMutableIsacFloat( | |
| 39 const CodecInst& codec_inst, | |
| 40 LockedIsacBandwidthInfo* bwinfo) | |
| 41 : AudioEncoderMutableImpl<AudioEncoderIsac>( | |
| 42 CreateConfig(codec_inst, bwinfo)) { | |
| 43 } | |
| 44 | |
| 45 void AudioEncoderMutableIsacFloat::SetMaxPayloadSize( | |
| 46 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 AudioEncoderMutableIsacFloat::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 | 21 } // namespace webrtc |
| OLD | NEW |