Index: talk/app/webrtc/webrtcsession.cc |
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc |
index 838ad93af1920689240a6b7cae7eadb42fca27b1..23393211e2f0f957586191a34c7ccf1192a536ad 100644 |
--- a/talk/app/webrtc/webrtcsession.cc |
+++ b/talk/app/webrtc/webrtcsession.cc |
@@ -551,16 +551,18 @@ WebRtcSession::~WebRtcSession() { |
// voice_channel_. |
if (video_channel_) { |
SignalVideoChannelDestroyed(); |
+ media_controller_->set_video_channel(nullptr); |
channel_manager_->DestroyVideoChannel(video_channel_.release()); |
} |
if (voice_channel_) { |
SignalVoiceChannelDestroyed(); |
- channel_manager_->DestroyVoiceChannel(voice_channel_.release(), nullptr); |
+ channel_manager_->DestroyVoiceChannel(voice_channel_.release()); |
} |
if (data_channel_) { |
SignalDataChannelDestroyed(); |
channel_manager_->DestroyDataChannel(data_channel_.release()); |
} |
+ media_controller_.reset(nullptr); |
for (size_t i = 0; i < saved_candidates_.size(); ++i) { |
delete saved_candidates_[i]; |
} |
@@ -768,6 +770,10 @@ bool WebRtcSession::Initialize( |
cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE); |
} |
+ media_controller_.reset( |
+ new MediaController(worker_thread(), |
+ channel_manager_->media_engine()->GetVoE())); |
+ |
return true; |
} |
@@ -1678,6 +1684,7 @@ void WebRtcSession::RemoveUnusedChannelsAndTransports( |
mediastream_signaling_->OnVideoChannelClose(); |
SignalVideoChannelDestroyed(); |
const std::string content_name = video_channel_->content_name(); |
+ media_controller_->set_video_channel(nullptr); |
channel_manager_->DestroyVideoChannel(video_channel_.release()); |
DestroyTransportProxy(content_name); |
} |
@@ -1688,8 +1695,7 @@ void WebRtcSession::RemoveUnusedChannelsAndTransports( |
mediastream_signaling_->OnAudioChannelClose(); |
SignalVoiceChannelDestroyed(); |
const std::string content_name = voice_channel_->content_name(); |
- channel_manager_->DestroyVoiceChannel(voice_channel_.release(), |
- video_channel_.get()); |
+ channel_manager_->DestroyVoiceChannel(voice_channel_.release()); |
DestroyTransportProxy(content_name); |
} |
@@ -1704,7 +1710,7 @@ void WebRtcSession::RemoveUnusedChannelsAndTransports( |
} |
} |
-// TODO(mallinath) - Add a correct error code if the channels are not creatued |
+// TODO(mallinath) - Add a correct error code if the channels are not created |
// due to BUNDLE is enabled but rtcp-mux is disabled. |
bool WebRtcSession::CreateChannels(const SessionDescription* desc) { |
// Creating the media channels and transport proxies. |
@@ -1763,8 +1769,8 @@ bool WebRtcSession::CreateChannels(const SessionDescription* desc) { |
} |
bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { |
- voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
- this, content->name, true, audio_options_)); |
+ voice_channel_.reset(channel_manager_->CreateVoiceChannel(this, content->name, |
+ true, media_controller_->call(), audio_options_)); |
if (!voice_channel_) { |
return false; |
} |
@@ -1775,11 +1781,12 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { |
} |
bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { |
- video_channel_.reset(channel_manager_->CreateVideoChannel( |
- this, content->name, true, video_options_, voice_channel_.get())); |
+ video_channel_.reset(channel_manager_->CreateVideoChannel(this, content->name, |
+ true, media_controller_->call(), video_options_)); |
if (!video_channel_) { |
return false; |
} |
+ media_controller_->set_video_channel(video_channel_.get()); |
video_channel_->SignalDtlsSetupFailure.connect( |
this, &WebRtcSession::OnDtlsSetupFailure); |