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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 info.payload_type = config_.payload_type; | 151 info.payload_type = config_.payload_type; |
152 return info; | 152 return info; |
153 } | 153 } |
154 | 154 |
155 template <typename T> | 155 template <typename T> |
156 void AudioEncoderIsacT<T>::Reset() { | 156 void AudioEncoderIsacT<T>::Reset() { |
157 RecreateEncoderInstance(config_); | 157 RecreateEncoderInstance(config_); |
158 } | 158 } |
159 | 159 |
160 template <typename T> | 160 template <typename T> |
161 void AudioEncoderIsacT<T>::SetMaxPayloadSize(int max_payload_size_bytes) { | |
162 auto conf = config_; | |
163 conf.max_payload_size_bytes = max_payload_size_bytes; | |
164 RecreateEncoderInstance(conf); | |
165 } | |
166 | |
167 template <typename T> | |
168 void AudioEncoderIsacT<T>::SetMaxBitrate(int max_rate_bps) { | |
169 auto conf = config_; | |
170 conf.max_bit_rate = max_rate_bps; | |
171 RecreateEncoderInstance(conf); | |
172 } | |
173 | |
174 template <typename T> | |
175 void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) { | 161 void AudioEncoderIsacT<T>::RecreateEncoderInstance(const Config& config) { |
176 CHECK(config.IsOk()); | 162 CHECK(config.IsOk()); |
177 packet_in_progress_ = false; | 163 packet_in_progress_ = false; |
178 bwinfo_ = config.bwinfo; | 164 bwinfo_ = config.bwinfo; |
179 if (isac_state_) | 165 if (isac_state_) |
180 CHECK_EQ(0, T::Free(isac_state_)); | 166 CHECK_EQ(0, T::Free(isac_state_)); |
181 CHECK_EQ(0, T::Create(&isac_state_)); | 167 CHECK_EQ(0, T::Create(&isac_state_)); |
182 CHECK_EQ(0, T::EncoderInit(isac_state_, config.adaptive_mode ? 0 : 1)); | 168 CHECK_EQ(0, T::EncoderInit(isac_state_, config.adaptive_mode ? 0 : 1)); |
183 CHECK_EQ(0, T::SetEncSampRate(isac_state_, config.sample_rate_hz)); | 169 CHECK_EQ(0, T::SetEncSampRate(isac_state_, config.sample_rate_hz)); |
184 const int bit_rate = config.bit_rate == 0 ? kDefaultBitRate : config.bit_rate; | 170 const int bit_rate = config.bit_rate == 0 ? kDefaultBitRate : config.bit_rate; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 275 } |
290 | 276 |
291 template <typename T> | 277 template <typename T> |
292 size_t AudioDecoderIsacT<T>::Channels() const { | 278 size_t AudioDecoderIsacT<T>::Channels() const { |
293 return 1; | 279 return 1; |
294 } | 280 } |
295 | 281 |
296 } // namespace webrtc | 282 } // namespace webrtc |
297 | 283 |
298 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_IMPL_H_ | 284 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_IMPL_H_ |
OLD | NEW |