WEBRTC video engine with client create code for the daytime

Source: Internet
Author: User

src\webrtc\examples\peerconnection\client\conductor.cc
boolconductor::initializepeerconnection()
1 webrtc::createpeerconnectionfactory ();
src\talk\app\webrtc\peerconnectionfactory.cc
1.1 New Rtc::refcountedobject<peerconnectionfactory> ()
1.2 bool Peerconnectionfactory::initialize ()
1.2.1 cricket::mediaengineinterface* media_engine =Peerconnectionfactory::createmediaengine_w()
src\talk\media\webrtc\webrtcmediaengine.cc
1.2.1.1
mediaengineinterface* webrtcmediaenginefactory::create (webrtc::audiodevicemodule* adm,WebRtcVideoEncoderFactory* encoder_factory,webrtcvideodecoderfactory* decoder_factory)
{
Return Createwebrtcmediaengine (ADM, Encoder_factory, decoder_factory);
}
1.2.1.2
cricket::mediaengineinterface* webrtcmediaenginefactory:: Createwebrtcmediaengine (
webrtc::audiodevicemodule* adm,webrtcvideoencoderfactory* encoder_factory,webrtcvideodecoderfactory* Decoder_ Factory
{
return new Cricket::webrtcmediaengine2 (ADM, encoder_factory,decoder_factory);
}
1.2.1.3
ClassWebRtcMediaEngine2: PublicCompositemediaengine<webrtcvoiceengine,WebRtcVideoEngine2>
{
Public
WebRtcMediaEngine2 (webrtc::audiodevicemodule* adm,webrtcvideoencoderfactory* encoder_factory, webrtcvideodecoderfactory* decoder_factory)
};

1.2.1.4
src\talk\media\webrtc\webrtcmediaengine.cc
Webrtcvideoengine2::webrtcvideoengine2 ()
: Initialized_ (False),
External_decoder_factory_ (null),
External_encoder_factory_ (null)
{
Video_ Codecs_ = getsupportedcodecs ();//Get a list of video codecs (with internal default support and externally introduced, up to 8 external)
}
std::vector<videocodec> webrtcvideoengine2::getsupportedcodecs () const
{
//reads the default list of video codecs VP8 ( Default width 640 up to 480 up to 15fps) VP9 (if internal support) H264 (if internal) Rtx Red ulpfec
std::vector<videocodec> supported_codecs = Defaultvideocodeclist () ;
}
1.2.2 Channel_manager_.reset (
new cricket::channelmanager (Media_ Engine, Worker_thread_));
1.2.2.1 constructdataengine{new hybriddataengine (New Rtpdataengine (), New Sctpdataengine ())}
1.2.2.2 new capturemanage R ()
1.2.2.3 audio_options_ = media_engine_->getaudiooptions ();

1.2.3 channel_manager_->init()
1.2.3.1 channelmanager::initmediaengine_w Call Media_engine_->init (worker_thread_)
Template<class VOICE, Class video>

Class Compositemediaengine : Public mediaengineinterface
{
virtual bool Init (rtc::thread* worker_thread)
{
if (!voice_. Init (Worker_thread)) return false;

Video_. Init ();
return true;
}
};
1.2.3.2 setaudiooptions (Audio_options_)
1.2.3.3 Setoutputvolume (audio_output_volume_)
1.2.3.4 Setdefaultvideoencoderconfig (Default_video_encoder_config_)

2 Peer_connection_ =
Peer_connection_factory_->createpeerconnection ()
2.1 Peerconnection::initialize
2.1.1 Parseiceservers (configuration.servers, &stun_config, &turn_config)
2.1.2 Port_allocator_->seticeservers (Cricket_stuns, cricket_turns);
2.1.3 Media_controller_.reset (Factory_->createmediacontroller ());
2.1.4 Remote_stream_factory_.reset (New remotemediastreamfactory)
2.1.5 Session_.reset (New webrtcsession)
2.1.6 Stats_.reset (New Statscollector (this));
2.1.7 Session_->initialize ()
2.1.8 Session_->registericeobserver (this);

2.1.9 Session_->signalstate.connect (this, &peerconnection::onsessionstatechange);
conductor::onsuccess (webrtc::sessiondescriptioninterface* desc)
{
peer_connection_->setlocaldescription(Dummysetsessiondescriptionobserver::create (), DESC);
}
Peerconnection::setlocaldescription ()
{
session_->setlocaldescription(DESC, &error)
}
webrtcsession::setlocaldescription
{
if (action = = Koffer &&! Createchannels(Local_desc_->description ()))
}
BOOL Webrtcsession::createchannels (CONST sessiondescription* DESC)
{
Createvoicechannel (voice)
createvideochannel (VIDEO)->channelmanager::createvideochannel->Channelmanager::createvideochannel_w
Createdatachannel (data)
}
Webrtcsession::setremotedescription similar Setlocaldescription

videochannel* Channelmanager::createvideochannel_w ()
{
videomediachannel* Media_channel =
Media_engine_->createvideochannel is Media_engine_ point WebRtcVideoChannel2
}

class WebRtcVideoChannel2 : Public rtc::messagehandler, publicVideomediachannel,

webrtcvideochannel2* Webrtcvideoengine2::createchannel (webrtc::call* call,const VideoOptions& options)
{
Return new WebRtcVideoChannel2(call, Options, Video_codecs_,external_encoder_factory_, External_decoder_ FACTORY_);

}
videochannel* Video_channel = new Videochannel
Video_channel->init ()
Basechannel::init ()

3 Conductor::addstreams ()
3.1 Peer_connection_factory_->createaudiotrack
3.2 Peer_connection_factory_->createaudiosource
3.3 Peer_connection_factory_->createvideotrack
3.4 Peer_connection_factory_->createvideosource (openvideocapturedevice())
3.5 Peer_connection_factory_->createlocalmediastream (Kstreamlabel)
3.6 Stream->addtrack (Audio_track);

3.7 Stream->addtrack (Video_track);

3.8 Peer_connection_->addstream (Stream)

3.4.1
Rtc::scoped_ptr<cricket::D evicemanagerinterface> Dev_manager
devicemanagerinterface* Devicemanagerfactory::create () {
return new Win32devicemanager ();
}
Class Win32devicemanager:public DeviceManager

Dev_manager->init ()

Dev_manager->getvideocapturedevices (&devs)

Capturer = dev_manager->createvideocapturer(*dev_it)//may be a false capture read from a file

DeviceManager::D Evicemanager ()
{
Setvideodevicecapturerfactory (New Webrtcvideodevicecapturerfactory ()); Assigning Values to Video_device_capturer_factory_
}
videocapturer* devicemanager::createvideocaptureR (const device& Device)
{
rtc::scoped_ptr<
Videodevicecapturerfactory> Video_device_capturer_factory_;
Capturer = video_device_capturer_factory_->create (device);
}
videocapturer* webrtcvideodevicecapturerfactory::create (const device& Device)
{
Rtc::scoped_ptr<webrtcvideocapturer> Capturer (New Webrtcvideocapturer ());

Capturer->init (device)
}
src\talk\media\webrtc\webrtcvideocapturer.cc
Webrtcvideocapturer::webrtcvideocapturer ()

: Factory_ (New Webrtcvcmfactory)
, Module_ (nullptr)
, Captured_frames_ (0)
, Start_thread_ (nullptr)
, Async_invoker_ (nullptr)
{
Set_frame_factory (New Webrtcvideoframefactory ());
}
boolwebrtcvideocapturer::init (const device& Device)
{
Webrtc::videocapturemodule::D eviceinfo* info = factory_->createdeviceinfo (0);
int num_cams = Info->numberofdevices ();
Std::vector<videoformat> supported;
int32_t num_caps = info->numberofcapabilities (vcm_id);
Module_ = factory_->create (0, vcm_id);
SetId (device.id);
Setsupportedformats (supported);
}
src\webrtc\modules\video_capture\video_capture_impl.cc
Class Webrtcvcmfactory:public Webrtcvcmfactoryinterface
{
Virtual Webrtc::videocapturemodule::D eviceinfo* createdeviceinfo (int id)
{
return Webrtc::videocapturefactory::createdeviceinfo (ID);
}
};
src\webrtc\modules\video_capture\video_capture_factory.cc
Videocapturemodule::D eviceinfo* videocapturefactory::createdeviceinfo (
Const int32_t ID)
{

return Videocapturemodule::videocaptureimpl::createdeviceinfo (ID);
}
src\webrtc\modules\video_capture\windows\video_capture_factory_windows.cc
Static

Videocapturemodule::D eviceinfo* videocaptureimpl::createdeviceinfo (
Const int32_t ID)
{
return deviceinfods::create (id);

}

videocapturemodule* videocaptureimpl::create (const int32_t ID, const char* device_id) {
TODO (Tommi): Use Media Foundation implementation for Vista and up.
refcountimpl<videocaptureds>* capture = new refcountimpl<videocaptureds> (ID);
if (Capture->init (ID, device_id)! = 0) {
Delete capture;
capture = NULL;
}
return capture;
}
Src\webrtc\modules\video_capture\windows\device_info_ds.h
Class Deviceinfods:public deviceinfoimpl{
};

3.4.2 New Rtc::refcountedobject<videosource> (Channel_manager,
Capturer));
3.4.3 source->initialize (constraints);
3.4.3.1 std::vector<cricket::videoformat> formats =
Channel_manager_->getsupportedformats (video_ Capturer_.get ());
3.4.3.2 Channel_manager_->startvideocapture (Video_capturer_.get (), Format_)
3.4.3.2.1 registervideocapturer (video_capturer)
3.4.3.2.2 startwithbestcaptureformat{video_capturer->startcapturing}
Bool Capturemanager::registervideocapturer ( videocapturer* video_capturer)
{
videocapturerstate* capture_state =  Videocapturerstate::create (video_capturer);
}
//static

videocapturerstate* videocapturerstate::create (videocapturer* video_capturer)
{
capturerenderadapter* adapter = capturerenderadapter::create (video_capturer);
return new videocapturerstate (adapter) ;
}
capturerenderadapter* capturerenderadapter::create (
videocapturer* video_capturer)
{
capturerenderadapter* return_value = new capturerenderadapter (video_capturer) ;

Return_value->init (); Can ' t fail.
return return_value;
}
void Capturerenderadapter::init () {
Video_capturer_->signalvideoframe.connect (This,&capturerenderadapter::onvideoframe);
}
void Capturerenderadapter::onvideoframe (videocapturer* capturer,
Const videoframe* Video_frame)
{
For (videorenderers::iterator iter = Video_renderers_.begin ();
Iter! = Video_renderers_.end (); ++iter)
{
videorenderer* Video_renderer = iter->renderer;
Video_renderer->renderframe (Video_frame);
}
}

BOOL Webrtcvideochannel2::addsendstream (const streamparams& SP)
{
New Webrtcvideosendstream
}
BOOL Webrtcvideochannel2::addrecvstream (const streamparams& SP,
BOOL Default_stream)
{
New Webrtcvideoreceivestream
}

WEBRTC video engine with client create code for the daytime

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.