From 4efa9d0a5fb6572ea5bd44e2c6183d6cfc1459d4 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 30 Oct 2020 06:44:55 +0000 Subject: [PATCH] Remove obsolete GetRemoteAudioSSL* functions. Bug: webrtc:12054 Change-Id: I56d198cfa2c336155c5173ccd524107d12e6a382 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190921 Reviewed-by: Mirko Bonadei Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/master@{#32528} --- pc/peer_connection.cc | 20 -------- pc/peer_connection.h | 14 ------ pc/peer_connection_integrationtest.cc | 70 --------------------------- pc/rtp_transmission_manager.cc | 11 ----- pc/rtp_transmission_manager.h | 4 -- 5 files changed, 119 deletions(-) diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index 4a6c85cbef..8faac3b877 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -1481,26 +1481,6 @@ void PeerConnection::SetAudioRecording(bool recording) { audio_state->SetRecording(recording); } -std::unique_ptr -PeerConnection::GetRemoteAudioSSLCertificate() { - std::unique_ptr chain = GetRemoteAudioSSLCertChain(); - if (!chain || !chain->GetSize()) { - return nullptr; - } - return chain->Get(0).Clone(); -} - -std::unique_ptr -PeerConnection::GetRemoteAudioSSLCertChain() { - RTC_DCHECK_RUN_ON(signaling_thread()); - auto audio_transceiver = rtp_manager()->GetFirstAudioTransceiver(); - if (!audio_transceiver || !audio_transceiver->internal()->channel()) { - return nullptr; - } - return transport_controller_->GetRemoteSSLCertChain( - audio_transceiver->internal()->channel()->transport_name()); -} - void PeerConnection::AddAdaptationResource( rtc::scoped_refptr resource) { if (!worker_thread()->IsCurrent()) { diff --git a/pc/peer_connection.h b/pc/peer_connection.h index 35567c1608..d928b3e4ae 100644 --- a/pc/peer_connection.h +++ b/pc/peer_connection.h @@ -154,20 +154,6 @@ class PeerConnection : public PeerConnectionInternal, cricket::MediaType media_type, const RtpTransceiverInit& init) override; - // Gets the DTLS SSL certificate associated with the audio transport on the - // remote side. This will become populated once the DTLS connection with the - // peer has been completed, as indicated by the ICE connection state - // transitioning to kIceConnectionCompleted. - // Deprecated - users should insted query the DTLS transpport for this info. - // See https://www.w3.org/TR/webrtc/#rtcdtlstransport-interface - - RTC_DEPRECATED std::unique_ptr - GetRemoteAudioSSLCertificate(); - - // Version of the above method that returns the full certificate chain. - RTC_DEPRECATED std::unique_ptr - GetRemoteAudioSSLCertChain(); - rtc::scoped_refptr CreateSender( const std::string& kind, const std::string& stream_id) override; diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index a72dbc66d9..53e0f6d7c9 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -1950,76 +1950,6 @@ TEST_P(PeerConnectionIntegrationTest, ASSERT_TRUE(ExpectNewFrames(media_expectations)); } -// Tests that the GetRemoteAudioSSLCertificate method returns the remote DTLS -// certificate once the DTLS handshake has finished. -TEST_P(PeerConnectionIntegrationTest, - GetRemoteAudioSSLCertificateReturnsExchangedCertificate) { - auto GetRemoteAudioSSLCertificate = [](PeerConnectionWrapper* wrapper) { - auto pci = reinterpret_cast(wrapper->pc()); - auto pc = reinterpret_cast(pci->internal()); - return pc->GetRemoteAudioSSLCertificate(); - }; - auto GetRemoteAudioSSLCertChain = [](PeerConnectionWrapper* wrapper) { - auto pci = reinterpret_cast(wrapper->pc()); - auto pc = reinterpret_cast(pci->internal()); - return pc->GetRemoteAudioSSLCertChain(); - }; - - auto caller_cert = rtc::RTCCertificate::FromPEM(kRsaPems[0]); - auto callee_cert = rtc::RTCCertificate::FromPEM(kRsaPems[1]); - - // Configure each side with a known certificate so they can be compared later. - PeerConnectionInterface::RTCConfiguration caller_config; - caller_config.enable_dtls_srtp.emplace(true); - caller_config.certificates.push_back(caller_cert); - PeerConnectionInterface::RTCConfiguration callee_config; - callee_config.enable_dtls_srtp.emplace(true); - callee_config.certificates.push_back(callee_cert); - ASSERT_TRUE( - CreatePeerConnectionWrappersWithConfig(caller_config, callee_config)); - ConnectFakeSignaling(); - - // When first initialized, there should not be a remote SSL certificate (and - // calling this method should not crash). - EXPECT_EQ(nullptr, GetRemoteAudioSSLCertificate(caller())); - EXPECT_EQ(nullptr, GetRemoteAudioSSLCertificate(callee())); - EXPECT_EQ(nullptr, GetRemoteAudioSSLCertChain(caller())); - EXPECT_EQ(nullptr, GetRemoteAudioSSLCertChain(callee())); - - caller()->AddAudioTrack(); - callee()->AddAudioTrack(); - caller()->CreateAndSetAndSignalOffer(); - ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); - ASSERT_TRUE_WAIT(DtlsConnected(), kDefaultTimeout); - - // Once DTLS has been connected, each side should return the other's SSL - // certificate when calling GetRemoteAudioSSLCertificate. - - auto caller_remote_cert = GetRemoteAudioSSLCertificate(caller()); - ASSERT_TRUE(caller_remote_cert); - EXPECT_EQ(callee_cert->GetSSLCertificate().ToPEMString(), - caller_remote_cert->ToPEMString()); - - auto callee_remote_cert = GetRemoteAudioSSLCertificate(callee()); - ASSERT_TRUE(callee_remote_cert); - EXPECT_EQ(caller_cert->GetSSLCertificate().ToPEMString(), - callee_remote_cert->ToPEMString()); - - auto caller_remote_cert_chain = GetRemoteAudioSSLCertChain(caller()); - ASSERT_TRUE(caller_remote_cert_chain); - ASSERT_EQ(1U, caller_remote_cert_chain->GetSize()); - auto remote_cert = &caller_remote_cert_chain->Get(0); - EXPECT_EQ(callee_cert->GetSSLCertificate().ToPEMString(), - remote_cert->ToPEMString()); - - auto callee_remote_cert_chain = GetRemoteAudioSSLCertChain(callee()); - ASSERT_TRUE(callee_remote_cert_chain); - ASSERT_EQ(1U, callee_remote_cert_chain->GetSize()); - remote_cert = &callee_remote_cert_chain->Get(0); - EXPECT_EQ(caller_cert->GetSSLCertificate().ToPEMString(), - remote_cert->ToPEMString()); -} - // This test sets up a call between two parties with a source resolution of // 1280x720 and verifies that a 16:9 aspect ratio is received. TEST_P(PeerConnectionIntegrationTest, diff --git a/pc/rtp_transmission_manager.cc b/pc/rtp_transmission_manager.cc index 5c0e4d9c31..a71ed53d4f 100644 --- a/pc/rtp_transmission_manager.cc +++ b/pc/rtp_transmission_manager.cc @@ -440,17 +440,6 @@ void RtpTransmissionManager::RemoveVideoTrack(VideoTrackInterface* track, GetVideoTransceiver()->internal()->RemoveSender(sender); } -rtc::scoped_refptr> -RtpTransmissionManager::GetFirstAudioTransceiver() const { - RTC_DCHECK_RUN_ON(signaling_thread()); - for (auto transceiver : transceivers_.List()) { - if (transceiver->media_type() == cricket::MEDIA_TYPE_AUDIO) { - return transceiver; - } - } - return nullptr; -} - void RtpTransmissionManager::CreateAudioReceiver( MediaStreamInterface* stream, const RtpSenderInfo& remote_sender_info) { diff --git a/pc/rtp_transmission_manager.h b/pc/rtp_transmission_manager.h index 7aa410c51b..de83fb2010 100644 --- a/pc/rtp_transmission_manager.h +++ b/pc/rtp_transmission_manager.h @@ -136,10 +136,6 @@ class RtpTransmissionManager : public RtpSenderBase::SetStreamsObserver, rtc::scoped_refptr> GetVideoTransceiver() const; - // Gets the first audio transceiver. - rtc::scoped_refptr> - GetFirstAudioTransceiver() const; - // Add an audio track, reusing or creating the sender. void AddAudioTrack(AudioTrackInterface* track, MediaStreamInterface* stream); // Plan B: Remove an audio track, removing the sender.