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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 static_cast<int>(external_speech_encoder->Max10MsFramesInAPacket() * | 312 static_cast<int>(external_speech_encoder->Max10MsFramesInAPacket() * |
313 send_codec_inst_.plfreq), | 313 send_codec_inst_.plfreq), |
314 100); | 314 100); |
315 send_codec_inst_.pltype = -1; // Not valid. | 315 send_codec_inst_.pltype = -1; // Not valid. |
316 send_codec_inst_.rate = -1; // Not valid. | 316 send_codec_inst_.rate = -1; // Not valid. |
317 static const char kName[] = "external"; | 317 static const char kName[] = "external"; |
318 memcpy(send_codec_inst_.plname, kName, sizeof(kName)); | 318 memcpy(send_codec_inst_.plname, kName, sizeof(kName)); |
319 | 319 |
320 if (send_codec_inst_.channels != 1) | 320 if (send_codec_inst_.channels != 1) |
321 dtx_enabled_ = false; | 321 dtx_enabled_ = false; |
322 codec_fec_enabled_ = | 322 if (codec_fec_enabled_) { |
323 codec_fec_enabled_ && codec_owner_.Encoder()->SetFec(codec_fec_enabled_); | 323 // Switch FEC on. On failure, remember that FEC is off. |
| 324 if (!external_speech_encoder->SetFec(true)) |
| 325 codec_fec_enabled_ = false; |
| 326 } else { |
| 327 // Switch FEC off. This shouldn't fail. |
| 328 const bool success = external_speech_encoder->SetFec(false); |
| 329 RTC_DCHECK(success); |
| 330 } |
324 int cng_pt = dtx_enabled_ | 331 int cng_pt = dtx_enabled_ |
325 ? CngPayloadType(external_speech_encoder->SampleRateHz()) | 332 ? CngPayloadType(external_speech_encoder->SampleRateHz()) |
326 : -1; | 333 : -1; |
327 int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1; | 334 int red_pt = red_enabled_ ? RedPayloadType(send_codec_inst_.plfreq) : -1; |
328 codec_owner_.SetEncoders(external_speech_encoder, cng_pt, vad_mode_, red_pt); | 335 codec_owner_.SetEncoders(external_speech_encoder, cng_pt, vad_mode_, red_pt); |
329 } | 336 } |
330 | 337 |
331 rtc::Optional<CodecInst> CodecManager::GetCodecInst() const { | 338 rtc::Optional<CodecInst> CodecManager::GetCodecInst() const { |
332 int dummy_id = 0; | 339 int dummy_id = 0; |
333 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, | 340 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, dummy_id, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 case 48000: | 455 case 48000: |
449 return -1; | 456 return -1; |
450 default: | 457 default: |
451 FATAL() << sample_rate_hz << " Hz is not supported"; | 458 FATAL() << sample_rate_hz << " Hz is not supported"; |
452 return -1; | 459 return -1; |
453 } | 460 } |
454 } | 461 } |
455 | 462 |
456 } // namespace acm2 | 463 } // namespace acm2 |
457 } // namespace webrtc | 464 } // namespace webrtc |
OLD | NEW |