OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 {kRedCodecName, 8000, 1, 127, false, {}}, | 513 {kRedCodecName, 8000, 1, 127, false, {}}, |
514 {kDtmfCodecName, 8000, 1, 126, false, {}}, | 514 {kDtmfCodecName, 8000, 1, 126, false, {}}, |
515 }; | 515 }; |
516 } // namespace { | 516 } // namespace { |
517 | 517 |
518 bool WebRtcVoiceEngine::ToCodecInst(const AudioCodec& in, | 518 bool WebRtcVoiceEngine::ToCodecInst(const AudioCodec& in, |
519 webrtc::CodecInst* out) { | 519 webrtc::CodecInst* out) { |
520 return WebRtcVoiceCodecs::ToCodecInst(in, out); | 520 return WebRtcVoiceCodecs::ToCodecInst(in, out); |
521 } | 521 } |
522 | 522 |
523 WebRtcVoiceEngine::WebRtcVoiceEngine(webrtc::AudioDeviceModule* adm) | 523 WebRtcVoiceEngine::WebRtcVoiceEngine( |
524 : WebRtcVoiceEngine(adm, new VoEWrapper()) { | 524 webrtc::AudioDeviceModule* adm, |
| 525 std::shared_ptr<webrtc::AudioDecoderFactory> decoder_factory) |
| 526 : WebRtcVoiceEngine(adm, decoder_factory, new VoEWrapper()) { |
525 audio_state_ = webrtc::AudioState::Create(MakeAudioStateConfig(voe())); | 527 audio_state_ = webrtc::AudioState::Create(MakeAudioStateConfig(voe())); |
526 } | 528 } |
527 | 529 |
528 WebRtcVoiceEngine::WebRtcVoiceEngine(webrtc::AudioDeviceModule* adm, | 530 WebRtcVoiceEngine::WebRtcVoiceEngine( |
529 VoEWrapper* voe_wrapper) | 531 webrtc::AudioDeviceModule* adm, |
| 532 std::shared_ptr<webrtc::AudioDecoderFactory> decoder_factory, |
| 533 VoEWrapper* voe_wrapper) |
530 : adm_(adm), voe_wrapper_(voe_wrapper) { | 534 : adm_(adm), voe_wrapper_(voe_wrapper) { |
531 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 535 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
532 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; | 536 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; |
533 RTC_DCHECK(voe_wrapper); | 537 RTC_DCHECK(voe_wrapper); |
534 | 538 |
535 signal_thread_checker_.DetachFromThread(); | 539 signal_thread_checker_.DetachFromThread(); |
536 | 540 |
537 // Load our audio codec list. | 541 // Load our audio codec list. |
538 LOG(LS_INFO) << "Supported codecs in order of preference:"; | 542 LOG(LS_INFO) << "Supported codecs in order of preference:"; |
539 codecs_ = WebRtcVoiceCodecs::SupportedCodecs(); | 543 codecs_ = WebRtcVoiceCodecs::SupportedCodecs(); |
540 for (const AudioCodec& codec : codecs_) { | 544 for (const AudioCodec& codec : codecs_) { |
541 LOG(LS_INFO) << ToString(codec); | 545 LOG(LS_INFO) << ToString(codec); |
542 } | 546 } |
543 | 547 |
544 voe_config_.Set<webrtc::VoicePacing>(new webrtc::VoicePacing(true)); | 548 voe_config_.Set<webrtc::VoicePacing>(new webrtc::VoicePacing(true)); |
545 | 549 |
546 // Temporarily turn logging level up for the Init() call. | 550 // Temporarily turn logging level up for the Init() call. |
547 webrtc::Trace::SetTraceCallback(this); | 551 webrtc::Trace::SetTraceCallback(this); |
548 webrtc::Trace::set_level_filter(kElevatedTraceFilter); | 552 webrtc::Trace::set_level_filter(kElevatedTraceFilter); |
549 LOG(LS_INFO) << webrtc::VoiceEngine::GetVersionString(); | 553 LOG(LS_INFO) << webrtc::VoiceEngine::GetVersionString(); |
550 RTC_CHECK_EQ(0, voe_wrapper_->base()->Init(adm_.get())); | 554 RTC_CHECK_EQ(0, voe_wrapper_->base()->Init(adm_.get(), nullptr, |
| 555 std::move(decoder_factory))); |
551 webrtc::Trace::set_level_filter(kDefaultTraceFilter); | 556 webrtc::Trace::set_level_filter(kDefaultTraceFilter); |
552 | 557 |
553 // No ADM supplied? Get the default one from VoE. | 558 // No ADM supplied? Get the default one from VoE. |
554 if (!adm_) { | 559 if (!adm_) { |
555 adm_ = voe_wrapper_->base()->audio_device_module(); | 560 adm_ = voe_wrapper_->base()->audio_device_module(); |
556 } | 561 } |
557 RTC_DCHECK(adm_); | 562 RTC_DCHECK(adm_); |
558 | 563 |
559 // Save the default AGC configuration settings. This must happen before | 564 // Save the default AGC configuration settings. This must happen before |
560 // calling ApplyOptions or the default will be overwritten. | 565 // calling ApplyOptions or the default will be overwritten. |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2556 } | 2561 } |
2557 } else { | 2562 } else { |
2558 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2563 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
2559 engine()->voe()->base()->StopPlayout(channel); | 2564 engine()->voe()->base()->StopPlayout(channel); |
2560 } | 2565 } |
2561 return true; | 2566 return true; |
2562 } | 2567 } |
2563 } // namespace cricket | 2568 } // namespace cricket |
2564 | 2569 |
2565 #endif // HAVE_WEBRTC_VOICE | 2570 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |