Index: webrtc/pc/channelmanager.cc |
diff --git a/webrtc/pc/channelmanager.cc b/webrtc/pc/channelmanager.cc |
index 255730a0ba4a9da381337c4c589b7f682b06205b..23da7f42012c27637e1bc48a91e445efe85ea431 100644 |
--- a/webrtc/pc/channelmanager.cc |
+++ b/webrtc/pc/channelmanager.cc |
@@ -218,11 +218,13 @@ VoiceChannel* ChannelManager::CreateVoiceChannel( |
const std::string& content_name, |
const std::string* bundle_transport_name, |
bool rtcp, |
+ bool secure_required, |
const AudioOptions& options) { |
return worker_thread_->Invoke<VoiceChannel*>( |
- RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this, |
- media_controller, transport_controller, content_name, |
- bundle_transport_name, rtcp, options)); |
+ RTC_FROM_HERE, |
+ Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, |
+ transport_controller, content_name, bundle_transport_name, rtcp, |
+ secure_required, options)); |
} |
VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
@@ -231,6 +233,7 @@ VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
const std::string& content_name, |
const std::string* bundle_transport_name, |
bool rtcp, |
+ bool secure_required, |
const AudioOptions& options) { |
ASSERT(initialized_); |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
@@ -240,9 +243,9 @@ VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
if (!media_channel) |
return nullptr; |
- VoiceChannel* voice_channel = |
- new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), |
- media_channel, transport_controller, content_name, rtcp); |
+ VoiceChannel* voice_channel = new VoiceChannel( |
+ worker_thread_, network_thread_, media_engine_.get(), media_channel, |
+ transport_controller, content_name, rtcp, secure_required); |
voice_channel->SetCryptoOptions(crypto_options_); |
if (!voice_channel->Init_w(bundle_transport_name)) { |
delete voice_channel; |
@@ -281,11 +284,13 @@ VideoChannel* ChannelManager::CreateVideoChannel( |
const std::string& content_name, |
const std::string* bundle_transport_name, |
bool rtcp, |
+ bool secure_required, |
const VideoOptions& options) { |
return worker_thread_->Invoke<VideoChannel*>( |
- RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this, |
- media_controller, transport_controller, content_name, |
- bundle_transport_name, rtcp, options)); |
+ RTC_FROM_HERE, |
+ Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, |
+ transport_controller, content_name, bundle_transport_name, rtcp, |
+ secure_required, options)); |
} |
VideoChannel* ChannelManager::CreateVideoChannel_w( |
@@ -294,6 +299,7 @@ VideoChannel* ChannelManager::CreateVideoChannel_w( |
const std::string& content_name, |
const std::string* bundle_transport_name, |
bool rtcp, |
+ bool secure_required, |
const VideoOptions& options) { |
ASSERT(initialized_); |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
@@ -304,9 +310,9 @@ VideoChannel* ChannelManager::CreateVideoChannel_w( |
return NULL; |
} |
- VideoChannel* video_channel = |
- new VideoChannel(worker_thread_, network_thread_, media_channel, |
- transport_controller, content_name, rtcp); |
+ VideoChannel* video_channel = new VideoChannel( |
+ worker_thread_, network_thread_, media_channel, transport_controller, |
+ content_name, rtcp, secure_required); |
video_channel->SetCryptoOptions(crypto_options_); |
if (!video_channel->Init_w(bundle_transport_name)) { |
delete video_channel; |
@@ -345,11 +351,13 @@ DataChannel* ChannelManager::CreateDataChannel( |
const std::string& content_name, |
const std::string* bundle_transport_name, |
bool rtcp, |
+ bool secure_required, |
DataChannelType channel_type) { |
return worker_thread_->Invoke<DataChannel*>( |
RTC_FROM_HERE, |
Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, |
- content_name, bundle_transport_name, rtcp, channel_type)); |
+ content_name, bundle_transport_name, rtcp, secure_required, |
+ channel_type)); |
} |
DataChannel* ChannelManager::CreateDataChannel_w( |
@@ -357,6 +365,7 @@ DataChannel* ChannelManager::CreateDataChannel_w( |
const std::string& content_name, |
const std::string* bundle_transport_name, |
bool rtcp, |
+ bool secure_required, |
DataChannelType data_channel_type) { |
// This is ok to alloc from a thread other than the worker thread. |
ASSERT(initialized_); |
@@ -368,9 +377,11 @@ DataChannel* ChannelManager::CreateDataChannel_w( |
return NULL; |
} |
- DataChannel* data_channel = |
- new DataChannel(worker_thread_, network_thread_, media_channel, |
- transport_controller, content_name, rtcp); |
+ // Only RTP data channels need SRTP. |
+ secure_required = secure_required && data_channel_type == DCT_RTP; |
+ DataChannel* data_channel = new DataChannel( |
+ worker_thread_, network_thread_, media_channel, transport_controller, |
+ content_name, rtcp, secure_required); |
data_channel->SetCryptoOptions(crypto_options_); |
if (!data_channel->Init_w(bundle_transport_name)) { |
LOG(LS_WARNING) << "Failed to init data channel."; |