[sigslot] - Remove sigslot from JsepTransport.

Bug: webrtc:11943
Change-Id: I59231cf0d5b700d0ef2feb94d9619b8b4d30d655
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225552
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34529}
diff --git a/pc/jsep_transport.cc b/pc/jsep_transport.cc
index e720888..f0a062e 100644
--- a/pc/jsep_transport.cc
+++ b/pc/jsep_transport.cc
@@ -13,8 +13,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <functional>
 #include <memory>
-#include <utility>  // for std::pair
+#include <utility>
 
 #include "api/array_view.h"
 #include "api/candidate.h"
@@ -80,7 +81,8 @@
     std::unique_ptr<webrtc::DtlsSrtpTransport> dtls_srtp_transport,
     std::unique_ptr<DtlsTransportInternal> rtp_dtls_transport,
     std::unique_ptr<DtlsTransportInternal> rtcp_dtls_transport,
-    std::unique_ptr<SctpTransportInternal> sctp_transport)
+    std::unique_ptr<SctpTransportInternal> sctp_transport,
+    std::function<void()> rtcp_mux_active_callback)
     : network_thread_(rtc::Thread::Current()),
       mid_(mid),
       local_certificate_(local_certificate),
@@ -104,7 +106,8 @@
       sctp_transport_(sctp_transport
                           ? rtc::make_ref_counted<webrtc::SctpTransport>(
                                 std::move(sctp_transport))
-                          : nullptr) {
+                          : nullptr),
+      rtcp_mux_active_callback_(std::move(rtcp_mux_active_callback)) {
   TRACE_EVENT0("webrtc", "JsepTransport::JsepTransport");
   RTC_DCHECK(ice_transport_);
   RTC_DCHECK(rtp_dtls_transport_);
@@ -487,7 +490,7 @@
   }
   rtcp_dtls_transport_ = nullptr;  // Destroy this reference.
   // Notify the JsepTransportController to update the aggregate states.
-  SignalRtcpMuxActive();
+  rtcp_mux_active_callback_();
 }
 
 bool JsepTransport::SetSdes(const std::vector<CryptoParams>& cryptos,
diff --git a/pc/jsep_transport.h b/pc/jsep_transport.h
index 5e8cae0..fe6f582 100644
--- a/pc/jsep_transport.h
+++ b/pc/jsep_transport.h
@@ -11,6 +11,7 @@
 #ifndef PC_JSEP_TRANSPORT_H_
 #define PC_JSEP_TRANSPORT_H_
 
+#include <functional>
 #include <map>
 #include <memory>
 #include <string>
@@ -47,7 +48,6 @@
 #include "rtc_base/rtc_certificate.h"
 #include "rtc_base/ssl_fingerprint.h"
 #include "rtc_base/ssl_stream_adapter.h"
-#include "rtc_base/third_party/sigslot/sigslot.h"
 #include "rtc_base/thread.h"
 #include "rtc_base/thread_annotations.h"
 
@@ -86,7 +86,7 @@
 //
 // On Threading: JsepTransport performs work solely on the network thread, and
 // so its methods should only be called on the network thread.
-class JsepTransport : public sigslot::has_slots<> {
+class JsepTransport {
  public:
   // |mid| is just used for log statements in order to identify the Transport.
   // Note that |local_certificate| is allowed to be null since a remote
@@ -101,9 +101,10 @@
       std::unique_ptr<webrtc::DtlsSrtpTransport> dtls_srtp_transport,
       std::unique_ptr<DtlsTransportInternal> rtp_dtls_transport,
       std::unique_ptr<DtlsTransportInternal> rtcp_dtls_transport,
-      std::unique_ptr<SctpTransportInternal> sctp_transport);
+      std::unique_ptr<SctpTransportInternal> sctp_transport,
+      std::function<void()> rtcp_mux_active_callback);
 
-  ~JsepTransport() override;
+  ~JsepTransport();
 
   // Returns the MID of this transport. This is only used for logging.
   const std::string& mid() const { return mid_; }
@@ -226,11 +227,6 @@
     return nullptr;
   }
 
-  // This is signaled when RTCP-mux becomes active and
-  // |rtcp_dtls_transport_| is destroyed. The JsepTransportController will
-  // handle the signal and update the aggregate transport states.
-  sigslot::signal<> SignalRtcpMuxActive;
-
   // TODO(deadbeef): The methods below are only public for testing. Should make
   // them utility functions or objects so they can be tested independently from
   // this class.
@@ -326,6 +322,11 @@
   absl::optional<std::vector<int>> recv_extension_ids_
       RTC_GUARDED_BY(network_thread_);
 
+  // This is invoked when RTCP-mux becomes active and
+  // |rtcp_dtls_transport_| is destroyed. The JsepTransportController will
+  // receive the callback and update the aggregate transport states.
+  std::function<void()> rtcp_mux_active_callback_;
+
   RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport);
 };
 
diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc
index 95cf215..47fddd4 100644
--- a/pc/jsep_transport_controller.cc
+++ b/pc/jsep_transport_controller.cc
@@ -1056,13 +1056,14 @@
           content_info.name, 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(rtcp_dtls_transport), std::move(sctp_transport), [&]() {
+            RTC_DCHECK_RUN_ON(network_thread_);
+            UpdateAggregateStates_n();
+          });
 
   jsep_transport->rtp_transport()->SignalRtcpPacketReceived.connect(
       this, &JsepTransportController::OnRtcpPacketReceived_n);
 
-  jsep_transport->SignalRtcpMuxActive.connect(
-      this, &JsepTransportController::UpdateAggregateStates_n);
   transports_.RegisterTransport(content_info.name, std::move(jsep_transport));
   UpdateAggregateStates_n();
   return RTCError::OK();
diff --git a/pc/jsep_transport_unittest.cc b/pc/jsep_transport_unittest.cc
index 5f43340..ffca560 100644
--- a/pc/jsep_transport_unittest.cc
+++ b/pc/jsep_transport_unittest.cc
@@ -118,11 +118,10 @@
         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),
-        /*sctp_transport=*/nullptr);
+        /*sctp_transport=*/nullptr,
+        /*rtcp_mux_active_callback=*/[&]() { OnRtcpMuxActive(); });
 
     signal_rtcp_mux_active_received_ = false;
-    jsep_transport->SignalRtcpMuxActive.connect(
-        this, &JsepTransport2Test::OnRtcpMuxActive);
     return jsep_transport;
   }