Index: webrtc/api/webrtcsession.cc |
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc |
index 9f84840822fce12c4c9012b568e10c0b3b4e651b..bce5a0b7c315341ae962924de1647478219783cd 100644 |
--- a/webrtc/api/webrtcsession.cc |
+++ b/webrtc/api/webrtcsession.cc |
@@ -1727,13 +1727,44 @@ void WebRtcSession::RemoveUnusedChannels(const SessionDescription* desc) { |
} |
} |
+// Returns the name of the transport channel when BUNDLE is enabled. |
+const std::string& WebRtcSession::GetTransportForChannel( |
pthatcher1
2016/05/11 06:20:39
Why not, instead, return a const pointer that is N
|
+ const cricket::ContentInfo* content, |
+ const cricket::ContentGroup* bundle) { |
+ if (!bundle) { |
+ return content->name; |
+ } |
+ const std::string* first_content_name = bundle->FirstContentName(); |
+ if (!first_content_name) { |
+ LOG(LS_WARNING) << "Tried to BUNDLE with no contents."; |
+ return content->name; |
+ } |
+ |
+ const std::string& transport_name = *first_content_name; |
+ if (bundle->HasContentName(content->name)) { |
+ LOG(LS_INFO) << "Bundling " << content->name << " on " << transport_name; |
+ return transport_name; |
+ } |
+ return content->name; |
+} |
+ |
// TODO(mallinath) - Add a correct error code if the channels are not created |
skvlad
2016/05/11 22:24:19
This TODO seems to not apply - there is a check fo
|
// due to BUNDLE is enabled but rtcp-mux is disabled. |
bool WebRtcSession::CreateChannels(const SessionDescription* desc) { |
+ const cricket::ContentGroup* bundle_group = nullptr; |
+ if (bundle_policy_ == PeerConnectionInterface::kBundlePolicyMaxBundle) { |
pthatcher1
2016/05/11 06:20:39
If the policy is max bundle, then all the channels
Taylor Brandstetter
2016/05/11 15:32:23
JSEP does say the application can't munge BUNDLE g
pthatcher1
2016/05/11 22:23:47
If we are in max-bundle mode, we already reject de
skvlad
2016/05/11 22:24:19
Added a TODO to reject the offer in this case when
Taylor Brandstetter
2016/05/11 22:35:55
I'm of the opposite opinion... I think we should d
|
+ bundle_group = desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); |
+ if (!bundle_group) { |
+ LOG(LS_WARNING) << "max-bundle specified without BUNDLE specified"; |
+ return false; |
+ } |
+ } |
+ |
// Creating the media channels and transport proxies. |
const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc); |
if (voice && !voice->rejected && !voice_channel_) { |
- if (!CreateVoiceChannel(voice)) { |
+ if (!CreateVoiceChannel(voice, |
+ GetTransportForChannel(voice, bundle_group))) { |
LOG(LS_ERROR) << "Failed to create voice channel."; |
return false; |
} |
@@ -1741,7 +1772,8 @@ bool WebRtcSession::CreateChannels(const SessionDescription* desc) { |
const cricket::ContentInfo* video = cricket::GetFirstVideoContent(desc); |
if (video && !video->rejected && !video_channel_) { |
- if (!CreateVideoChannel(video)) { |
+ if (!CreateVideoChannel(video, |
+ GetTransportForChannel(video, bundle_group))) { |
LOG(LS_ERROR) << "Failed to create video channel."; |
return false; |
} |
@@ -1750,48 +1782,29 @@ bool WebRtcSession::CreateChannels(const SessionDescription* desc) { |
const cricket::ContentInfo* data = cricket::GetFirstDataContent(desc); |
if (data_channel_type_ != cricket::DCT_NONE && |
data && !data->rejected && !data_channel_) { |
- if (!CreateDataChannel(data)) { |
+ if (!CreateDataChannel(data, GetTransportForChannel(data, bundle_group))) { |
LOG(LS_ERROR) << "Failed to create data channel."; |
return false; |
} |
} |
- if (rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire) { |
- if (voice_channel()) { |
- voice_channel()->ActivateRtcpMux(); |
- } |
- if (video_channel()) { |
- video_channel()->ActivateRtcpMux(); |
- } |
- if (data_channel()) { |
- data_channel()->ActivateRtcpMux(); |
- } |
- } |
- |
- // Enable BUNDLE immediately when kBundlePolicyMaxBundle is in effect. |
- if (bundle_policy_ == PeerConnectionInterface::kBundlePolicyMaxBundle) { |
- const cricket::ContentGroup* bundle_group = desc->GetGroupByName( |
- cricket::GROUP_TYPE_BUNDLE); |
- if (!bundle_group) { |
- LOG(LS_WARNING) << "max-bundle specified without BUNDLE specified"; |
- return false; |
- } |
- if (!EnableBundle(*bundle_group)) { |
- LOG(LS_WARNING) << "max-bundle failed to enable bundling."; |
- return false; |
- } |
- } |
- |
return true; |
} |
-bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { |
+bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content, |
+ const std::string& transport_name) { |
voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
- media_controller_, transport_controller_.get(), content->name, true, |
+ media_controller_, transport_controller_.get(), content->name, |
+ transport_name, |
+ rtcp_mux_policy_ != |
+ PeerConnectionInterface::kRtcpMuxPolicyRequire /* rtcp */, |
pthatcher1
2016/05/11 06:20:39
Can you put this on a separate line?
bool rtcp_mu
Taylor Brandstetter
2016/05/11 15:32:23
This means that if we receive a remote description
pthatcher1
2016/05/11 22:23:47
The "rtcp" parameter here ultimately gets passed i
skvlad
2016/05/11 22:24:19
Done.
skvlad
2016/05/11 22:24:20
Added a comment in ValidateSessionDescription.
|
audio_options_)); |
if (!voice_channel_) { |
return false; |
} |
+ if (rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire) { |
+ voice_channel_->ActivateRtcpMux(); |
+ } |
voice_channel_->SignalDtlsSetupFailure.connect( |
this, &WebRtcSession::OnDtlsSetupFailure); |
@@ -1802,14 +1815,20 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { |
return true; |
} |
-bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { |
+bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content, |
+ const std::string& transport_name) { |
video_channel_.reset(channel_manager_->CreateVideoChannel( |
- media_controller_, transport_controller_.get(), content->name, true, |
+ media_controller_, transport_controller_.get(), content->name, |
+ transport_name, |
+ rtcp_mux_policy_ != |
+ PeerConnectionInterface::kRtcpMuxPolicyRequire /* rtcp */, |
pthatcher1
2016/05/11 06:20:39
Same thing here.
skvlad
2016/05/11 22:24:20
Acknowledged.
|
video_options_)); |
if (!video_channel_) { |
return false; |
} |
- |
+ if (rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire) { |
+ video_channel_->ActivateRtcpMux(); |
+ } |
video_channel_->SignalDtlsSetupFailure.connect( |
this, &WebRtcSession::OnDtlsSetupFailure); |
@@ -1819,13 +1838,21 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { |
return true; |
} |
-bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { |
+bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content, |
+ const std::string& transport_name) { |
bool sctp = (data_channel_type_ == cricket::DCT_SCTP); |
data_channel_.reset(channel_manager_->CreateDataChannel( |
- transport_controller_.get(), content->name, !sctp, data_channel_type_)); |
+ transport_controller_.get(), content->name, transport_name, |
+ !sctp && |
+ rtcp_mux_policy_ != |
+ PeerConnectionInterface::kRtcpMuxPolicyRequire /* rtcp */, |
+ data_channel_type_)); |
pthatcher1
2016/05/11 06:20:39
And here.
skvlad
2016/05/11 22:24:19
Done.
|
if (!data_channel_) { |
return false; |
} |
+ if (rtcp_mux_policy_ == PeerConnectionInterface::kRtcpMuxPolicyRequire) { |
+ data_channel_->ActivateRtcpMux(); |
+ } |
if (sctp) { |
data_channel_->SignalDataReceived.connect( |