(conductor.cc:131): InitializePeerConnection
(create_peerconnection_factory.cc:46): CreatePeerConnectionFactory
(audio_processing_impl.cc:340): Create
(audio_processing_impl.cc:397): AudioProcessingImpl
(audio_processing_impl.cc:429): Capture analyzer activated: 0
(audio_processing_impl.cc:448): Initialize
(webrtc_video_engine.cc:480): WebRtcVideoEngine
(webrtc_voice_engine.cc:193): WebRtcVoiceEngine
(peer_connection_factory.cc:88): CreateModularPeerConnectionFactory
(peer_connection_factory.cc:119): PeerConnectionFactory
(peer_connection_factory.cc:160): Initialize
(channel_manager.cc:34): ChannelManager
(channel_manager.cc:119): Init
(webrtc_voice_engine.cc:218): Init
void WebRtcVoiceEngine::Init() {
RTC_LOG(LS_INFO)<< __FUNCTION__;
RTC_DCHECK(worker_thread_checker_.IsCurrent());
// TaskQueue expects to be created/destroyed on the same thread.
low_priority_worker_queue_.reset(
new rtc::TaskQueue(
task_queue_factory_->CreateTaskQueue("rtc-low-prio",
webrtc::TaskQueueFactory::Priority::LOW)));
// Load our audio codec lists.
RTC_LOG(LS_INFO)<< "Supported send codecs in order of preference:";
send_codecs_ = CollectCodecs(encoder_factory_->GetSupportedEncoders());
for (const AudioCodec& codec : send_codecs_) {
RTC_LOG(LS_INFO)<< ToString(codec);
}
RTC_LOG(LS_INFO)<< "Supported recv codecs in order of preference:";
recv_codecs_ = CollectCodecs(decoder_factory_->GetSupportedDecoders());
for (const AudioCodec& codec : recv_codecs_) {
RTC_LOG(LS_INFO)<< ToString(codec);
}
#if defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE)
// No ADM supplied? Create a default one.
if (!adm_) {
adm_ = webrtc::AudioDeviceModule::Create(
webrtc::AudioDeviceModule::kPlatformDefaultAudio, task_queue_factory_);
}
#endif // WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE
RTC_CHECK(adm());
webrtc::adm_helpers::Init(adm());
webrtc::apm_helpers::Init(apm());
// Set up AudioState.
{
webrtc::AudioState::Config config;
if (audio_mixer_) {
config.audio_mixer = audio_mixer_;
} else {
config.audio_mixer = webrtc::AudioMixerImpl::Create();
}
config.audio_processing = apm_;
config.audio_device_module = adm_;
audio_state_ = webrtc::AudioState::Create(config);
}
// Connect the ADM to our audio path.
adm()->RegisterAudioCallback(audio_state()->audio_transport());
// Set default engine options.
{
AudioOptions options;
options.echo_cancellation = true;
options.auto_gain_control = true;
options.noise_suppression = true;
options.highpass_filter = true;
options.stereo_swapping = false;
options.audio_jitter_buffer_max_packets = 200;
options.audio_jitter_buffer_fast_accelerate = false;
options.audio_jitter_buffer_min_delay_ms = 0;
options.audio_jitter_buffer_enable_rtx_handling = false;
options.typing_detection = true;
options.experimental_agc = false;
options.extended_filter_aec = false;
options.delay_agnostic_aec = false;
options.experimental_ns = false;
options.residual_echo_detector = true;
bool error = ApplyOptions(options);
RTC_DCHECK(error);
}
initialized_ = true;
}
create AudioDeviceModule,ADM负责采集audio
adm_ = webrtc::AudioDeviceModule::Create(
webrtc::AudioDeviceModule::kPlatformDefaultAudio, task_queue_factory_);
create AudioMixer,AMD负责做混音,接受的audio需要做混音
config.audio_mixer = webrtc::AudioMixerImpl::Create();
create AudioProcessing,APM负责语音处理
apm在create_peerconnection_factory.cc已经创建了
audio_processing = AudioProcessingBuilder().Create();
总结:CreatePeerConnectionFactory这个函数总共创建和初始化了PeerConnectionFactory,ChannelManager,MediaEngine,AudioState,以及AudioState中的AudioMixer,AudioProcessing,AudioDeviceModule