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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 dtx_enabled_ = false; | 321 dtx_enabled_ = false; |
322 codec_fec_enabled_ = | 322 codec_fec_enabled_ = |
323 codec_fec_enabled_ && codec_owner_.Encoder()->SetFec(codec_fec_enabled_); | 323 codec_fec_enabled_ && codec_owner_.Encoder()->SetFec(codec_fec_enabled_); |
324 int cng_pt = dtx_enabled_ | 324 int cng_pt = dtx_enabled_ |
325 ? CngPayloadType(external_speech_encoder->SampleRateHz()) | 325 ? CngPayloadType(external_speech_encoder->SampleRateHz()) |
326 : -1; | 326 : -1; |
327 int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1; | 327 int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1; |
328 codec_owner_.SetEncoders(external_speech_encoder, cng_pt, vad_mode_, red_pt); | 328 codec_owner_.SetEncoders(external_speech_encoder, cng_pt, vad_mode_, red_pt); |
329 } | 329 } |
330 | 330 |
331 rtc::Maybe<CodecInst> CodecManager::GetCodecInst() const { | 331 rtc::Optional<CodecInst> CodecManager::GetCodecInst() const { |
332 int dummy_id = 0; | 332 int dummy_id = 0; |
333 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, | 333 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, |
334 "SendCodec()"); | 334 "SendCodec()"); |
335 | 335 |
336 if (!codec_owner_.Encoder()) { | 336 if (!codec_owner_.Encoder()) { |
337 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, | 337 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, |
338 "SendCodec Failed, no codec is registered"); | 338 "SendCodec Failed, no codec is registered"); |
339 return rtc::Maybe<CodecInst>(); | 339 return rtc::Optional<CodecInst>(); |
340 } | 340 } |
341 return rtc::Maybe<CodecInst>(send_codec_inst_); | 341 return rtc::Optional<CodecInst>(send_codec_inst_); |
342 } | 342 } |
343 | 343 |
344 bool CodecManager::SetCopyRed(bool enable) { | 344 bool CodecManager::SetCopyRed(bool enable) { |
345 if (enable && codec_fec_enabled_) { | 345 if (enable && codec_fec_enabled_) { |
346 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, | 346 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, |
347 "Codec internal FEC and RED cannot be co-enabled."); | 347 "Codec internal FEC and RED cannot be co-enabled."); |
348 return false; | 348 return false; |
349 } | 349 } |
350 if (enable && RedPayloadType(send_codec_inst_.plfreq) == -1) { | 350 if (enable && RedPayloadType(send_codec_inst_.plfreq) == -1) { |
351 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, | 351 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 case 48000: | 448 case 48000: |
449 return -1; | 449 return -1; |
450 default: | 450 default: |
451 FATAL() << sample_rate_hz << " Hz is not supported"; | 451 FATAL() << sample_rate_hz << " Hz is not supported"; |
452 return -1; | 452 return -1; |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 } // namespace acm2 | 456 } // namespace acm2 |
457 } // namespace webrtc | 457 } // namespace webrtc |
OLD | NEW |