Call在WebRtcVideoChannel2中,如下图:
Call在什么时候创建的呢,我们看下面的代码:
VideoChannel* ChannelManager::CreateVideoChannel_w(
webrtc::MediaControllerInterface* media_controller,
TransportController* transport_controller,
const std::string& content_name,
bool rtcp,
const VideoOptions& options) {
VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel(
media_controller->call_w(), media_controller->config(), options);
if (media_channel == NULL) {
return NULL;
}
可见它是在创建WebRtcVideoChannel2时由media_controller->call_w()创建的,看下call_w()的代码:
//在mediacontroller.cc中
webrtc::Call* call_w() override {
if (!call_) { call_.reset(webrtc::Call::Create(call_config_));
}
return call_.get();
}
//在call.c中
Call* Call::Create(const Call::Config& config) {
return new internal::Call(config);
}
internal::Call(config)为Call的构造函数,里面初始化了非常多的东西,我们先看下Call这个类内部的变量吧: