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

Unified Diff: talk/session/media/channel.cc

Issue 1532543003: DTLS-SRTP set up is bypassed when the channel has been writable. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: improve comments. Created 5 years 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
« no previous file with comments | « talk/session/media/channel.h ('k') | talk/session/media/srtpfilter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/session/media/channel.cc
diff --git a/talk/session/media/channel.cc b/talk/session/media/channel.cc
index 91808524e176be6ec0b46bd40042643048cfad59..46cd9d5c8453be4c7f97eede4acdec846a9588c7 100644
--- a/talk/session/media/channel.cc
+++ b/talk/session/media/channel.cc
@@ -265,24 +265,39 @@ bool BaseChannel::SetTransport_w(const std::string& transport_name) {
// changes and wait until the DTLS handshake is complete to set the newly
// negotiated parameters.
if (ShouldSetupDtlsSrtp()) {
+ // Set |writable_| to false such that UpdateWritableState_w can set up
+ // DTLS-SRTP when the writable_ becomes true again.
+ writable_ = false;
srtp_filter_.ResetParams();
}
- set_transport_channel(transport_controller_->CreateTransportChannel_w(
- transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP));
- if (!transport_channel()) {
- return false;
- }
+ // TODO(guoweis): Remove this grossness when we remove non-muxed RTCP.
if (rtcp_transport_enabled()) {
LOG(LS_INFO) << "Create RTCP TransportChannel for " << content_name()
<< " on " << transport_name << " transport ";
- set_rtcp_transport_channel(transport_controller_->CreateTransportChannel_w(
- transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP));
+ set_rtcp_transport_channel(
+ transport_controller_->CreateTransportChannel_w(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP),
+ false /* update_writablity */);
if (!rtcp_transport_channel()) {
return false;
}
}
+ // We're not updating the writablity during the transition state.
+ set_transport_channel(transport_controller_->CreateTransportChannel_w(
+ transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ if (!transport_channel()) {
+ return false;
+ }
+
+ // TODO(guoweis): Remove this grossness when we remove non-muxed RTCP.
+ if (rtcp_transport_enabled()) {
+ // We can only update the RTCP ready to send after set_transport_channel has
+ // handled channel writability.
+ SetReadyToSend(
+ true, rtcp_transport_channel() && rtcp_transport_channel()->writable());
+ }
transport_name_ = transport_name;
return true;
}
@@ -318,7 +333,8 @@ void BaseChannel::set_transport_channel(TransportChannel* new_tc) {
SetReadyToSend(false, new_tc && new_tc->writable());
}
-void BaseChannel::set_rtcp_transport_channel(TransportChannel* new_tc) {
+void BaseChannel::set_rtcp_transport_channel(TransportChannel* new_tc,
+ bool update_writablity) {
ASSERT(worker_thread_ == rtc::Thread::Current());
TransportChannel* old_tc = rtcp_transport_channel_;
@@ -346,10 +362,12 @@ void BaseChannel::set_rtcp_transport_channel(TransportChannel* new_tc) {
}
}
- // Update aggregate writable/ready-to-send state between RTP and RTCP upon
- // setting new channel
- UpdateWritableState_w();
- SetReadyToSend(true, new_tc && new_tc->writable());
+ if (update_writablity) {
+ // Update aggregate writable/ready-to-send state between RTP and RTCP upon
+ // setting new channel
+ UpdateWritableState_w();
+ SetReadyToSend(true, new_tc && new_tc->writable());
+ }
}
void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) {
@@ -1070,7 +1088,7 @@ void BaseChannel::ActivateRtcpMux() {
void BaseChannel::ActivateRtcpMux_w() {
if (!rtcp_mux_filter_.IsActive()) {
rtcp_mux_filter_.SetActive();
- set_rtcp_transport_channel(nullptr);
+ set_rtcp_transport_channel(nullptr, true);
rtcp_transport_enabled_ = false;
}
}
@@ -1093,7 +1111,7 @@ bool BaseChannel::SetRtcpMux_w(bool enable, ContentAction action,
LOG(LS_INFO) << "Enabling rtcp-mux for " << content_name()
<< " by destroying RTCP transport channel for "
<< transport_name();
- set_rtcp_transport_channel(nullptr);
+ set_rtcp_transport_channel(nullptr, true);
rtcp_transport_enabled_ = false;
}
break;
« no previous file with comments | « talk/session/media/channel.h ('k') | talk/session/media/srtpfilter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698