src\webrtc\examples\peerconnection\client\conductor.cc
1, BOOL Conductor::initializepeerconnection ()
1.1 WEBRTC::createpeerconnectionfactory();
src\talk\app\webrtc\peerconnectionfactory.cc
2, BOOL Peerconnectionfactory::initialize ()
2.1.1 cricket::mediaengineinterface* peerconnectionfactory::createmediaengine_w() {
Return Cricket::webrtcmediaenginefactory::create(Default_adm_.get (), Video_encoder_factory_.get (), video _decoder_factory_.get ());
}
src\talk\media\webrtc\webrtcmediaengine.cc
2.1.2
mediaengineinterface* webrtcmediaenginefactory:: Create (
webrtc::audiodevicemodule* adm,webrtcvideoencoderfactory* encoder_factory,webrtcvideodecoderfactory* Decoder_factory)
{
return createwebrtcmediaengine (ADM, Encoder_factory, decoder_factory);
}
2.1.3
cricket::mediaengineinterface* webrtcmediaenginefactory:: Createwebrtcmediaengine (
webrtc::audiodevicemodule* adm,webrtcvideoencoderfactory* encoder_factory, webrtcvideodecoderfactory* decoder_factory)
{
return new Cricket:: WebRtcMediaEngine2 (ADM, Encoder_factory,
Decoder_factory);
}
2.1.4
Class WebRtcMediaEngine2
: Public compositemediaengine<webrtcvoiceengine, webrtcvideoengine2>
{
Public
WebRtcMediaEngine2 (webrtc::audiodevicemodule* adm,webrtcvideoencoderfactory* encoder_factory, webrtcvideodecoderfactory* decoder_factory)
};
2.1.5
\src\talk\media\webrtc\webrtcvoiceengine.cc
Webrtcvoiceengine::webrtcvoiceengine ()
: Voe_wrapper_ (new Voewrapper ())
{
Construct ();
}
2.1.6
Src\talk\media\webrtc\webrtcvoe.h
Class Voewrapper {
Public
Voewrapper ()
: Engine_ (webrtc::voiceengine::create ())
, Processing_ (Engine_),
Base_ (Engine_), Codec_ (Engine_)
, Dtmf_ (Engine_),
Hw_ (Engine_), Network_ (Engine_)
, Rtp_ (Engine_), Volume_ (Engine_) {}
};
2.1.7
src\webrtc\voice_engine\voice_engine_impl.cc
voiceengine* Voiceengine::create ()
{
return Getvoiceengine (config, true);
}
voiceengine* getvoiceengine (const config* Config, BOOL owns_config)
{
voiceengineimpl* self = new Voiceengineimpl (config, owns_config);
}
2.1.9
Src\webrtc\voice_engine\voice_engine_impl.h
Class Voiceengineimpl:public Voiceengine,
Public Voebaseimpl
{
Voebaseimpl (this);
};
2.1.9
void Webrtcvoiceengine::construct ()
{
Load our audio codec list.
Internal call Voe_wrapper_->codec ()->numofcodecs ()
Constructcodecs ();
Get the need for echo cancellation, noise reduction, automatic volume adjustment, etc.
Options_ = Getdefaultengineoptions ();
}
src\talk\session\media\channelmanager.cc
2.2
BOOL channelmanager::init ()
{
Initialized_ = worker_thread_->invoke<bool> (Bind (
&channelmanager::initmediaengine_w, this));
}
2.2.1
BOOL Channelmanager::initmediaengine_w ()
{
Return (media_engine_->init(worker_thread_));
}
2.2.2
Template<class VOICE, Class video>
Class Compositemediaengine:public Mediaengineinterface
{
Public
virtual bool Init (rtc::thread* worker_thread)
{
if (!voice_. Init (Worker_thread))
return false;
Video_. Init ();
return true;
}
Protected
VOICE Voice_; Default Webrtcvoiceengine or custom audio engine
}
2.2.3
BOOL Webrtcvoiceengine::init (rtc::thread* worker_thread)
{
BOOL res = initinternal ();
}
2.2.4
BOOL Webrtcvoiceengine::initinternal ()
{
if (voe_wrapper_->base ()->init (adm_) = =-1)
}
2.2.5
src\webrtc\voice_engine\voe_base_impl.cc
int voebaseimpl::init(audiodevicemodule* external_adm,audioprocessing* audioproc)
{
if (External_adm = = nullptr)
{
Create the internal ADM implementation.
Shared_->set_audio_device (audiodevicemoduleimpl::create(
Voeid (shared_->instance_id (),-1), Shared_->audio_device_layer ());
}
Else
{
Use the already existing external ADM implementation.
Shared_->set_audio_device (EXTERNAL_ADM);
}
Register the Audioobserver implementation
if (Shared_->audio_device ()->registereventobserver (this)! = 0)
Register the Audiotransport implementation
if (Shared_->audio_device ()->registeraudiocallback (this)! = 0)
ADM initialization
if (Shared_->audio_device ()->init ()! = 0)
Initialize the default speaker
if (Shared_->audio_device ()->setplayoutdevice (webrtc_voice_engine_default_device)! = 0)
if (Shared_->audio_device ()->initspeaker ()! = 0)
Initialize the default microphone
if (Shared_->audio_device ()->setrecordingdevice (webrtc_voice_engine_default_device)! = 0)
if (Shared_->audio_device ()->initmicrophone ()! = 0)
Set Number of channels
if (Shared_->audio_device ()->stereoplayoutisavailable (&available)! = 0)
if (Shared_->audio_device ()->setstereoplayout (available)! = 0)
if (!audioproc) {
Audioproc = Audioprocessing::create ();
}
Shared_->set_audio_processing (AUDIOPROC);
}
WEBRTC audio engine with client create code for the daytime