Remove the rtcrtptransport member from RTCPeerConnection

The discussion around a packet-level API has moved on to no longer
consider an API within RTCPeerConnection (eg see WebRTC WG interim from
2025-07-15), so let's clean up this outdated prototype and work on the
new shape. It'll live on in our hearts and our git histories.

Bug: 345101934
Change-Id: I4959f534e43131b4a19318851c1a7a4a3b00d7a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6929661
Reviewed-by: Palak Agarwal <agpalak@chromium.org>
Commit-Queue: Tony Herre <toprice@chromium.org>
Auto-Submit: Tony Herre <toprice@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1513586}
diff --git a/android_webview/test/data/web_tests/webexposed/global-interface-listing-expected.txt b/android_webview/test/data/web_tests/webexposed/global-interface-listing-expected.txt
index bd85d54..99a2204 100644
--- a/android_webview/test/data/web_tests/webexposed/global-interface-listing-expected.txt
+++ b/android_webview/test/data/web_tests/webexposed/global-interface-listing-expected.txt
@@ -7502,7 +7502,6 @@
     getter pendingLocalDescription
     getter pendingRemoteDescription
     getter remoteDescription
-    getter rtpTransport
     getter sctp
     getter signalingState
     method addIceCandidate
@@ -11828,7 +11827,6 @@
     getter pendingLocalDescription
     getter pendingRemoteDescription
     getter remoteDescription
-    getter rtpTransport
     getter sctp
     getter signalingState
     method addIceCandidate
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc
index 80d8adc..26323e7 100644
--- a/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc
+++ b/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.cc
@@ -347,8 +347,7 @@
     const webrtc::PeerConnectionInterface::RTCConfiguration& config,
     blink::WebLocalFrame* frame,
     webrtc::PeerConnectionObserver* observer,
-    ExceptionState& exception_state,
-    RTCRtpTransport*) {
+    ExceptionState& exception_state) {
   return webrtc::make_ref_counted<MockPeerConnectionImpl>(this, observer);
 }
 
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h b/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h
index 862b601a..2421e02e 100644
--- a/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h
+++ b/third_party/blink/renderer/modules/peerconnection/mock_peer_connection_dependency_factory.h
@@ -186,8 +186,7 @@
       const webrtc::PeerConnectionInterface::RTCConfiguration& config,
       blink::WebLocalFrame* frame,
       webrtc::PeerConnectionObserver* observer,
-      ExceptionState& exception_state,
-      RTCRtpTransport* rtp_transport) override;
+      ExceptionState& exception_state) override;
   scoped_refptr<webrtc::VideoTrackSourceInterface> CreateVideoTrackSourceProxy(
       webrtc::VideoTrackSourceInterface* source) override;
   scoped_refptr<webrtc::MediaStreamInterface> CreateLocalMediaStream(
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc
index 7b093dad..9d7ad70c 100644
--- a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc
+++ b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc
@@ -331,8 +331,7 @@
     ExecutionContext*,
     const webrtc::PeerConnectionInterface::RTCConfiguration&,
     WebLocalFrame*,
-    ExceptionState&,
-    RTCRtpTransport*) {
+    ExceptionState&) {
   return true;
 }
 
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h
index e2f05d25..00d7de3 100644
--- a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h
+++ b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h
@@ -49,8 +49,7 @@
   bool Initialize(ExecutionContext* context,
                   const webrtc::PeerConnectionInterface::RTCConfiguration&,
                   WebLocalFrame*,
-                  ExceptionState&,
-                  RTCRtpTransport*) override;
+                  ExceptionState&) override;
   void Close() override;
   void CloseAndUnregister() override;
 
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
index 10f876e2..7c02734 100644
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
@@ -519,40 +519,6 @@
   return StaticDeps().GetChromeNetworkThread();
 }
 
-class InterceptingNetworkControllerFactory
-    : public webrtc::NetworkControllerFactoryInterface {
- public:
-  InterceptingNetworkControllerFactory(
-      scoped_refptr<base::SequencedTaskRunner> context_task_runner,
-      RTCRtpTransport* rtp_transport)
-      : context_task_runner_(context_task_runner),
-        rtp_transport_(rtp_transport) {
-    CHECK(rtp_transport);
-  }
-
-  // Note: Called on a webrtc thread.
-  std::unique_ptr<webrtc::NetworkControllerInterface> Create(
-      webrtc::NetworkControllerConfig config) override {
-    return std::make_unique<InterceptingNetworkController>(
-        goog_cc_factory_->Create(config), rtp_transport_, context_task_runner_);
-  }
-
-  // Note: Called on a webrtc thread.
-  webrtc::TimeDelta GetProcessInterval() const override {
-    return goog_cc_factory_->GetProcessInterval();
-  }
-
- private:
-  const std::unique_ptr<webrtc::GoogCcNetworkControllerFactory>
-      goog_cc_factory_ =
-          std::make_unique<webrtc::GoogCcNetworkControllerFactory>();
-  const scoped_refptr<base::SequencedTaskRunner> context_task_runner_;
-  // Store just a CrossThreadWeakHandle pointing at an RTCRtpTransport, to be
-  // used on a webrtc thread when creating InterceptingNetworkController
-  // instances.
-  const CrossThreadWeakHandle<RTCRtpTransport> rtp_transport_;
-};
-
 // The enum is used for logging. Entries should not be renumbered or reused.
 // Keep in sync with the corresponding enum in
 // tools/metrics/histograms/metadata/web_rtc/enums.xml.
@@ -952,8 +918,7 @@
     const webrtc::PeerConnectionInterface::RTCConfiguration& config,
     blink::WebLocalFrame* web_frame,
     webrtc::PeerConnectionObserver* observer,
-    ExceptionState& exception_state,
-    RTCRtpTransport* rtp_transport) {
+    ExceptionState& exception_state) {
   CHECK(observer);
   if (!GetPcFactory().get())
     return nullptr;
@@ -969,11 +934,6 @@
     dependencies.lna_permission_factory =
         std::make_unique<LocalNetworkAccessPermissionFactory>(this);
   }
-  if (rtp_transport) {
-    dependencies.network_controller_factory =
-        std::make_unique<InterceptingNetworkControllerFactory>(
-            context_task_runner_, rtp_transport);
-  }
   auto pc_or_error = GetPcFactory()->CreatePeerConnectionOrError(
       config, std::move(dependencies));
   if (pc_or_error.ok()) {
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
index 516969c..68fbb1f 100644
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
@@ -108,8 +108,7 @@
       const webrtc::PeerConnectionInterface::RTCConfiguration& config,
       blink::WebLocalFrame* web_frame,
       webrtc::PeerConnectionObserver* observer,
-      ExceptionState& exception_state,
-      RTCRtpTransport* rtp_transport);
+      ExceptionState& exception_state);
 
   // Creates a PortAllocator that uses Chrome IPC sockets and enforces privacy
   // controls according to the permissions granted on the page.
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
index 5c9e17e..e844d0d 100644
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
@@ -67,8 +67,7 @@
     config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
     handler->InitializeForTest(config,
                                /*peer_connection_tracker=*/nullptr,
-                               exception_state,
-                               /*rtp_transport=*/nullptr);
+                               exception_state);
     return handler;
   }
 
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
index ba18857..cf93900dc 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -639,10 +639,7 @@
       peer_handler_unregistered_(true),
       closed_(true),
       suppress_events_(true),
-      encoded_insertable_streams_(encoded_insertable_streams),
-      rtp_transport_(RuntimeEnabledFeatures::RTCRtpTransportEnabled(context)
-                         ? MakeGarbageCollected<RTCRtpTransport>(context)
-                         : nullptr) {
+      encoded_insertable_streams_(encoded_insertable_streams) {
   LocalDOMWindow* window = To<LocalDOMWindow>(context);
 
   // WebRTC peer connections are not allowed in fenced frames.
@@ -692,7 +689,7 @@
   auto* web_frame =
       static_cast<WebLocalFrame*>(WebFrame::FromCoreFrame(window->GetFrame()));
   if (!peer_handler_->Initialize(context, configuration, web_frame,
-                                 exception_state, rtp_transport_)) {
+                                 exception_state)) {
     DCHECK(exception_state.HadException());
     return;
   }
@@ -2949,7 +2946,6 @@
   visitor->Trace(dtls_transports_by_native_transport_);
   visitor->Trace(ice_transports_by_native_transport_);
   visitor->Trace(sctp_transport_);
-  visitor->Trace(rtp_transport_);
   EventTarget::Trace(visitor);
   ExecutionContextLifecycleObserver::Trace(visitor);
   MediaStreamObserver::Trace(visitor);
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
index adc950a6..e661a69 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
@@ -316,8 +316,6 @@
   // state.
   void UpdateIceConnectionState();
 
-  RTCRtpTransport* rtpTransport() { return rtp_transport_; }
-
   void Trace(Visitor*) const override;
 
   using RtcPeerConnectionHandlerFactoryCallback =
@@ -556,8 +554,6 @@
 
   // Insertable streams.
   bool encoded_insertable_streams_;
-
-  Member<RTCRtpTransport> rtp_transport_;
 };
 
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.idl b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.idl
index 72713912..688bfad 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.idl
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.idl
@@ -137,8 +137,6 @@
     // https://w3c.github.io/webrtc-pc/#sec.cert-mgmt
     [RaisesException, CallWith=ScriptState] static Promise<RTCCertificate> generateCertificate(AlgorithmIdentifier keygenAlgorithm);
 
-    [SameObject, RuntimeEnabled=RTCRtpTransport] readonly attribute RTCRtpTransport rtpTransport;
-
     // Non-standard or removed from the spec:
     [Measure] sequence<MediaStream> getLocalStreams();
     [Measure] sequence<MediaStream> getRemoteStreams();
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
index 2af2e5b..f5c0bcd 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
@@ -856,8 +856,7 @@
     const webrtc::PeerConnectionInterface::RTCConfiguration&
         server_configuration,
     WebLocalFrame* frame,
-    ExceptionState& exception_state,
-    RTCRtpTransport* rtp_transport) {
+    ExceptionState& exception_state) {
   DCHECK(task_runner_->RunsTasksInCurrentSequence());
   DCHECK(dependency_factory_);
 
@@ -911,8 +910,7 @@
   peer_connection_observer_ =
       MakeGarbageCollected<Observer>(weak_factory_.GetWeakPtr(), task_runner_);
   native_peer_connection_ = dependency_factory_->CreatePeerConnection(
-      configuration_, frame_, peer_connection_observer_, exception_state,
-      rtp_transport);
+      configuration_, frame_, peer_connection_observer_, exception_state);
   if (!native_peer_connection_.get()) {
     LOG(ERROR) << "Failed to initialize native PeerConnection.";
     return false;
@@ -933,8 +931,7 @@
     const webrtc::PeerConnectionInterface::RTCConfiguration&
         server_configuration,
     PeerConnectionTracker* peer_connection_tracker,
-    ExceptionState& exception_state,
-    RTCRtpTransport* rtp_transport) {
+    ExceptionState& exception_state) {
   DCHECK(task_runner_->RunsTasksInCurrentSequence());
   DCHECK(dependency_factory_);
 
@@ -947,8 +944,7 @@
       MakeGarbageCollected<Observer>(weak_factory_.GetWeakPtr(), task_runner_);
 
   native_peer_connection_ = dependency_factory_->CreatePeerConnection(
-      configuration_, nullptr, peer_connection_observer_, exception_state,
-      rtp_transport);
+      configuration_, nullptr, peer_connection_observer_, exception_state);
   if (!native_peer_connection_.get()) {
     LOG(ERROR) << "Failed to initialize native PeerConnection.";
     return false;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
index 7a11cab..89b2ff3 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
@@ -50,7 +50,6 @@
 class RTCAnswerOptionsPlatform;
 class RTCOfferOptionsPlatform;
 class RTCPeerConnectionHandlerClient;
-class RTCRtpTransport;
 class RTCSessionDescriptionInit;
 class RTCVoidRequest;
 class SetLocalDescriptionRequest;
@@ -131,16 +130,14 @@
       const webrtc::PeerConnectionInterface::RTCConfiguration&
           server_configuration,
       PeerConnectionTracker* peer_connection_tracker,
-      ExceptionState& exception_state,
-      RTCRtpTransport* rtp_transport);
+      ExceptionState& exception_state);
 
   virtual bool Initialize(
       ExecutionContext* context,
       const webrtc::PeerConnectionInterface::RTCConfiguration&
           server_configuration,
       WebLocalFrame* web_frame,
-      ExceptionState& exception_state,
-      RTCRtpTransport* rtp_transport);
+      ExceptionState& exception_state);
 
   virtual void Close();
   virtual void CloseAndUnregister();
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc
index 85119a2..39f4553 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler_test.cc
@@ -300,7 +300,7 @@
     DummyExceptionStateForTesting exception_state;
     EXPECT_TRUE(pc_handler_->InitializeForTest(
         webrtc::PeerConnectionInterface::RTCConfiguration(),
-        mock_tracker_.Get(), exception_state, /*rtp_transport=*/nullptr));
+        mock_tracker_.Get(), exception_state));
     mock_peer_connection_ = pc_handler_->native_peer_connection();
     ASSERT_TRUE(mock_peer_connection_);
     EXPECT_CALL(*mock_peer_connection_, Close());
@@ -1192,7 +1192,7 @@
   WebHeap::CollectAllGarbageForTesting();
   EXPECT_FALSE(pc_handler->Initialize(
       /*context=*/nullptr, webrtc::PeerConnectionInterface::RTCConfiguration(),
-      /*frame=*/nullptr, exception_state, /*rtp_transport=*/nullptr));
+      /*frame=*/nullptr, exception_state));
 }
 
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
index b35283c9..523acd3 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
@@ -374,12 +374,4 @@
   EXPECT_FALSE(scheduler->OptedOutFromAggressiveThrottlingForTest());
 }
 
-TEST_F(RTCPeerConnectionTest, GettingRtpTransportEarlySucceeds) {
-  V8TestingScope scope;
-
-  RTCPeerConnection* pc = CreatePC(scope);
-  EXPECT_NE(pc->rtpTransport(), nullptr);
-  EXPECT_EQ("", GetExceptionMessage(scope));
-}
-
 }  // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc b/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc
index d60820d9..73c30ac 100644
--- a/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer_test.cc
@@ -55,7 +55,7 @@
     DummyExceptionStateForTesting exception_state;
     peer_connection_ = dependency_factory_->CreatePeerConnection(
         webrtc::PeerConnectionInterface::RTCConfiguration(), nullptr, nullptr,
-        exception_state, /*rtp_transport=*/nullptr);
+        exception_state);
     EXPECT_CALL(
         *(static_cast<blink::MockPeerConnectionImpl*>(peer_connection_.get())),
         GetSctpTransport())
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
index b230402..c45b28e 100644
--- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -7968,7 +7968,6 @@
     getter pendingLocalDescription
     getter pendingRemoteDescription
     getter remoteDescription
-    getter rtpTransport
     getter sctp
     getter signalingState
     method addIceCandidate
@@ -12934,7 +12933,6 @@
     getter pendingLocalDescription
     getter pendingRemoteDescription
     getter remoteDescription
-    getter rtpTransport
     getter sctp
     getter signalingState
     method addIceCandidate