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

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

Issue 1406123011: Let AudioCodingModule::SendCodec return Maybe<CodecInst> (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review fix Created 5 years, 1 month 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
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 dtx_enabled_ = false; 330 dtx_enabled_ = false;
331 codec_fec_enabled_ = 331 codec_fec_enabled_ =
332 codec_fec_enabled_ && codec_owner_.Encoder()->SetFec(codec_fec_enabled_); 332 codec_fec_enabled_ && codec_owner_.Encoder()->SetFec(codec_fec_enabled_);
333 int cng_pt = dtx_enabled_ 333 int cng_pt = dtx_enabled_
334 ? CngPayloadType(external_speech_encoder->SampleRateHz()) 334 ? CngPayloadType(external_speech_encoder->SampleRateHz())
335 : -1; 335 : -1;
336 int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1; 336 int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1;
337 codec_owner_.SetEncoders(external_speech_encoder, cng_pt, vad_mode_, red_pt); 337 codec_owner_.SetEncoders(external_speech_encoder, cng_pt, vad_mode_, red_pt);
338 } 338 }
339 339
340 int CodecManager::GetCodecInst(CodecInst* current_codec) const { 340 rtc::Maybe<CodecInst> CodecManager::GetCodecInst() const {
341 int dummy_id = 0; 341 int dummy_id = 0;
342 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, 342 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id,
343 "SendCodec()"); 343 "SendCodec()");
344 344
345 if (!codec_owner_.Encoder()) { 345 if (!codec_owner_.Encoder()) {
346 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, 346 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id,
347 "SendCodec Failed, no codec is registered"); 347 "SendCodec Failed, no codec is registered");
348 return -1; 348 return rtc::Maybe<CodecInst>();
349 } 349 }
350 *current_codec = send_codec_inst_; 350 return rtc::Maybe<CodecInst>(send_codec_inst_);
351 return 0;
352 } 351 }
353 352
354 bool CodecManager::SetCopyRed(bool enable) { 353 bool CodecManager::SetCopyRed(bool enable) {
355 if (enable && codec_fec_enabled_) { 354 if (enable && codec_fec_enabled_) {
356 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, 355 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0,
357 "Codec internal FEC and RED cannot be co-enabled."); 356 "Codec internal FEC and RED cannot be co-enabled.");
358 return false; 357 return false;
359 } 358 }
360 if (enable && RedPayloadType(send_codec_inst_.plfreq) == -1) { 359 if (enable && RedPayloadType(send_codec_inst_.plfreq) == -1) {
361 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, 360 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 case 48000: 455 case 48000:
457 return -1; 456 return -1;
458 default: 457 default:
459 FATAL() << sample_rate_hz << " Hz is not supported"; 458 FATAL() << sample_rate_hz << " Hz is not supported";
460 return -1; 459 return -1;
461 } 460 }
462 } 461 }
463 462
464 } // namespace acm2 463 } // namespace acm2
465 } // namespace webrtc 464 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.h ('k') | webrtc/modules/audio_coding/main/include/audio_coding_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698