WEBRTC Voice Overall framework

Source: Internet
Author: User
WEBRTC Voice Overall framework

Figure One voice overall frame diagram

As shown above, the entire processing frame of the audio is responsible for the transmission of the peer data in addition to the Ligjingle, mainly the Voe (Voice Engine) and the channel adaptation layer

Figure II Creating a data communication channel timing diagram

The image above is the local side

Complete process, Voe is created by Createmediaengine_w, the channel adaptation layer is created by setlocaldescription based on the SDP, and the following analysis of the two processes Voe the creation process

/*src\talk\app\webrtc\peerconnectionfactory.cc*/bool Peerconnectionfactory::initialize () {... default_
  Allocator_factory_ = Portallocatorfactory::create (Worker_thread_); ..... cricket::mediaengineinterface* Media_engine = worker_thread_->invoke<cricket::mediaengineinterface*&
      gt; (Rtc::bind (&peerconnectionfactory::createmediaengine_w, this)); The defined macro is actually running Createmediaengine_w on the Worker_thread_ thread ... channel_manager_.reset (new Cricket::channelmanag
  ER (media_engine, worker_thread_));

......
} cricket::mediaengineinterface* Peerconnectionfactory::createmediaengine_w () {ASSERT (Worker_thread_ = = Rtc::Thread:
  : current ()); Return Cricket::webrtcmediaenginefactory::create (Default_adm_.get (), Video_encoder_factory_.get (), Video_deco
Der_factory_.get ()); } mediaengineinterface* webrtcmediaenginefactory::create (webrtc::audiodevicemodule* ADM, WebRtcVideoEncoderFacto ry* Encoder_factory, Webrtcvideodecoderfactory* decoder_factory) {return createwebrtcmediaengine (ADM, Encoder_factory, decoder_factory);}// Createwebrtcmediaengine is actually WebRtcMediaEngine2, and WebRtcMediaEngine2 inherits to Compositemediaengine//template class, Implementation at webrtcmediaengine.cc namespace cricket {class Webrtcmediaengine2:public Compositemediaengine<webrtcvoiceeng INE, webrtcvideoengine2> {public:webrtcmediaengine2 (webrtc::audiodevicemodule* adm, Webrtcvid eoencoderfactory* encoder_factory, webrtcvideodecoderfactory* decoder_factory) {Voice_.
    Setaudiodevicemodule (ADM); Video_.
    Setexternaldecoderfactory (decoder_factory); Video_.
  Setexternalencoderfactory (encoder_factory);

}
};  }//Namespace cricket Template<class VOICE, class video> class Compositemediaengine:public Mediaengineinterface {public:virtual ~compositemediaengine () {} virtual bool Init (rtc::thread* worker_thread) {if (!voice_. Init (Worker_thread))//The voice here is Webrtcvoiceengine return FAlse; Video_. Init ();
  Video for WebRtcVideoEngine2 back to parse return true;

   
   
    
    }

......

}
    
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2
    
    2 23 24 25 26 27 28 29 30 31 32
    
    33 34 35 36 37 38 39 40 41 42
    
    43 44 45 46 47 48 49 50 51 52
    
    53 54 55 56 57 58 59 60 61 62
    
    63 1 2 3 4 5 6 7 8 9
  10 11 12  
    13 14 15 16 17 18 19 20 21 22
    
    23 24 25 26 27 28 29 30 31 32
    
    33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 5
   
    3 54 55 56 57 58 59 60 61 62 63

The related class diagram is as follows:

Figure three Voe engine class diagram

Webrtcvoiceengine::webrtcvoiceengine ()
    : Voe_wrapper_ (New Voewrapper ()),//The underlying voice engine proxy class, which is called by the upper layer associated with the underlying layer to complete
      Tracing_ (New Voetracewrapper ()),//debug related Class
      adm_ (NULL),
      Log_filter_ (Severitytofilter ( kdefaultlogseverity)),
      Is_dumping_aec_ (false) {
  Construct ();
}
   
   
    
    1
    
    2
    
    3
    
    4
    
    5
    
    6
    
    7
    
    8
   
   
   
   
    
    1
    
    2
    
    3
    
    4
    
    5
    
    6
    
    7
    
    8
   
   

Here's a look at the classes and methods related to constructing Webrtcvoiceengine:

Voewrapper is actually voiceengine--> voice_engine_impl.cc's agent/* webrtcvoe.h */class Voewrapper {Public:voewrapper () : Engine_ (Webrtc::voiceengine::create ()), Processing_ (Engine_), Base_ (Engine_), Codec_ (Engine_), Dtmf_ (Engine_)

, Hw_ (Engine_), Neteq_ (Engine_), Network_ (Engine_), Rtp_ (Engine_), sync_ (Engine_), Volume_ (Engine_) {} /*webrtcvoiceengine.cc*/void Webrtcvoiceengine::construct () {...//Register engine status callback function to inform Webrtcvoiceengine if (VO) of the underlying error message
  E_wrapper_->base ()->registervoiceengineobserver (*this) = =-1) {log_rtcerr0 (registervoiceengineobserver);
  } ....//Load our audio codec list. Constructcodecs (); According to the Kcodecprefs table, the sound quality from high to low, from the bottom to obtain the highest sound quality codec ... options_ = Getdefaultengineoptions ();

Set the default audio options, need echo cancellation, noise reduction, automatic volume adjustment, whether dump is required ...} Webrtcvoiceengine initialization function bool Webrtcvoiceengine::init (rtc::thread* worker_thread) {... bool res = initinternal ();.

.....
} BOOL Webrtcvoiceengine::initinternal () {...//initialize the underlying AUDiodevicemodule in WebRTC, the parameter dbm_ is passed null here. Voe_wrapper_ is Voiceengine's proxy class implemented in voice_engine_impl.cc,//And Voiceengineimpl inherits to Voiceengine, Creat is created when VOICEENGINEIMPL//is implemented in voe_base_impl.cc//And the object is returned to Voewrapper//Here Voe_wrapper_->base () is actually voic 
    Eengineimpl object, the following analysis Voiceengineimpl.init if (Voe_wrapper_->base ()->init (adm_) = =-1) {//voe_wrapper_->base ()
    ......
  }
......
} /*voe_base_impl.cc*/int Voebaseimpl::init (audiodevicemodule* external_adm, audioprocessing* audiopr OC) {...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.