Remove leftover code referencing deleted SDES encryption scheme

Bug: webrtc:42227597
Change-Id: I8008a757fc8e784d33e1fa199c8c74d20d4d0641
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/416520
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45925}
diff --git a/pc/jsep_transport.cc b/pc/jsep_transport.cc
index 91b123c..98b8e8d 100644
--- a/pc/jsep_transport.cc
+++ b/pc/jsep_transport.cc
@@ -10,7 +10,6 @@
 
 #include "pc/jsep_transport.h"
 
-#include <cstddef>
 #include <cstdint>
 #include <functional>
 #include <memory>
@@ -39,7 +38,6 @@
 #include "pc/rtp_transport.h"
 #include "pc/sctp_transport.h"
 #include "pc/session_description.h"
-#include "pc/srtp_transport.h"
 #include "pc/transport_stats.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/copy_on_write_buffer.h"
@@ -95,7 +93,6 @@
     scoped_refptr<IceTransportInterface> ice_transport,
     scoped_refptr<IceTransportInterface> rtcp_ice_transport,
     std::unique_ptr<RtpTransport> unencrypted_rtp_transport,
-    std::unique_ptr<SrtpTransport> sdes_transport,
     std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport,
     std::unique_ptr<DtlsTransportInternal> rtp_dtls_transport,
     std::unique_ptr<DtlsTransportInternal> rtcp_dtls_transport,
@@ -108,7 +105,6 @@
       ice_transport_(std::move(ice_transport)),
       rtcp_ice_transport_(std::move(rtcp_ice_transport)),
       unencrypted_rtp_transport_(std::move(unencrypted_rtp_transport)),
-      sdes_transport_(std::move(sdes_transport)),
       dtls_srtp_transport_(std::move(dtls_srtp_transport)),
       rtp_dtls_transport_(
           rtp_dtls_transport
@@ -135,15 +131,10 @@
                 (rtcp_dtls_transport_ != nullptr));
   // Verify the "only one out of these three can be set" invariant.
   if (unencrypted_rtp_transport_) {
-    RTC_DCHECK(!sdes_transport);
-    RTC_DCHECK(!dtls_srtp_transport);
-  } else if (sdes_transport_) {
-    RTC_DCHECK(!unencrypted_rtp_transport);
     RTC_DCHECK(!dtls_srtp_transport);
   } else {
     RTC_DCHECK(dtls_srtp_transport_);
     RTC_DCHECK(!unencrypted_rtp_transport);
-    RTC_DCHECK(!sdes_transport);
   }
 }
 
@@ -187,7 +178,6 @@
 
   if (dtls_srtp_transport_) {
     RTC_DCHECK(!unencrypted_rtp_transport_);
-    RTC_DCHECK(!sdes_transport_);
     dtls_srtp_transport_->UpdateRecvEncryptedHeaderExtensionIds(
         jsep_description.encrypted_header_extension_ids);
   }
@@ -263,7 +253,6 @@
 
   if (dtls_srtp_transport_) {
     RTC_DCHECK(!unencrypted_rtp_transport_);
-    RTC_DCHECK(!sdes_transport_);
     dtls_srtp_transport_->UpdateSendEncryptedHeaderExtensionIds(
         jsep_description.encrypted_header_extension_ids);
     dtls_srtp_transport_->CacheRtpAbsSendTimeHeaderExtension(
@@ -472,17 +461,11 @@
 
 void JsepTransport::ActivateRtcpMux() {
   if (unencrypted_rtp_transport_) {
-    RTC_DCHECK(!sdes_transport_);
     RTC_DCHECK(!dtls_srtp_transport_);
     unencrypted_rtp_transport_->SetRtcpPacketTransport(nullptr);
-  } else if (sdes_transport_) {
-    RTC_DCHECK(!unencrypted_rtp_transport_);
-    RTC_DCHECK(!dtls_srtp_transport_);
-    sdes_transport_->SetRtcpPacketTransport(nullptr);
   } else if (dtls_srtp_transport_) {
     RTC_DCHECK(dtls_srtp_transport_);
     RTC_DCHECK(!unencrypted_rtp_transport_);
-    RTC_DCHECK(!sdes_transport_);
     dtls_srtp_transport_->SetDtlsTransports(rtp_dtls_transport(),
                                             /*rtcp_dtls_transport=*/nullptr);
   }
diff --git a/pc/jsep_transport.h b/pc/jsep_transport.h
index 50dc991..7857a56 100644
--- a/pc/jsep_transport.h
+++ b/pc/jsep_transport.h
@@ -35,7 +35,6 @@
 #include "pc/rtp_transport_internal.h"
 #include "pc/sctp_transport.h"
 #include "pc/session_description.h"
-#include "pc/srtp_transport.h"
 #include "pc/transport_stats.h"
 #include "rtc_base/rtc_certificate.h"
 #include "rtc_base/ssl_fingerprint.h"
@@ -84,7 +83,6 @@
                 scoped_refptr<IceTransportInterface> ice_transport,
                 scoped_refptr<IceTransportInterface> rtcp_ice_transport,
                 std::unique_ptr<RtpTransport> unencrypted_rtp_transport,
-                std::unique_ptr<SrtpTransport> sdes_transport,
                 std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport,
                 std::unique_ptr<DtlsTransportInternal> rtp_dtls_transport,
                 std::unique_ptr<DtlsTransportInternal> rtcp_dtls_transport,
@@ -159,9 +157,6 @@
     if (dtls_srtp_transport_) {
       return dtls_srtp_transport_.get();
     }
-    if (sdes_transport_) {
-      return sdes_transport_.get();
-    }
     if (unencrypted_rtp_transport_) {
       return unencrypted_rtp_transport_.get();
     }
@@ -297,7 +292,6 @@
   // To avoid downcasting and make it type safe, keep three unique pointers for
   // different SRTP mode and only one of these is non-nullptr.
   const std::unique_ptr<RtpTransport> unencrypted_rtp_transport_;
-  const std::unique_ptr<SrtpTransport> sdes_transport_;
   const std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport_;
 
   const scoped_refptr<DtlsTransport> rtp_dtls_transport_;
@@ -310,7 +304,7 @@
 
   RtcpMuxFilter rtcp_mux_negotiator_ RTC_GUARDED_BY(network_thread_);
 
-  // Cache the encrypted header extension IDs for SDES negoitation.
+  // Cache the encrypted header extension IDs
   std::optional<std::vector<int>> send_extension_ids_
       RTC_GUARDED_BY(network_thread_);
   std::optional<std::vector<int>> recv_extension_ids_
diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc
index 6ffa234..9b6dd14 100644
--- a/pc/jsep_transport_controller.cc
+++ b/pc/jsep_transport_controller.cc
@@ -57,7 +57,6 @@
 #include "pc/rtp_transport_internal.h"
 #include "pc/sctp_transport.h"
 #include "pc/session_description.h"
-#include "pc/srtp_transport.h"
 #include "pc/transport_stats.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/copy_on_write_buffer.h"
@@ -580,24 +579,6 @@
   return unencrypted_rtp_transport;
 }
 
-std::unique_ptr<SrtpTransport> JsepTransportController::CreateSdesTransport(
-    const std::string& transport_name,
-    DtlsTransportInternal* rtp_dtls_transport,
-    DtlsTransportInternal* rtcp_dtls_transport) {
-  RTC_DCHECK_RUN_ON(network_thread_);
-  auto srtp_transport = std::make_unique<SrtpTransport>(
-      rtcp_dtls_transport == nullptr, env_.field_trials());
-  RTC_DCHECK(rtp_dtls_transport);
-  srtp_transport->SetRtpPacketTransport(rtp_dtls_transport);
-  if (rtcp_dtls_transport) {
-    srtp_transport->SetRtcpPacketTransport(rtcp_dtls_transport);
-  }
-  if (config_.enable_external_auth) {
-    srtp_transport->EnableExternalAuth();
-  }
-  return srtp_transport;
-}
-
 std::unique_ptr<DtlsSrtpTransport>
 JsepTransportController::CreateDtlsSrtpTransport(
     const std::string& transport_name,
@@ -1154,7 +1135,6 @@
 
   std::unique_ptr<DtlsTransportInternal> rtcp_dtls_transport;
   std::unique_ptr<RtpTransport> unencrypted_rtp_transport;
-  std::unique_ptr<SrtpTransport> sdes_transport;
   std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport;
 
   scoped_refptr<IceTransportInterface> rtcp_ice;
@@ -1188,9 +1168,9 @@
   std::unique_ptr<JsepTransport> jsep_transport =
       std::make_unique<JsepTransport>(
           content_info.mid(), certificate_, std::move(ice), std::move(rtcp_ice),
-          std::move(unencrypted_rtp_transport), std::move(sdes_transport),
-          std::move(dtls_srtp_transport), std::move(rtp_dtls_transport),
-          std::move(rtcp_dtls_transport), std::move(sctp_transport),
+          std::move(unencrypted_rtp_transport), std::move(dtls_srtp_transport),
+          std::move(rtp_dtls_transport), std::move(rtcp_dtls_transport),
+          std::move(sctp_transport),
           [&]() {
             RTC_DCHECK_RUN_ON(network_thread_);
             UpdateAggregateStates_n();
diff --git a/pc/jsep_transport_controller.h b/pc/jsep_transport_controller.h
index 9610cf9..5420a27 100644
--- a/pc/jsep_transport_controller.h
+++ b/pc/jsep_transport_controller.h
@@ -56,7 +56,6 @@
 #include "pc/rtp_transport_internal.h"
 #include "pc/sctp_transport.h"
 #include "pc/session_description.h"
-#include "pc/srtp_transport.h"
 #include "pc/transport_stats.h"
 #include "rtc_base/callback_list.h"
 #include "rtc_base/copy_on_write_buffer.h"
@@ -424,10 +423,6 @@
       const std::string& transport_name,
       PacketTransportInternal* rtp_packet_transport,
       PacketTransportInternal* rtcp_packet_transport);
-  std::unique_ptr<SrtpTransport> CreateSdesTransport(
-      const std::string& transport_name,
-      DtlsTransportInternal* rtp_dtls_transport,
-      DtlsTransportInternal* rtcp_dtls_transport);
   std::unique_ptr<DtlsSrtpTransport> CreateDtlsSrtpTransport(
       const std::string& transport_name,
       DtlsTransportInternal* rtp_dtls_transport,
diff --git a/pc/jsep_transport_unittest.cc b/pc/jsep_transport_unittest.cc
index 9663d3e..688faa1 100644
--- a/pc/jsep_transport_unittest.cc
+++ b/pc/jsep_transport_unittest.cc
@@ -140,7 +140,6 @@
     auto rtcp_ice = CreateIceTransport(std::move(rtcp_ice_internal));
 
     std::unique_ptr<RtpTransport> unencrypted_rtp_transport;
-    std::unique_ptr<SrtpTransport> sdes_transport;
     std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport;
     dtls_srtp_transport = CreateDtlsSrtpTransport(rtp_dtls_transport.get(),
                                                   rtcp_dtls_transport.get());
@@ -148,8 +147,8 @@
     auto jsep_transport = std::make_unique<JsepTransport>(
         kTransportName, /*local_certificate=*/nullptr, std::move(ice),
         std::move(rtcp_ice), std::move(unencrypted_rtp_transport),
-        std::move(sdes_transport), std::move(dtls_srtp_transport),
-        std::move(rtp_dtls_transport), std::move(rtcp_dtls_transport),
+        std::move(dtls_srtp_transport), std::move(rtp_dtls_transport),
+        std::move(rtcp_dtls_transport),
         /*sctp_transport=*/nullptr,
         /*rtcp_mux_active_callback=*/[&]() { OnRtcpMuxActive(); },
         payload_type_picker_);
@@ -191,10 +190,6 @@
   AutoThread main_thread_;
   std::unique_ptr<JsepTransport> jsep_transport_;
   bool signal_rtcp_mux_active_received_ = false;
-  // The SrtpTransport is owned by `jsep_transport_`. Keep a raw pointer here
-  // for testing.
-  SrtpTransport* sdes_transport_ = nullptr;
-
   FieldTrials field_trials_ = CreateTestFieldTrials();
   PayloadTypePicker payload_type_picker_;
 };