OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 AudioEncoder* RentACodec::RentEncoderStack(AudioEncoder* speech_encoder, | 252 AudioEncoder* RentACodec::RentEncoderStack(AudioEncoder* speech_encoder, |
253 StackParameters* param) { | 253 StackParameters* param) { |
254 RTC_DCHECK(speech_encoder); | 254 RTC_DCHECK(speech_encoder); |
255 | 255 |
256 auto pt = [&speech_encoder](const std::map<int, int>& m) { | 256 auto pt = [&speech_encoder](const std::map<int, int>& m) { |
257 auto it = m.find(speech_encoder->SampleRateHz()); | 257 auto it = m.find(speech_encoder->SampleRateHz()); |
258 return it == m.end() ? rtc::Optional<int>() | 258 return it == m.end() ? rtc::Optional<int>() |
259 : rtc::Optional<int>(it->second); | 259 : rtc::Optional<int>(it->second); |
260 }; | 260 }; |
261 auto cng_pt = pt(param->cng_payload_types); | 261 auto cng_pt = pt(param->cng_payload_types); |
262 param->use_cng = param->use_cng && cng_pt; | 262 param->use_cng = |
| 263 param->use_cng && cng_pt && speech_encoder->NumChannels() == 1; |
263 auto red_pt = pt(param->red_payload_types); | 264 auto red_pt = pt(param->red_payload_types); |
264 param->use_red = param->use_red && red_pt; | 265 param->use_red = param->use_red && red_pt; |
265 | 266 |
266 if (param->use_cng || param->use_red) { | 267 if (param->use_cng || param->use_red) { |
267 // The RED and CNG encoders need to be in sync with the speech encoder, so | 268 // The RED and CNG encoders need to be in sync with the speech encoder, so |
268 // reset the latter to ensure its buffer is empty. | 269 // reset the latter to ensure its buffer is empty. |
269 speech_encoder->Reset(); | 270 speech_encoder->Reset(); |
270 } | 271 } |
271 encoder_stack_ = speech_encoder; | 272 encoder_stack_ = speech_encoder; |
272 if (param->use_red) { | 273 if (param->use_red) { |
(...skipping 13 matching lines...) Expand all Loading... |
286 } | 287 } |
287 | 288 |
288 AudioDecoder* RentACodec::RentIsacDecoder() { | 289 AudioDecoder* RentACodec::RentIsacDecoder() { |
289 if (!isac_decoder_) | 290 if (!isac_decoder_) |
290 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); | 291 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); |
291 return isac_decoder_.get(); | 292 return isac_decoder_.get(); |
292 } | 293 } |
293 | 294 |
294 } // namespace acm2 | 295 } // namespace acm2 |
295 } // namespace webrtc | 296 } // namespace webrtc |
OLD | NEW |