From d9a51b05da4f47fcb5a538b76ae797b4b3bdafc8 Mon Sep 17 00:00:00 2001 From: Tomas Gunnarsson Date: Fri, 2 Apr 2021 17:42:02 +0200 Subject: [PATCH] Remove unnecessary calls to BaseChannel::SetRtpTransport Also updating SocketOptionsMergedOnSetTransport test code to make the call to SetRtpTransport from the right context. Bug: webrtc:12636 Change-Id: I343851bcf8ac663d7559128d12447a9a742786f0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213660 Reviewed-by: Harald Alvestrand Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#33633} --- pc/channel.cc | 9 --------- pc/channel.h | 1 - pc/channel_unittest.cc | 2 +- pc/sdp_offer_answer.cc | 6 ------ 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/pc/channel.cc b/pc/channel.cc index 1408c4c520..f37be6716b 100644 --- a/pc/channel.cc +++ b/pc/channel.cc @@ -228,11 +228,6 @@ void BaseChannel::Deinit() { } bool BaseChannel::SetRtpTransport(webrtc::RtpTransportInternal* rtp_transport) { - if (!network_thread_->IsCurrent()) { - return network_thread_->Invoke(RTC_FROM_HERE, [this, rtp_transport] { - return SetRtpTransport(rtp_transport); - }); - } RTC_DCHECK_RUN_ON(network_thread()); if (rtp_transport == rtp_transport_) { return true; @@ -881,10 +876,6 @@ VoiceChannel::~VoiceChannel() { Deinit(); } -void VoiceChannel::Init_w(webrtc::RtpTransportInternal* rtp_transport) { - BaseChannel::Init_w(rtp_transport); -} - void VoiceChannel::UpdateMediaSendRecvState_w() { // Render incoming data if we're the active call, and we have the local // content. We receive data on the default channel and multiplexed streams. diff --git a/pc/channel.h b/pc/channel.h index b418188efc..dbcdf9d1d7 100644 --- a/pc/channel.h +++ b/pc/channel.h @@ -434,7 +434,6 @@ class VoiceChannel : public BaseChannel { cricket::MediaType media_type() const override { return cricket::MEDIA_TYPE_AUDIO; } - void Init_w(webrtc::RtpTransportInternal* rtp_transport) override; private: // overrides from BaseChannel diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc index ea4e828226..7ff25a9466 100644 --- a/pc/channel_unittest.cc +++ b/pc/channel_unittest.cc @@ -1276,11 +1276,11 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> { new_rtp_transport_ = CreateDtlsSrtpTransport( fake_rtp_dtls_transport2_.get(), fake_rtcp_dtls_transport2_.get()); - channel1_->SetRtpTransport(new_rtp_transport_.get()); bool rcv_success, send_success; int rcv_buf, send_buf; network_thread_->Invoke(RTC_FROM_HERE, [&] { + channel1_->SetRtpTransport(new_rtp_transport_.get()); send_success = fake_rtp_dtls_transport2_->GetOption( rtc::Socket::Option::OPT_SNDBUF, &send_buf); rcv_success = fake_rtp_dtls_transport2_->GetOption( diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc index 2d9f9c82f0..3499e4c432 100644 --- a/pc/sdp_offer_answer.cc +++ b/pc/sdp_offer_answer.cc @@ -4629,8 +4629,6 @@ cricket::VoiceChannel* SdpOfferAnswerHandler::CreateVoiceChannel( } voice_channel->SignalSentPacket().connect(pc_, &PeerConnection::OnSentPacket_w); - voice_channel->SetRtpTransport(rtp_transport); - return voice_channel; } @@ -4654,8 +4652,6 @@ cricket::VideoChannel* SdpOfferAnswerHandler::CreateVideoChannel( } video_channel->SignalSentPacket().connect(pc_, &PeerConnection::OnSentPacket_w); - video_channel->SetRtpTransport(rtp_transport); - return video_channel; } @@ -4688,8 +4684,6 @@ bool SdpOfferAnswerHandler::CreateDataChannel(const std::string& mid) { } data_channel_controller()->rtp_data_channel()->SignalSentPacket().connect( pc_, &PeerConnection::OnSentPacket_w); - data_channel_controller()->rtp_data_channel()->SetRtpTransport( - rtp_transport); have_pending_rtp_data_channel_ = true; return true; }