Move ownership of ICE from DtlsTransport to JsepTransport.

It does not make sense for DtlsTransport to own ICE, and this arrangement will
not work when negotiating datagram or DTLS transport.  During negotiation, both
a DTLS transport and a datagram transport need to be ready to receive from the
same ICE transport, depending on which protocol is chosen by the answerer.  Once
the answerer chooses a protocol, the transport that is not chosen must be
deleted, but ICE must be left intact for use by the remaining transport.

Bug: webrtc:9719
Change-Id: Ibab969b574c981e3834ced71f8ff88008cb26a6c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139340
Reviewed-by: Anton Sukhanov <sukhanov@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28113}
diff --git a/pc/jsep_transport.h b/pc/jsep_transport.h
index fce21be..9add2e5 100644
--- a/pc/jsep_transport.h
+++ b/pc/jsep_transport.h
@@ -86,6 +86,8 @@
   JsepTransport(
       const std::string& mid,
       const rtc::scoped_refptr<rtc::RTCCertificate>& local_certificate,
+      std::unique_ptr<cricket::IceTransportInternal> ice_transport,
+      std::unique_ptr<cricket::IceTransportInternal> rtcp_ice_transport,
       std::unique_ptr<webrtc::RtpTransport> unencrypted_rtp_transport,
       std::unique_ptr<webrtc::SrtpTransport> sdes_transport,
       std::unique_ptr<webrtc::DtlsSrtpTransport> dtls_srtp_transport,
@@ -310,6 +312,11 @@
   std::unique_ptr<JsepTransportDescription> remote_description_
       RTC_GUARDED_BY(network_thread_);
 
+  // Ice transport which may be used by any of upper-layer transports (below).
+  // Owned by JsepTransport and guaranteed to outlive the transports below.
+  const std::unique_ptr<cricket::IceTransportInternal> ice_transport_;
+  const std::unique_ptr<cricket::IceTransportInternal> rtcp_ice_transport_;
+
   // To avoid downcasting and make it type safe, keep three unique pointers for
   // different SRTP mode and only one of these is non-nullptr.
   // Since these are const, the variables don't need locks;