From d7022312687e3e989276ea55a271fd2230cffee8 Mon Sep 17 00:00:00 2001 From: Bjorn A Mellem Date: Fri, 20 Sep 2019 11:33:39 -0700 Subject: [PATCH] Cleanup deprecated monitoring of MediaTransport state. PeerConnection now watches when data channels become ready to send through its implementation of DataChannelSink, and no longer needs to monitor the MediaTransport state. Bug: webrtc:9719 Change-Id: I3e17747eb03926a3791c204bf5a1d2dc67855c09 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154001 Commit-Queue: Seth Hampson Reviewed-by: Seth Hampson Cr-Commit-Position: refs/heads/master@{#29261} --- pc/jsep_transport_controller.cc | 1 - pc/jsep_transport_controller.h | 4 ---- pc/peer_connection.cc | 29 ----------------------------- pc/peer_connection.h | 1 - 4 files changed, 35 deletions(-) diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc index 8e15a3dbac..c9ed4d573f 100644 --- a/pc/jsep_transport_controller.cc +++ b/pc/jsep_transport_controller.cc @@ -1450,7 +1450,6 @@ void JsepTransportController::OnTransportStateChanged_n( } void JsepTransportController::OnMediaTransportStateChanged_n() { - SignalMediaTransportStateChanged(); UpdateAggregateStates_n(); } diff --git a/pc/jsep_transport_controller.h b/pc/jsep_transport_controller.h index d575592f1e..c95a62d9fd 100644 --- a/pc/jsep_transport_controller.h +++ b/pc/jsep_transport_controller.h @@ -287,10 +287,6 @@ class JsepTransportController : public sigslot::has_slots<> { sigslot::signal1 SignalDtlsHandshakeError; - // TODO(mellem): Delete this signal once PeerConnection no longer - // uses it to determine data channel state. - sigslot::signal<> SignalMediaTransportStateChanged; - private: RTCError ApplyDescription_n(bool local, SdpType type, diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index 65f1283e49..a80cf5a991 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -6825,13 +6825,6 @@ bool PeerConnection::SetupDataChannelTransport_n(const std::string& mid) { data_channel_transport_invoker_ = std::make_unique(); data_channel_transport_->SetDataSink(this); sctp_mid_ = mid; - // TODO(mellem): Handling data channel state through media transport is - // deprecated. Delete these lines when downstream implementations call - // DataChannelSink::OnStateChanged(). - transport_controller_->SignalMediaTransportStateChanged.connect( - this, &PeerConnection::OnMediaTransportStateChanged_n); - // Check the initial state right away, in case transport is already writable. - OnMediaTransportStateChanged_n(); return true; } @@ -6842,9 +6835,6 @@ void PeerConnection::TeardownDataChannelTransport_n() { RTC_LOG(LS_INFO) << "Tearing down data channel transport for mid=" << *sctp_mid_; - // TODO(mellem): Delete this line when downstream implementations call - // DataChannelSink::OnStateChanged(). - transport_controller_->SignalMediaTransportStateChanged.disconnect(this); // |sctp_mid_| may still be active through an SCTP transport. If not, unset // it. if (!sctp_transport_) { @@ -6855,25 +6845,6 @@ void PeerConnection::TeardownDataChannelTransport_n() { data_channel_transport_ = nullptr; } -// TODO(mellem): Handling of data channel state through the media transport -// callback is deprecated. This function should be deleted once downstream -// implementations call DataChannelSink::OnStateChanged(). -void PeerConnection::OnMediaTransportStateChanged_n() { - if (!sctp_mid_ || transport_controller_->GetMediaTransportState(*sctp_mid_) != - MediaTransportState::kWritable) { - return; - } - data_channel_transport_invoker_->AsyncInvoke( - RTC_FROM_HERE, signaling_thread(), [this] { - RTC_DCHECK_RUN_ON(signaling_thread()); - data_channel_transport_ready_to_send_ = true; - if (data_channel_transport_negotiated_) { - SignalDataChannelTransportWritable_s( - data_channel_transport_ready_to_send_); - } - }); -} - // Returns false if bundle is enabled and rtcp_mux is disabled. bool PeerConnection::ValidateBundleSettings(const SessionDescription* desc) { bool bundle_enabled = desc->HasGroup(cricket::GROUP_TYPE_BUNDLE); diff --git a/pc/peer_connection.h b/pc/peer_connection.h index 5d57529642..da72687a70 100644 --- a/pc/peer_connection.h +++ b/pc/peer_connection.h @@ -1049,7 +1049,6 @@ class PeerConnection : public PeerConnectionInternal, bool SetupDataChannelTransport_n(const std::string& mid) RTC_RUN_ON(network_thread()); - void OnMediaTransportStateChanged_n() RTC_RUN_ON(network_thread()); void TeardownDataChannelTransport_n() RTC_RUN_ON(network_thread()); bool ValidateBundleSettings(const cricket::SessionDescription* desc);