Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/rent_a_codec.cc

Issue 1473563004: Move the stereo-disables-CNG logic from CodecManager to Rent-A-Codec (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698