Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: webrtc/pc/channelmanager.cc

Issue 2614263002: Remove BaseChannel's dependency on TransportController. (Closed)
Patch Set: Fix the channel_unittests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/pc/channel.cc ('K') | « webrtc/pc/channel_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/channelmanager.cc
diff --git a/webrtc/pc/channelmanager.cc b/webrtc/pc/channelmanager.cc
index a0b3609ecfc89ee61f733082528514007348170a..4c3c8976a2a58659b4c2cfcbb3b5c6883ecf4067 100644
--- a/webrtc/pc/channelmanager.cc
+++ b/webrtc/pc/channelmanager.cc
@@ -237,16 +237,29 @@ VoiceChannel* ChannelManager::CreateVoiceChannel_w(
ASSERT(initialized_);
ASSERT(worker_thread_ == rtc::Thread::Current());
ASSERT(nullptr != media_controller);
+
VoiceMediaChannel* media_channel = media_engine_->CreateChannel(
media_controller->call_w(), media_controller->config(), options);
if (!media_channel)
return nullptr;
+ rtc::Thread* signaling_thread =
+ transport_controller ? transport_controller->signaling_thread() : nullptr;
VoiceChannel* voice_channel = new VoiceChannel(
- worker_thread_, network_thread_, media_engine_.get(), media_channel,
- transport_controller, content_name, rtcp, srtp_required);
+ worker_thread_, network_thread_, signaling_thread, media_engine_.get(),
+ media_channel, content_name, rtcp, srtp_required);
voice_channel->SetCryptoOptions(crypto_options_);
- if (!voice_channel->Init_w(bundle_transport_name)) {
+ std::string transport_name =
+ bundle_transport_name ? *bundle_transport_name : content_name;
+ TransportChannel* rtp_transport =
+ transport_controller->CreateTransportChannel(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
+ TransportChannel* rtcp_transport =
+ rtcp
+ ? transport_controller->CreateTransportChannel(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP)
+ : nullptr;
Taylor Brandstetter 2017/01/09 22:50:42 Could this code be moved to WebRtcSession? That wo
Zhi Huang 2017/01/12 03:47:46 Done.
+ if (!voice_channel->Init_w(rtp_transport, rtcp_transport)) {
delete voice_channel;
return nullptr;
}
@@ -308,11 +321,23 @@ VideoChannel* ChannelManager::CreateVideoChannel_w(
return NULL;
}
+ rtc::Thread* signaling_thread =
+ transport_controller ? transport_controller->signaling_thread() : nullptr;
VideoChannel* video_channel =
- new VideoChannel(worker_thread_, network_thread_, media_channel,
- transport_controller, content_name, rtcp, srtp_required);
+ new VideoChannel(worker_thread_, network_thread_, signaling_thread,
+ media_channel, content_name, rtcp, srtp_required);
video_channel->SetCryptoOptions(crypto_options_);
- if (!video_channel->Init_w(bundle_transport_name)) {
+ std::string transport_name =
+ bundle_transport_name ? *bundle_transport_name : content_name;
+ TransportChannel* rtp_transport =
+ transport_controller->CreateTransportChannel(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
+ TransportChannel* rtcp_transport =
+ rtcp
+ ? transport_controller->CreateTransportChannel(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP)
+ : nullptr;
+ if (!video_channel->Init_w(rtp_transport, rtcp_transport)) {
delete video_channel;
return NULL;
}
@@ -380,14 +405,25 @@ DataChannel* ChannelManager::CreateDataChannel_w(
<< data_channel_type;
return NULL;
}
-
+ rtc::Thread* signaling_thread =
+ transport_controller ? transport_controller->signaling_thread() : nullptr;
// Only RTP data channels need SRTP.
srtp_required = srtp_required && data_channel_type == DCT_RTP;
DataChannel* data_channel =
- new DataChannel(worker_thread_, network_thread_, media_channel,
- transport_controller, content_name, rtcp, srtp_required);
+ new DataChannel(worker_thread_, network_thread_, signaling_thread,
+ media_channel, content_name, rtcp, srtp_required);
+ std::string transport_name =
+ bundle_transport_name ? *bundle_transport_name : content_name;
+ TransportChannel* rtp_transport =
+ transport_controller->CreateTransportChannel(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP);
+ TransportChannel* rtcp_transport =
+ rtcp
+ ? transport_controller->CreateTransportChannel(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP)
+ : nullptr;
data_channel->SetCryptoOptions(crypto_options_);
- if (!data_channel->Init_w(bundle_transport_name)) {
+ if (!data_channel->Init_w(rtp_transport, rtcp_transport)) {
LOG(LS_WARNING) << "Failed to init data channel.";
delete data_channel;
return NULL;
« webrtc/pc/channel.cc ('K') | « webrtc/pc/channel_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698