Backed out 10 changesets (bug 1521879) for causing bug 1530107. a=backout
authorGurzau Raul <rgurzau@mozilla.com>
Mon, 25 Feb 2019 12:12:15 +0200
changeset 460830 445315bbfbf9b6ba6f5ea35443881bef19ecb6a8
parent 460829 a5673a48093044b1594658293bf5608aadcb3f32
child 460840 9f35adb8e466e30ccc7059bf5d787b8ab4054968
push id35607
push userrgurzau@mozilla.com
push dateMon, 25 Feb 2019 10:13:02 +0000
treeherdermozilla-central@445315bbfbf9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1521879, 1530107
milestone67.0a1
backs outf597a73a6eaca926be5f95caa7a06d9cdcf50f0e
0bb76534f20789fd4a4e9f5e2334039cd6b01074
abcb8be12adf2cc55fbced1f560f74af13e2b931
ed6c8d3bbfde906db03a72fefc367e40a4dcf2da
1addf1e15b55b1319f3b2fd6924aceecee946d30
6b709cd9a479ca9657308c6bdff2a8c02c67b7e4
07747027c59cded7d786e26ab51ab06f4dc227da
a6105ccc188c8973e0cb62e609c7917474a5ce37
48c9c643e7bbc281546d60c52bcb5bee9e9659bc
d4004105a04ad9a473930acb9c6a05d90cd9f028
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 10 changesets (bug 1521879) for causing bug 1530107. a=backout Backed out changeset f597a73a6eac (bug 1521879) Backed out changeset 0bb76534f207 (bug 1521879) Backed out changeset abcb8be12adf (bug 1521879) Backed out changeset ed6c8d3bbfde (bug 1521879) Backed out changeset 1addf1e15b55 (bug 1521879) Backed out changeset 6b709cd9a479 (bug 1521879) Backed out changeset 07747027c59c (bug 1521879) Backed out changeset a6105ccc188c (bug 1521879) Backed out changeset 48c9c643e7bb (bug 1521879) Backed out changeset d4004105a04a (bug 1521879)
CLOBBER
dom/media/moz.build
dom/media/tests/mochitest/mochitest.ini
dom/media/webrtc/MediaTransportChild.h
dom/media/webrtc/MediaTransportParent.h
dom/media/webrtc/PMediaTransport.ipdl
dom/media/webrtc/RTCCertificate.cpp
dom/media/webrtc/RTCCertificate.h
dom/media/webrtc/WebrtcGlobal.h
dom/media/webrtc/WebrtcIPCTraits.h
dom/media/webrtc/moz.build
gfx/vr/ipc/PVR.ipdl
media/mtransport/dtlsidentity.cpp
media/mtransport/dtlsidentity.h
media/mtransport/mediapacket.cpp
media/mtransport/mediapacket.h
media/mtransport/nr_socket_prsock.cpp
media/mtransport/nr_socket_prsock.h
media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c
media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
media/mtransport/third_party/nICEr/src/net/transport_addr.h
media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
media/webrtc/signaling/src/common/moz.build
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
media/webrtc/signaling/src/peerconnection/MediaTransportHandler.cpp
media/webrtc/signaling/src/peerconnection/MediaTransportHandler.h
media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.cpp
media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.h
media/webrtc/signaling/src/peerconnection/MediaTransportParent.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/moz.build
modules/libpref/components.conf
netwerk/ipc/NeckoChild.cpp
netwerk/ipc/PSocketProcessBridge.ipdl
netwerk/ipc/SocketProcessBridgeChild.cpp
netwerk/ipc/SocketProcessBridgeChild.h
netwerk/ipc/SocketProcessBridgeParent.cpp
netwerk/ipc/SocketProcessBridgeParent.h
netwerk/ipc/moz.build
taskcluster/ci/config.yml
taskcluster/ci/test/mochitest.yml
taskcluster/docs/attributes.rst
taskcluster/taskgraph/transforms/tests.py
testing/mochitest/runtests.py
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1521879: Adding PMediaTransport.ipdl requires a clobber.
+Bug 1524688: Deleting preprocessed manifests requires clobber.
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -170,26 +170,25 @@ EXPORTS += [
 ]
 
 EXPORTS.mozilla += [
     'MediaManager.h',
 ]
 
 EXPORTS.mozilla.media.webrtc += [
     'webrtc/WebrtcGlobal.h',
-    'webrtc/WebrtcIPCTraits.h',
 ]
 
 if not CONFIG['MOZ_WEBRTC']:
   EXPORTS.mtransport += [
       '../../media/mtransport/runnable_utils.h',
   ]
 
 IPDL_SOURCES += [
-    'webrtc/PWebrtcGlobal.ipdl',
+    'webrtc/PWebrtcGlobal.ipdl'
 ]
 
 EXPORTS.mozilla.dom += [
     'AudioDeviceInfo.h',
     'AudioStreamTrack.h',
     'AudioTrack.h',
     'AudioTrackList.h',
     'CanvasCaptureMediaStream.h',
@@ -202,18 +201,16 @@ EXPORTS.mozilla.dom += [
     'TextTrackCue.h',
     'TextTrackCueList.h',
     'TextTrackList.h',
     'TextTrackRegion.h',
     'VideoPlaybackQuality.h',
     'VideoStreamTrack.h',
     'VideoTrack.h',
     'VideoTrackList.h',
-    'webrtc/MediaTransportChild.h',
-    'webrtc/MediaTransportParent.h',
 ]
 
 UNIFIED_SOURCES += [
     'ADTSDecoder.cpp',
     'ADTSDemuxer.cpp',
     'AudioCaptureStream.cpp',
     'AudioChannelFormat.cpp',
     'AudioCompactor.cpp',
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -121,23 +121,23 @@ skip-if = (android_version == '18') # an
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_audioSynchronizationSourcesUnidirectional.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_audioContributingSources.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_checkPacketDumpHook.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudioNATSrflx.html]
-skip-if = toolkit == 'android' || (verify && (os == 'linux')) || socketprocess_e10s # websockets don't work on android (bug 1266217, IPV6 is busted in try which causes timeouts in socket process case (bug 1521117))
+skip-if = toolkit == 'android' || (verify && (os == 'linux')) # websockets don't work on android (bug 1266217)
 [test_peerConnection_basicAudioNATRelay.html]
-skip-if = toolkit == 'android' || (verify && debug && (os == 'linux')) || socketprocess_e10s # websockets don't work on android (bug 1266217, IPV6 is busted in try which causes timeouts in socket process case (bug 1521117))
+skip-if = toolkit == 'android' || (verify && debug && (os == 'linux')) # websockets don't work on android (bug 1266217)
 [test_peerConnection_basicAudioNATRelayTCP.html]
-skip-if = toolkit == 'android' || socketprocess_e10s # websockets don't work on android (bug 1266217, IPV6 is busted in try which causes timeouts in socket process case (bug 1521117))
+skip-if = toolkit == 'android' # websockets don't work on android (bug 1266217)
 [test_peerConnection_basicAudioNATRelayTLS.html]
-skip-if = true # need pyopenssl on builders, see bug 1323439 # toolkit == 'android' || socketprocess_e10s # websockets don't work on android (bug 1266217), IPV6 is busted in try which causes timeouts in socket process case (bug 1521117)
+skip-if = true # need pyopenssl on builders, see bug 1323439 # toolkit == 'android' # websockets don't work on android (bug 1266217)
 [test_peerConnection_basicAudioRequireEOC.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudioPcmaPcmuOnly.html]
 skip-if = android_version == '18'
 [test_peerConnection_basicAudioDynamicPtMissingRtpmap.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_basicAudioVerifyRtpHeaderExtensions.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
@@ -342,17 +342,17 @@ skip-if = (android_version == '18') # an
 [test_peerConnection_threeUnbundledConnections.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_selftest.html]
 # Bug 1227781: Crash with bogus TURN server.
 [test_peerConnection_bug1227781.html]
 [test_peerConnection_stats.html]
 skip-if = toolkit == 'android' # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858)
 [test_peerConnection_stats_relayProtocol.html]
-skip-if = toolkit == 'android' || socketprocess_e10s # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858, Bug 1521117)
+skip-if = toolkit == 'android' # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858)
 [test_peerConnection_sender_and_receiver_stats.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_trackless_sender_stats.html]
 skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
 [test_peerConnection_verifyDescriptions.html]
 skip-if = (android_version == '18')
 [test_fingerprinting_resistance.html]
 [test_getUserMedia_nonDefaultRate.html]
deleted file mode 100644
--- a/dom/media/webrtc/MediaTransportChild.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _MTRANSPORTCHILD_H__
-#define _MTRANSPORTCHILD_H__
-
-#include "mozilla/dom/PMediaTransportChild.h"
-
-namespace mozilla {
-class MediaTransportHandlerIPC;
-
-class MediaTransportChild : public dom::PMediaTransportChild {
- public:
-#ifdef MOZ_WEBRTC
-  explicit MediaTransportChild(MediaTransportHandlerIPC* aUser);
-  virtual ~MediaTransportChild();
-  mozilla::ipc::IPCResult RecvOnCandidate(const string& transportId,
-                                          const CandidateInfo& candidateInfo);
-  mozilla::ipc::IPCResult RecvOnAlpnNegotiated(const string& alpn);
-  mozilla::ipc::IPCResult RecvOnGatheringStateChange(const int& state);
-  mozilla::ipc::IPCResult RecvOnConnectionStateChange(const int& state);
-  mozilla::ipc::IPCResult RecvOnPacketReceived(const string& transportId,
-                                               const MediaPacket& packet);
-  mozilla::ipc::IPCResult RecvOnEncryptedSending(const string& transportId,
-                                                 const MediaPacket& packet);
-  mozilla::ipc::IPCResult RecvOnStateChange(const string& transportId,
-                                            const int& state);
-  mozilla::ipc::IPCResult RecvOnRtcpStateChange(const string& transportId,
-                                                const int& state);
-
- private:
-  RefPtr<MediaTransportHandlerIPC> mUser;
-#endif //MOZ_WEBRTC
-};
-
-}  // namespace mozilla
-#endif
deleted file mode 100644
--- a/dom/media/webrtc/MediaTransportParent.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _MTRANSPORTHANDLER_PARENT_H__
-#define _MTRANSPORTHANDLER_PARENT_H__
-
-#include "mozilla/dom/PMediaTransportParent.h"
-#include <memory>
-
-namespace mozilla {
-
-class MediaTransportParent : public dom::PMediaTransportParent {
- public:
-#ifdef MOZ_WEBRTC
-  MediaTransportParent();
-  virtual ~MediaTransportParent();
-
-  mozilla::ipc::IPCResult RecvGetIceLog(const nsCString& pattern,
-                                        GetIceLogResolver&& aResolve);
-  mozilla::ipc::IPCResult RecvClearIceLog();
-  mozilla::ipc::IPCResult RecvEnterPrivateMode();
-  mozilla::ipc::IPCResult RecvExitPrivateMode();
-  mozilla::ipc::IPCResult RecvCreateIceCtx(
-      const string& name, nsTArray<RTCIceServer>&& iceServers,
-      const RTCIceTransportPolicy& icePolicy);
-  mozilla::ipc::IPCResult RecvSetProxyServer(const PBrowserOrId& browserOrId,
-                                             const nsCString& alpn);
-  mozilla::ipc::IPCResult RecvEnsureProvisionalTransport(
-      const string& transportId, const string& localUfrag,
-      const string& localPwd, const int& componentCount);
-  mozilla::ipc::IPCResult RecvStartIceGathering(
-      const bool& defaultRouteOnly, const net::NrIceStunAddrArray& stunAddrs);
-  mozilla::ipc::IPCResult RecvActivateTransport(
-      const string& transportId, const string& localUfrag,
-      const string& localPwd, const int& componentCount,
-      const string& remoteUfrag, const string& remotePwd,
-      nsTArray<uint8_t>&& keyDer, nsTArray<uint8_t>&& certDer,
-      const int& authType, const bool& dtlsClient,
-      const DtlsDigestList& digests, const bool& privacyRequested);
-  mozilla::ipc::IPCResult RecvRemoveTransportsExcept(
-      const StringVector& transportIds);
-  mozilla::ipc::IPCResult RecvStartIceChecks(const bool& isControlling,
-                                             const bool& isOfferer,
-                                             const StringVector& iceOptions);
-  mozilla::ipc::IPCResult RecvSendPacket(const string& transportId,
-                                         const MediaPacket& packet);
-  mozilla::ipc::IPCResult RecvAddIceCandidate(const string& transportId,
-                                              const string& candidate);
-  mozilla::ipc::IPCResult RecvUpdateNetworkState(const bool& online);
-  mozilla::ipc::IPCResult RecvGetIceStats(
-      const string& transportId, const double& now,
-      const RTCStatsReportInternal& reportIn, GetIceStatsResolver&& aResolve);
-
-  void ActorDestroy(ActorDestroyReason aWhy);
-
- private:
-  // Hide the sigslot/MediaTransportHandler stuff from IPC.
-  class Impl;
-  std::unique_ptr<Impl> mImpl;
-#endif //MOZ_WEBRTC
-};
-}  // namespace mozilla
-#endif  //_MTRANSPORTHANDLER_PARENT_H__
deleted file mode 100644
--- a/dom/media/webrtc/PMediaTransport.ipdl
+++ /dev/null
@@ -1,100 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PSocketProcessBridge;
-
-#ifdef MOZ_WEBRTC
-include PBrowserOrId;
-
-// ParamTraits stuff for generated code and other classes we don't want to change
-include "mozilla/media/webrtc/WebrtcIPCTraits.h";
-using StringVector from "mozilla/media/webrtc/WebrtcIPCTraits.h";
-using CandidateInfo from "mozilla/media/webrtc/WebrtcIPCTraits.h";
-using DtlsDigestList from "mozilla/media/webrtc/WebrtcIPCTraits.h";
-using std::string from "ipc/IPCMessageUtils.h";
-using struct mozilla::dom::RTCStatsReportInternal from "mozilla/dom/RTCStatsReportBinding.h";
-using struct mozilla::dom::MovableRTCStatsReportInternal from "mozilla/media/webrtc/WebrtcGlobal.h";
-using WebrtcGlobalLog from "mozilla/media/webrtc/WebrtcGlobal.h";
-using mozilla::dom::RTCIceServer from "mozilla/dom/RTCConfigurationBinding.h";
-using mozilla::dom::RTCIceTransportPolicy from "mozilla/dom/RTCConfigurationBinding.h";
-
-// ParamTraits stuff for our own classes
-using MediaPacket from "mtransport/mediapacket.h";
-using net::NrIceStunAddrArray from "mozilla/net/PStunAddrsParams.h";
-#endif // MOZ_WEBRTC
-
-namespace mozilla {
-namespace dom {
-
-async protocol PMediaTransport {
-  manager PSocketProcessBridge;
-
-parent:
-  async __delete__();
-
-#ifdef MOZ_WEBRTC
-  async GetIceLog(nsCString pattern) returns (WebrtcGlobalLog loglines);
-  async ClearIceLog();
-  async EnterPrivateMode();
-  async ExitPrivateMode();
-
-  async CreateIceCtx(string name,
-                     RTCIceServer[] iceServers,
-                     RTCIceTransportPolicy icePolicy);
-
-  async SetProxyServer(PBrowserOrId browserOrId,
-                       nsCString alpn);
-
-  async EnsureProvisionalTransport(string transportId,
-                                   string localUfrag,
-                                   string localPwd,
-                                   int componentCount);
-
-  async StartIceGathering(bool defaultRouteOnly,
-                          NrIceStunAddrArray stunAddrs);
-
-  async ActivateTransport(string transportId,
-                          string localUfrag,
-                          string localPwd,
-                          int componentCount,
-                          string remoteUfrag,
-                          string remotePwd,
-                          uint8_t[] keyDer,
-                          uint8_t[] certDer,
-                          int authType,
-                          bool dtlsClient,
-                          DtlsDigestList digests,
-                          bool privacyRequested);
-
-  async RemoveTransportsExcept(StringVector transportIds);
-
-  async StartIceChecks(bool isControlling,
-                       bool isOfferer,
-                       StringVector iceOptions);
-
-  async SendPacket(string transportId, MediaPacket packet);
-
-  async AddIceCandidate(string transportId,
-                        string candidate);
-
-  async UpdateNetworkState(bool online);
-
-  async GetIceStats(string transportId,
-                    double now,
-                    RTCStatsReportInternal reportIn) returns (MovableRTCStatsReportInternal reportOut);
-
-child:
-  async OnCandidate(string transportId, CandidateInfo candidateInfo);
-  async OnAlpnNegotiated(string alpn);
-  async OnGatheringStateChange(int state);
-  async OnConnectionStateChange(int state);
-  async OnPacketReceived(string transportId, MediaPacket packet);
-  async OnEncryptedSending(string transportId, MediaPacket packet);
-  async OnStateChange(string transportId, int state);
-  async OnRtcpStateChange(string transportId, int state);
-
-#endif // MOZ_WEBRTC
-};
-} // namespace dom
-} // namespace mozilla
--- a/dom/media/webrtc/RTCCertificate.cpp
+++ b/dom/media/webrtc/RTCCertificate.cpp
@@ -10,17 +10,16 @@
 #include "cert.h"
 #include "jsapi.h"
 #include "mozilla/dom/CryptoKey.h"
 #include "mozilla/dom/RTCCertificateBinding.h"
 #include "mozilla/dom/WebCryptoCommon.h"
 #include "mozilla/dom/WebCryptoTask.h"
 #include "mozilla/Move.h"
 #include "mozilla/Sprintf.h"
-#include "mtransport/dtlsidentity.h"
 
 #include <cstdio>
 
 namespace mozilla {
 namespace dom {
 
 #define RTCCERTIFICATE_SC_VERSION 0x00000001
 
--- a/dom/media/webrtc/RTCCertificate.h
+++ b/dom/media/webrtc/RTCCertificate.h
@@ -14,21 +14,21 @@
 #include "sslt.h"
 #include "ScopedNSSTypes.h"
 
 #include "mozilla/ErrorResult.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/dom/CryptoKey.h"
 #include "mozilla/dom/RTCCertificateBinding.h"
+#include "mtransport/dtlsidentity.h"
 #include "js/StructuredClone.h"
 #include "js/TypeDecls.h"
 
 namespace mozilla {
-class DtlsIdentity;
 namespace dom {
 
 class ObjectOrString;
 
 class RTCCertificate final : public nsISupports, public nsWrapperCache {
  public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCCertificate)
--- a/dom/media/webrtc/WebrtcGlobal.h
+++ b/dom/media/webrtc/WebrtcGlobal.h
@@ -9,34 +9,16 @@
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/RTCStatsReportBinding.h"
 #include "nsAutoPtr.h"
 
 typedef mozilla::dom::RTCStatsReportInternal StatsReport;
 typedef nsTArray<nsAutoPtr<StatsReport>> RTCReports;
 typedef mozilla::dom::Sequence<nsString> WebrtcGlobalLog;
 
-namespace mozilla {
-namespace dom {
-// webidl dictionaries don't have move semantics, which is something that ipdl
-// needs for async returns. So, we create a "moveable" subclass that just
-// copies. _Really_ lame, but it gets the job done.
-struct MovableRTCStatsReportInternal : public RTCStatsReportInternal {
-  MovableRTCStatsReportInternal() = default;
-  explicit MovableRTCStatsReportInternal(RTCStatsReportInternal&& aReport) {
-    RTCStatsReportInternal::operator=(aReport);
-  }
-  explicit MovableRTCStatsReportInternal(
-      const RTCStatsReportInternal& aReport) {
-    RTCStatsReportInternal::operator=(aReport);
-  }
-};
-}  // namespace dom
-}  // namespace mozilla
-
 namespace IPC {
 
 template <typename T>
 struct ParamTraits<mozilla::dom::Sequence<T>> {
   typedef mozilla::dom::Sequence<T> paramType;
 
   static void Write(Message* aMsg, const paramType& aParam) {
     WriteParam(aMsg, static_cast<const FallibleTArray<T>&>(aParam));
@@ -64,31 +46,16 @@ struct ParamTraits<mozilla::dom::RTCStat
 template <>
 struct ParamTraits<mozilla::dom::RTCIceCandidateType>
     : public ContiguousEnumSerializer<
           mozilla::dom::RTCIceCandidateType,
           mozilla::dom::RTCIceCandidateType::Host,
           mozilla::dom::RTCIceCandidateType::EndGuard_> {};
 
 template <>
-struct ParamTraits<mozilla::dom::MovableRTCStatsReportInternal> {
-  typedef mozilla::dom::MovableRTCStatsReportInternal paramType;
-  static void Write(Message* aMsg, const paramType& aParam) {
-    WriteParam(
-        aMsg, static_cast<const mozilla::dom::RTCStatsReportInternal&>(aParam));
-  }
-  static bool Read(const Message* aMsg, PickleIterator* aIter,
-                   paramType* aResult) {
-    return ReadParam(
-        aMsg, aIter,
-        static_cast<mozilla::dom::RTCStatsReportInternal*>(aResult));
-  }
-};
-
-template <>
 struct ParamTraits<mozilla::dom::RTCStatsReportInternal> {
   typedef mozilla::dom::RTCStatsReportInternal paramType;
 
   static void Write(Message* aMsg, const paramType& aParam) {
     WriteParam(aMsg, aParam.mClosed);
     WriteParam(aMsg, aParam.mCodecStats);
     WriteParam(aMsg, aParam.mIceCandidatePairStats);
     WriteParam(aMsg, aParam.mIceCandidateStats);
@@ -296,47 +263,39 @@ struct ParamTraits<mozilla::dom::RTCIceC
   }
 };
 
 static void WriteRTCRtpStreamStats(
     Message* aMsg, const mozilla::dom::RTCRtpStreamStats& aParam) {
   WriteParam(aMsg, aParam.mBitrateMean);
   WriteParam(aMsg, aParam.mBitrateStdDev);
   WriteParam(aMsg, aParam.mCodecId);
-  WriteParam(aMsg, aParam.mFirCount);
   WriteParam(aMsg, aParam.mFramerateMean);
   WriteParam(aMsg, aParam.mFramerateStdDev);
-  WriteParam(aMsg, aParam.mKind);
-  WriteParam(aMsg, aParam.mLocalId);
   WriteParam(aMsg, aParam.mMediaTrackId);
   WriteParam(aMsg, aParam.mMediaType);
-  WriteParam(aMsg, aParam.mNackCount);
-  WriteParam(aMsg, aParam.mPliCount);
-  WriteParam(aMsg, aParam.mQpSum);
+  WriteParam(aMsg, aParam.mKind);
   WriteParam(aMsg, aParam.mRemoteId);
+  WriteParam(aMsg, aParam.mLocalId);
   WriteParam(aMsg, aParam.mSsrc);
   WriteParam(aMsg, aParam.mTransportId);
 }
 
 static bool ReadRTCRtpStreamStats(const Message* aMsg, PickleIterator* aIter,
                                   mozilla::dom::RTCRtpStreamStats* aResult) {
   if (!ReadParam(aMsg, aIter, &(aResult->mBitrateMean)) ||
       !ReadParam(aMsg, aIter, &(aResult->mBitrateStdDev)) ||
       !ReadParam(aMsg, aIter, &(aResult->mCodecId)) ||
-      !ReadParam(aMsg, aIter, &(aResult->mFirCount)) ||
       !ReadParam(aMsg, aIter, &(aResult->mFramerateMean)) ||
       !ReadParam(aMsg, aIter, &(aResult->mFramerateStdDev)) ||
-      !ReadParam(aMsg, aIter, &(aResult->mKind)) ||
-      !ReadParam(aMsg, aIter, &(aResult->mLocalId)) ||
       !ReadParam(aMsg, aIter, &(aResult->mMediaTrackId)) ||
       !ReadParam(aMsg, aIter, &(aResult->mMediaType)) ||
-      !ReadParam(aMsg, aIter, &(aResult->mNackCount)) ||
-      !ReadParam(aMsg, aIter, &(aResult->mPliCount)) ||
-      !ReadParam(aMsg, aIter, &(aResult->mQpSum)) ||
+      !ReadParam(aMsg, aIter, &(aResult->mKind)) ||
       !ReadParam(aMsg, aIter, &(aResult->mRemoteId)) ||
+      !ReadParam(aMsg, aIter, &(aResult->mLocalId)) ||
       !ReadParam(aMsg, aIter, &(aResult->mSsrc)) ||
       !ReadParam(aMsg, aIter, &(aResult->mTransportId))) {
     return false;
   }
 
   return true;
 }
 
@@ -344,62 +303,68 @@ template <>
 struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats> {
   typedef mozilla::dom::RTCInboundRTPStreamStats paramType;
 
   static void Write(Message* aMsg, const paramType& aParam) {
     WriteParam(aMsg, aParam.mBytesReceived);
     WriteParam(aMsg, aParam.mDiscardedPackets);
     WriteParam(aMsg, aParam.mFramesDecoded);
     WriteParam(aMsg, aParam.mJitter);
+    WriteParam(aMsg, aParam.mRoundTripTime);
     WriteParam(aMsg, aParam.mPacketsLost);
     WriteParam(aMsg, aParam.mPacketsReceived);
-    WriteParam(aMsg, aParam.mRoundTripTime);
     WriteRTCRtpStreamStats(aMsg, aParam);
     WriteRTCStats(aMsg, aParam);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter,
                    paramType* aResult) {
     if (!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
         !ReadParam(aMsg, aIter, &(aResult->mDiscardedPackets)) ||
         !ReadParam(aMsg, aIter, &(aResult->mFramesDecoded)) ||
         !ReadParam(aMsg, aIter, &(aResult->mJitter)) ||
+        !ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) ||
         !ReadParam(aMsg, aIter, &(aResult->mPacketsLost)) ||
         !ReadParam(aMsg, aIter, &(aResult->mPacketsReceived)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) ||
         !ReadRTCRtpStreamStats(aMsg, aIter, aResult) ||
         !ReadRTCStats(aMsg, aIter, aResult)) {
       return false;
     }
 
     return true;
   }
 };
 
 template <>
 struct ParamTraits<mozilla::dom::RTCOutboundRTPStreamStats> {
   typedef mozilla::dom::RTCOutboundRTPStreamStats paramType;
 
   static void Write(Message* aMsg, const paramType& aParam) {
     WriteParam(aMsg, aParam.mBytesSent);
     WriteParam(aMsg, aParam.mDroppedFrames);
-    WriteParam(aMsg, aParam.mFramesEncoded);
     WriteParam(aMsg, aParam.mPacketsSent);
     WriteParam(aMsg, aParam.mTargetBitrate);
+    WriteParam(aMsg, aParam.mFramesEncoded);
+    WriteParam(aMsg, aParam.mFirCount);
+    WriteParam(aMsg, aParam.mNackCount);
+    WriteParam(aMsg, aParam.mPliCount);
     WriteRTCRtpStreamStats(aMsg, aParam);
     WriteRTCStats(aMsg, aParam);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter,
                    paramType* aResult) {
     if (!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
         !ReadParam(aMsg, aIter, &(aResult->mDroppedFrames)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mFramesEncoded)) ||
         !ReadParam(aMsg, aIter, &(aResult->mPacketsSent)) ||
         !ReadParam(aMsg, aIter, &(aResult->mTargetBitrate)) ||
+        !ReadParam(aMsg, aIter, &(aResult->mFramesEncoded)) ||
+        !ReadParam(aMsg, aIter, &(aResult->mFirCount)) ||
+        !ReadParam(aMsg, aIter, &(aResult->mNackCount)) ||
+        !ReadParam(aMsg, aIter, &(aResult->mPliCount)) ||
         !ReadRTCRtpStreamStats(aMsg, aIter, aResult) ||
         !ReadRTCStats(aMsg, aIter, aResult)) {
       return false;
     }
 
     return true;
   }
 };
deleted file mode 100644
--- a/dom/media/webrtc/WebrtcIPCTraits.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _WEBRTC_IPC_TRAITS_H_
-#define _WEBRTC_IPC_TRAITS_H_
-
-#include "ipc/IPCMessageUtils.h"
-#include "mozilla/dom/BindingDeclarations.h"
-#include "mozilla/dom/RTCConfigurationBinding.h"
-#include "mozilla/media/webrtc/WebrtcGlobal.h"
-#include "mozilla/dom/CandidateInfo.h"
-#include "mozilla/MacroForEach.h"
-#include "mtransport/transportlayerdtls.h"
-#include <vector>
-
-namespace mozilla {
-typedef std::vector<std::string> StringVector;
-}
-
-namespace IPC {
-
-template <typename T>
-struct ParamTraits<std::vector<T>> {
-  typedef std::vector<T> paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam) {
-    aMsg->WriteUInt32(aParam.size());
-    for (const T& elem : aParam) {
-      WriteParam(aMsg, elem);
-    }
-  }
-
-  static bool Read(const Message* aMsg, PickleIterator* aIter,
-                   paramType* aResult) {
-    uint32_t size;
-    if (!aMsg->ReadUInt32(aIter, &size)) {
-      return false;
-    }
-    while (size--) {
-      // Only works when T is movable. Meh.
-      T elem;
-      if (!ReadParam(aMsg, aIter, &elem)) {
-        return false;
-      }
-      aResult->emplace_back(std::move(elem));
-    }
-
-    return true;
-  }
-};
-
-template <>
-struct ParamTraits<mozilla::dom::OwningStringOrStringSequence> {
-  typedef mozilla::dom::OwningStringOrStringSequence paramType;
-
-  // Ugh. OwningStringOrStringSequence already has this enum, but it is
-  // private generated code. So we have to re-create it.
-  enum Type { kUninitialized, kString, kStringSequence };
-
-  static void Write(Message* aMsg, const paramType& aParam) {
-    if (aParam.IsString()) {
-      aMsg->WriteInt16(kString);
-      WriteParam(aMsg, aParam.GetAsString());
-    } else if (aParam.IsStringSequence()) {
-      aMsg->WriteInt16(kStringSequence);
-      WriteParam(aMsg, aParam.GetAsStringSequence());
-    } else {
-      aMsg->WriteInt16(kUninitialized);
-    }
-  }
-
-  static bool Read(const Message* aMsg, PickleIterator* aIter,
-                   paramType* aResult) {
-    int16_t type;
-    if (!aMsg->ReadInt16(aIter, &type)) {
-      return false;
-    }
-
-    switch (type) {
-      case kUninitialized:
-        aResult->Uninit();
-        return true;
-      case kString:
-        return ReadParam(aMsg, aIter, &aResult->SetAsString());
-      case kStringSequence:
-        return ReadParam(aMsg, aIter, &aResult->SetAsStringSequence());
-    }
-
-    return false;
-  }
-};
-
-template <typename T>
-struct WebidlEnumSerializer
-    : public ContiguousEnumSerializer<T, T(0), T::EndGuard_> {};
-
-template <>
-struct ParamTraits<mozilla::dom::RTCIceCredentialType>
-    : public WebidlEnumSerializer<mozilla::dom::RTCIceCredentialType> {};
-
-template <>
-struct ParamTraits<mozilla::dom::RTCIceTransportPolicy>
-    : public WebidlEnumSerializer<mozilla::dom::RTCIceTransportPolicy> {};
-
-// A couple of recursive helper functions, allows syntax like:
-// WriteParams(aMsg, aParam.foo, aParam.bar, aParam.baz)
-// ReadParams(aMsg, aIter, aParam.foo, aParam.bar, aParam.baz)
-
-// Base case
-static void WriteParams(Message* aMsg) {}
-
-template <typename T0, typename... Tn>
-static void WriteParams(Message* aMsg, const T0& aArg,
-                        const Tn&... aRemainingArgs) {
-  WriteParam(aMsg, aArg);                // Write first arg
-  WriteParams(aMsg, aRemainingArgs...);  // Recurse for the rest
-}
-
-// Base case
-static bool ReadParams(const Message* aMsg, PickleIterator* aIter) {
-  return true;
-}
-
-template <typename T0, typename... Tn>
-static bool ReadParams(const Message* aMsg, PickleIterator* aIter, T0& aArg,
-                       Tn&... aRemainingArgs) {
-  return ReadParam(aMsg, aIter, &aArg) &&             // Read first arg
-         ReadParams(aMsg, aIter, aRemainingArgs...);  // Recurse for the rest
-}
-
-// Macros that allow syntax like:
-// DEFINE_IPC_SERIALIZER_WITH_FIELDS(SomeType, member1, member2, member3)
-// Makes sure that serialize/deserialize code do the same members in the same
-// order.
-#define ACCESS_PARAM_FIELD(Field) aParam.Field
-
-#define DEFINE_IPC_SERIALIZER_WITH_FIELDS(Type, ...)                         \
-  template <>                                                                \
-  struct ParamTraits<Type> {                                                 \
-    typedef Type paramType;                                                  \
-    static void Write(Message* aMsg, const paramType& aParam) {              \
-      WriteParams(aMsg, MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
-                                               (__VA_ARGS__)));              \
-    }                                                                        \
-                                                                             \
-    static bool Read(const Message* aMsg, PickleIterator* aIter,             \
-                     paramType* aResult) {                                   \
-      paramType& aParam = *aResult;                                          \
-      return ReadParams(aMsg, aIter,                                         \
-                        MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
-                                               (__VA_ARGS__)));              \
-    }                                                                        \
-  };
-
-DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::dom::RTCIceServer, mCredential,
-                                  mCredentialType, mUrl, mUrls, mUsername)
-
-DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::CandidateInfo, mCandidate,
-                                  mDefaultHostRtp, mDefaultPortRtp,
-                                  mDefaultHostRtcp, mDefaultPortRtcp)
-
-DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::DtlsDigest, algorithm_, value_)
-
-}  // namespace IPC
-
-#endif  // _WEBRTC_IPC_TRAITS_H_
--- a/dom/media/webrtc/moz.build
+++ b/dom/media/webrtc/moz.build
@@ -48,20 +48,16 @@ if CONFIG['MOZ_WEBRTC']:
         '/dom/media',
         '/media/libyuv/libyuv/include',
         '/media/webrtc/signaling/src/common',
         '/media/webrtc/signaling/src/common/browser_logging',
         '/media/webrtc/trunk',
         '/media/webrtc/trunk/webrtc'
     ]
 
-PREPROCESSED_IPDL_SOURCES += [
-    'PMediaTransport.ipdl',
-]
-
 XPIDL_SOURCES += [
     'nsITabSource.idl'
 ]
 
 UNIFIED_SOURCES += [
     'MediaEngineDefault.cpp',
     'MediaEngineSource.cpp',
     'MediaTrackConstraints.cpp',
--- a/gfx/vr/ipc/PVR.ipdl
+++ b/gfx/vr/ipc/PVR.ipdl
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
 using mozilla::gfx::OpenVRControllerType from "VRMessageUtils.h";
 using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
-include "VRMessageUtils.h";
 
 include GraphicsMessages;
 include protocol PVRGPU;
 
 include "VRMessageUtils.h";
 
 namespace mozilla {
 namespace gfx {
@@ -30,9 +29,9 @@ parent:
 
 child:
   async OpenVRControllerActionPathToParent(nsCString aPath);
   async OpenVRControllerManifestPathToParent(OpenVRControllerType aType, nsCString aPath);
   async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
 };
 
 } // namespace gfx
-} // namespace mozilla
+} // namespace mozilla
\ No newline at end of file
--- a/media/mtransport/dtlsidentity.cpp
+++ b/media/mtransport/dtlsidentity.cpp
@@ -14,17 +14,16 @@
 #include "sechash.h"
 #include "ssl.h"
 #include "mozpkix/nss_scoped_ptrs.h"
 #include "secerr.h"
 
 #include "mozilla/Sprintf.h"
 #include "mozilla/dom/CryptoBuffer.h"
 #include "mozilla/dom/CryptoKey.h"
-#include "ipc/IPCMessageUtils.h"
 
 namespace mozilla {
 
 // TODO(bug 1522632): This function should be moved to NSS
 static SECItem *ExportDEREncryptedPrivateKeyInfo(
     PK11SlotInfo *slot,    /* optional, encrypt key in this slot */
     SECOidTag algTag,      /* encrypt key with this algorithm */
     const SECItem *pwitem, /* password for PBE encryption */
--- a/media/mtransport/dtlsidentity.h
+++ b/media/mtransport/dtlsidentity.h
@@ -20,17 +20,16 @@
 // All code in this module requires NSS to be live.
 // Callers must initialize NSS and implement the nsNSSShutdownObject
 // protocol.
 namespace mozilla {
 
 class DtlsDigest {
  public:
   const static size_t kMaxDtlsDigestLength = HASH_LENGTH_MAX;
-  DtlsDigest() = default;
   explicit DtlsDigest(const std::string& algorithm) : algorithm_(algorithm) {}
   DtlsDigest(const std::string& algorithm, const std::vector<uint8_t>& value)
       : algorithm_(algorithm), value_(value) {
     MOZ_ASSERT(value.size() <= kMaxDtlsDigestLength);
   }
   ~DtlsDigest() = default;
 
   bool operator!=(const DtlsDigest& rhs) const { return !operator==(rhs); }
--- a/media/mtransport/mediapacket.cpp
+++ b/media/mtransport/mediapacket.cpp
@@ -2,99 +2,29 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mediapacket.h"
 
 #include <cstring>
-#include "ipc/IPCMessageUtils.h"
 
 namespace mozilla {
 
-MediaPacket::MediaPacket(const MediaPacket& orig)
-    : sdp_level_(orig.sdp_level_), type_(orig.type_) {
-  Copy(orig.data(), orig.len(), orig.capacity_);
-}
-
 void MediaPacket::Copy(const uint8_t* data, size_t len, size_t capacity) {
   if (capacity < len) {
     capacity = len;
   }
   data_.reset(new uint8_t[capacity]);
   len_ = len;
   capacity_ = capacity;
   memcpy(data_.get(), data, len);
 }
 
-void MediaPacket::Serialize(IPC::Message* aMsg) const {
-  aMsg->WriteUInt32(len_);
-  aMsg->WriteUInt32(capacity_);
-  if (len_) {
-    aMsg->WriteBytes(data_.get(), len_);
-  }
-  aMsg->WriteUInt32(encrypted_len_);
-  if (encrypted_len_) {
-    aMsg->WriteBytes(encrypted_data_.get(), encrypted_len_);
-  }
-  aMsg->WriteInt32(sdp_level_.isSome() ? *sdp_level_ : -1);
-  aMsg->WriteInt32(type_);
-}
-
-bool MediaPacket::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
-  Reset();
-  uint32_t len;
-  if (!aMsg->ReadUInt32(aIter, &len)) {
-    return false;
-  }
-  uint32_t capacity;
-  if (!aMsg->ReadUInt32(aIter, &capacity)) {
-    return false;
-  }
-  if (len) {
-    MOZ_RELEASE_ASSERT(capacity >= len);
-    UniquePtr<uint8_t[]> data(new uint8_t[capacity]);
-    if (!aMsg->ReadBytesInto(aIter, data.get(), len)) {
-      return false;
-    }
-    data_ = std::move(data);
-    len_ = len;
-    capacity_ = capacity;
-  }
-
-  if (!aMsg->ReadUInt32(aIter, &len)) {
-    return false;
-  }
-  if (len) {
-    UniquePtr<uint8_t[]> data(new uint8_t[len]);
-    if (!aMsg->ReadBytesInto(aIter, data.get(), len)) {
-      return false;
-    }
-    encrypted_data_ = std::move(data);
-    encrypted_len_ = len;
-  }
-
-  int32_t sdp_level;
-  if (!aMsg->ReadInt32(aIter, &sdp_level)) {
-    return false;
-  }
-
-  if (sdp_level >= 0) {
-    sdp_level_ = Some(sdp_level);
-  }
-
-  int32_t type;
-  if (!aMsg->ReadInt32(aIter, &type)) {
-    return false;
-  }
-  type_ = static_cast<Type>(type);
-  return true;
-}
-
 static bool IsRtp(const uint8_t* data, size_t len) {
   if (len < 2) return false;
 
   // Check if this is a RTCP packet. Logic based on the types listed in
   // media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
 
   // Anything outside this range is RTP.
   if ((data[1] < 192) || (data[1] > 207)) return true;
--- a/media/mtransport/mediapacket.h
+++ b/media/mtransport/mediapacket.h
@@ -7,49 +7,39 @@
 #ifndef mediapacket_h__
 #define mediapacket_h__
 
 #include <cstddef>
 #include <cstdint>
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Maybe.h"
 
-class PickleIterator;
-
-namespace IPC {
-class Message;
-}
-
 namespace mozilla {
 
 // TODO: It might be worthwhile to teach this class how to "borrow" a buffer.
 // That would make it easier to misuse, however, so maybe not worth it.
 class MediaPacket {
  public:
   MediaPacket() = default;
   MediaPacket(MediaPacket&& orig) = default;
-  MediaPacket(const MediaPacket& orig);
 
   // Takes ownership of the passed-in data
   void Take(UniquePtr<uint8_t[]>&& data, size_t len, size_t capacity = 0) {
     data_ = std::move(data);
     len_ = len;
     if (capacity < len) {
       capacity = len;
     }
     capacity_ = capacity;
   }
 
   void Reset() {
     data_.reset();
     len_ = 0;
     capacity_ = 0;
-    encrypted_data_.reset();
-    encrypted_len_ = 0;
-    sdp_level_.reset();
   }
 
   // Copies the passed-in data
   void Copy(const uint8_t* data, size_t len, size_t capacity = 0);
 
   uint8_t* data() const { return data_.get(); }
 
   size_t len() const { return len_; }
@@ -73,41 +63,21 @@ class MediaPacket {
   enum Type { UNCLASSIFIED, SRTP, SRTCP, DTLS, RTP, RTCP, SCTP };
 
   void Categorize();
 
   void SetType(Type type) { type_ = type; }
 
   Type type() const { return type_; }
 
-  void Serialize(IPC::Message* aMsg) const;
-  bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter);
-
  private:
   UniquePtr<uint8_t[]> data_;
   size_t len_ = 0;
   size_t capacity_ = 0;
   // Encrypted form of the data, if there is one.
   UniquePtr<uint8_t[]> encrypted_data_;
   size_t encrypted_len_ = 0;
   // SDP level that this packet belongs to, if known.
   Maybe<size_t> sdp_level_;
   Type type_ = UNCLASSIFIED;
 };
 }  // namespace mozilla
-
-namespace IPC {
-template <typename>
-struct ParamTraits;
-
-template <>
-struct ParamTraits<mozilla::MediaPacket> {
-  static void Write(Message* aMsg, const mozilla::MediaPacket& aParam) {
-    aParam.Serialize(aMsg);
-  }
-
-  static bool Read(const Message* aMsg, PickleIterator* aIter,
-                   mozilla::MediaPacket* aResult) {
-    return aResult->Deserialize(aMsg, aIter);
-  }
-};
-}  // namespace IPC
 #endif  // mediapacket_h__
--- a/media/mtransport/nr_socket_prsock.cpp
+++ b/media/mtransport/nr_socket_prsock.cpp
@@ -2093,17 +2093,17 @@ int NrSocketBase::CreateSocket(
     const std::shared_ptr<NrSocketProxyConfig> &config) {
   int r, _status;
 
   if (IsForbiddenAddress(addr)) {
     ABORT(R_REJECTED);
   }
 
   // create IPC bridge for content process
-  if (XRE_IsParentProcess() || XRE_IsSocketProcess()) {
+  if (XRE_IsParentProcess()) {
     *sock = new NrSocket();
   } else {
     switch (addr->protocol) {
       case IPPROTO_UDP:
         *sock = new NrUdpSocketIpc();
         break;
       case IPPROTO_TCP:
 #if defined(MOZILLA_INTERNAL_API)
--- a/media/mtransport/nr_socket_prsock.h
+++ b/media/mtransport/nr_socket_prsock.h
@@ -64,22 +64,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 #include "nsITCPSocketCallback.h"
 #include "mediapacket.h"
 #include "m_cpp_utils.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/ClearOnShutdown.h"
 
-// nICEr includes
-extern "C" {
-#include "transport_addr.h"
-#include "async_wait.h"
-}
-
 // Stub declaration for nICEr type
 typedef struct nr_socket_vtbl_ nr_socket_vtbl;
 typedef struct nr_socket_ nr_socket;
 
 #if defined(MOZILLA_INTERNAL_API)
 namespace mozilla {
 class NrSocketProxyConfig;
 namespace dom {
--- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate_pair.c
@@ -442,19 +442,16 @@ int nr_ice_candidate_pair_do_triggered_c
     int r,_status;
 
     if(pair->state==NR_ICE_PAIR_STATE_CANCELLED) {
       r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/CAND_PAIR(%s): Ignoring matching but canceled pair",pctx->label,pair->codeword);
       return(0);
     } else if(pair->state==NR_ICE_PAIR_STATE_SUCCEEDED) {
       r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/CAND_PAIR(%s): No new trigger check for succeeded pair",pctx->label,pair->codeword);
       return(0);
-    } else if (pair->local->stream->obsolete) {
-      r_log(LOG_ICE,LOG_DEBUG,"ICE-PEER(%s)/CAND_PAIR(%s): No new trigger check for pair with obsolete stream",pctx->label,pair->codeword);
-      return(0);
     }
 
     /* Do not run this logic more than once on a given pair */
     if(!pair->triggered){
       r_log(LOG_ICE,LOG_INFO,"ICE-PEER(%s)/CAND-PAIR(%s): triggered check on %s",pctx->label,pair->codeword,pair->as_string);
 
       pair->triggered=1;
 
--- a/media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
@@ -514,21 +514,17 @@ void nr_ice_gather_finished_cb(NR_SOCKET
 
 
     assert(cb_arg);
     if (!cb_arg)
       return;
     ctx = cand->ctx;
 
     ctx->uninitialized_candidates--;
-    if (cand->state == NR_ICE_CAND_STATE_FAILED) {
-      r_log(LOG_ICE,LOG_WARNING,"ICE(%s)/CAND(%s): failed to initialize, %d remaining",ctx->label,cand->label,ctx->uninitialized_candidates);
-    } else {
-      r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): initialized, %d remaining",ctx->label,cand->label,ctx->uninitialized_candidates);
-    }
+    r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): initialized, %d remaining",ctx->label,cand->codeword,ctx->uninitialized_candidates);
 
     /* Avoid the need for yet another initialization function */
     if (cand->state == NR_ICE_CAND_STATE_INITIALIZING && cand->type == HOST)
       cand->state = NR_ICE_CAND_STATE_INITIALIZED;
 
     if (cand->state == NR_ICE_CAND_STATE_INITIALIZED) {
       int was_pruned = 0;
 
@@ -546,22 +542,22 @@ void nr_ice_gather_finished_cb(NR_SOCKET
         if (nr_ice_ctx_pair_new_trickle_candidates(ctx, cand)) {
           r_log(LOG_ICE,LOG_ERR, "ICE(%s): All could not pair new trickle candidate",ctx->label);
           /* But continue */
         }
       }
     }
 
     if(ctx->uninitialized_candidates==0){
-      r_log(LOG_ICE,LOG_INFO,"ICE(%s): All candidates initialized",ctx->label);
+      r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): All candidates initialized",ctx->label);
       if (ctx->done_cb) {
         ctx->done_cb(0,0,ctx->cb_arg);
       }
       else {
-        r_log(LOG_ICE,LOG_INFO,"ICE(%s): No done_cb. We were probably destroyed.",ctx->label);
+        r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): No done_cb. We were probably destroyed.",ctx->label);
       }
     }
     else {
       r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): Waiting for %d candidates to be initialized",ctx->label, ctx->uninitialized_candidates);
     }
   }
 
 static int nr_ice_ctx_pair_new_trickle_candidates(nr_ice_ctx *ctx, nr_ice_candidate *cand)
--- a/media/mtransport/third_party/nICEr/src/net/transport_addr.h
+++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.h
@@ -39,18 +39,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 #ifdef WIN32
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #else
 #include <sys/socket.h>
 #include <netinet/in.h>
 #endif
 
-#include "r_types.h"
-
 /* Length of a string  hex representation of a MD5 hash */
 #define MAXIFNAME 33
 
 /* Generic transport address
 
    This spans both sockaddr_in and sockaddr_in6
  */
 typedef struct nr_transport_addr_ {
--- a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
+++ b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
@@ -127,17 +127,17 @@ class FakeAudioStreamTrack : public mozi
     for (auto& listener : mst->mListeners) {
       listener->NotifyQueuedChanges(nullptr, 0, segment);
     }
   }
 };
 
 class LoopbackTransport : public MediaTransportHandler {
  public:
-  LoopbackTransport() : MediaTransportHandler(nullptr) {
+  LoopbackTransport() {
     SetState("mux", TransportLayer::TS_INIT, false);
     SetState("mux", TransportLayer::TS_INIT, true);
     SetState("non-mux", TransportLayer::TS_INIT, false);
     SetState("non-mux", TransportLayer::TS_INIT, true);
   }
 
   static void InitAndConnect(LoopbackTransport& client,
                              LoopbackTransport& server) {
@@ -152,19 +152,19 @@ class LoopbackTransport : public MediaTr
   RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) override {
     return nullptr;
   }
 
   void ClearIceLog() override {}
   void EnterPrivateMode() override {}
   void ExitPrivateMode() override {}
 
-  nsresult CreateIceCtx(const std::string& aName,
-                        const nsTArray<dom::RTCIceServer>& aIceServers,
-                        dom::RTCIceTransportPolicy aIcePolicy) override {
+  nsresult Init(const std::string& aName,
+                const nsTArray<dom::RTCIceServer>& aIceServers,
+                dom::RTCIceTransportPolicy aIcePolicy) override {
     return NS_OK;
   }
 
   void Destroy() override {}
 
   // We will probably be able to move the proxy lookup stuff into
   // this class once we move mtransport to its own process.
   void SetProxyServer(NrSocketProxyConfig&& aProxyConfig) override {}
@@ -208,27 +208,48 @@ class LoopbackTransport : public MediaTr
     return nullptr;
   }
 
   void SendPacket(const std::string& aTransportId,
                   MediaPacket&& aPacket) override {
     peer_->SignalPacketReceived(aTransportId, aPacket);
   }
 
+  TransportLayer::State GetState(const std::string& aTransportId,
+                                 bool aRtcp) const override {
+    if (aRtcp) {
+      auto it = mRtcpStates.find(aTransportId);
+      if (it != mRtcpStates.end()) {
+        return it->second;
+      }
+    } else {
+      auto it = mRtpStates.find(aTransportId);
+      if (it != mRtpStates.end()) {
+        return it->second;
+      }
+    }
+
+    return TransportLayer::TS_NONE;
+  }
+
   void SetState(const std::string& aTransportId, TransportLayer::State aState,
                 bool aRtcp) {
     if (aRtcp) {
-      MediaTransportHandler::OnRtcpStateChange(aTransportId, aState);
+      mRtcpStates[aTransportId] = aState;
+      SignalRtcpStateChange(aTransportId, aState);
     } else {
-      MediaTransportHandler::OnStateChange(aTransportId, aState);
+      mRtpStates[aTransportId] = aState;
+      SignalStateChange(aTransportId, aState);
     }
   }
 
  private:
   RefPtr<MediaTransportHandler> peer_;
+  std::map<std::string, TransportLayer::State> mRtpStates;
+  std::map<std::string, TransportLayer::State> mRtcpStates;
 };
 
 class TestAgent {
  public:
   TestAgent()
       : audio_config_(109, "opus", 48000, 2, false),
         audio_conduit_(mozilla::AudioSessionConduit::Create(
             WebRtcCallWrapper::Create(), test_utils->sts_target())),
--- a/media/webrtc/signaling/src/common/moz.build
+++ b/media/webrtc/signaling/src/common/moz.build
@@ -1,19 +1,15 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 include('/media/webrtc/webrtc.mozbuild')
 
-EXPORTS.mozilla.dom += [
-    'CandidateInfo.h'
-]
-
 LOCAL_INCLUDES += [
     '/media/mtransport/third_party/nrappkit/src/util/libekr',
     '/media/webrtc/trunk',
     '/media/webrtc/trunk/webrtc',
 ]
 
 UNIFIED_SOURCES += [
     'browser_logging/CSFLog.cpp',
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -697,17 +697,17 @@ void MediaPipeline::CheckTransportStates
   }
 
   if (mRtpState == TransportLayer::TS_OPEN && mRtcpState == mRtpState) {
     mTransport->Attach(this);
     TransportReady_s();
   }
 }
 
-void MediaPipeline::SendPacket(MediaPacket&& packet) {
+void MediaPipeline::SendPacket(MediaPacket& packet) {
   ASSERT_ON_THREAD(mStsThread);
   MOZ_ASSERT(mRtpState == TransportLayer::TS_OPEN);
   MOZ_ASSERT(!mTransportId.empty());
   mTransportHandler->SendPacket(mTransportId, std::move(packet));
 }
 
 void MediaPipeline::IncrementRtpPacketsSent(int32_t aBytes) {
   ++mRtpPacketsSent;
@@ -1279,17 +1279,17 @@ void MediaPipeline::PipelineTransport::S
                                    packet.data(), packet.len());
     mPipeline->IncrementRtcpPacketsSent();
   }
 
   MOZ_LOG(gMediaPipelineLog, LogLevel::Debug,
           ("%s sending %s packet", mPipeline->mDescription.c_str(),
            (isRtp ? "RTP" : "RTCP")));
 
-  mPipeline->SendPacket(std::move(packet));
+  mPipeline->SendPacket(packet);
 }
 
 nsresult MediaPipeline::PipelineTransport::SendRtcpPacket(const uint8_t* aData,
                                                           size_t aLen) {
   nsAutoPtr<MediaPacket> packet(new MediaPacket);
   packet->Copy(aData, aLen, aLen + SRTP_MAX_EXPANSION);
   packet->SetType(MediaPacket::RTCP);
 
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -192,17 +192,17 @@ class MediaPipeline : public sigslot::ha
   virtual void TransportReady_s() {}
 
   void IncrementRtpPacketsSent(int aBytes);
   void IncrementRtcpPacketsSent();
   void IncrementRtpPacketsReceived(int aBytes);
   virtual void OnRtpPacketReceived(){};
   void IncrementRtcpPacketsReceived();
 
-  virtual void SendPacket(MediaPacket&& packet);
+  virtual void SendPacket(MediaPacket& packet);
 
   // Process slots on transports
   void RtpStateChange(const std::string& aTransportId, TransportLayer::State);
   void RtcpStateChange(const std::string& aTransportId, TransportLayer::State);
   virtual void CheckTransportStates();
   void PacketReceived(const std::string& aTransportId, MediaPacket& packet);
 
   void RtpPacketReceived(MediaPacket& packet);
--- a/media/webrtc/signaling/src/peerconnection/MediaTransportHandler.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaTransportHandler.cpp
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaTransportHandler.h"
-#include "MediaTransportHandlerIPC.h"
 #include "nricemediastream.h"
 #include "nriceresolver.h"
 #include "transportflow.h"
 #include "transportlayerice.h"
 #include "transportlayerdtls.h"
 #include "transportlayersrtp.h"
 
 // Config stuff
@@ -25,18 +24,16 @@
 #include "CSFLog.h"
 
 // For fetching ICE logging
 #include "rlogconnector.h"
 
 // DTLS
 #include "signaling/src/sdp/SdpAttribute.h"
 
-#include "runnable_utils.h"
-
 #include "mozilla/Telemetry.h"
 
 #include "mozilla/dom/RTCStatsReportBinding.h"
 
 #include <string>
 #include <vector>
 #include <map>
 
@@ -46,26 +43,26 @@ static const char* mthLogTag = "MediaTra
 #ifdef LOGTAG
 #  undef LOGTAG
 #endif
 #define LOGTAG mthLogTag
 
 class MediaTransportHandlerSTS : public MediaTransportHandler,
                                  public sigslot::has_slots<> {
  public:
-  explicit MediaTransportHandlerSTS(nsISerialEventTarget* aCallbackThread);
+  MediaTransportHandlerSTS();
 
   RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) override;
   void ClearIceLog() override;
   void EnterPrivateMode() override;
   void ExitPrivateMode() override;
 
-  nsresult CreateIceCtx(const std::string& aName,
-                        const nsTArray<dom::RTCIceServer>& aIceServers,
-                        dom::RTCIceTransportPolicy aIcePolicy) override;
+  nsresult Init(const std::string& aName,
+                const nsTArray<dom::RTCIceServer>& aIceServers,
+                dom::RTCIceTransportPolicy aIcePolicy) override;
   void Destroy() override;
 
   // We will probably be able to move the proxy lookup stuff into
   // this class once we move mtransport to its own process.
   void SetProxyServer(NrSocketProxyConfig&& aProxyConfig) override;
 
   void EnsureProvisionalTransport(const std::string& aTransportId,
                                   const std::string& aUfrag,
@@ -99,16 +96,19 @@ class MediaTransportHandlerSTS : public 
   void AddIceCandidate(const std::string& aTransportId,
                        const std::string& aCandidate) override;
 
   void UpdateNetworkState(bool aOnline) override;
 
   void SendPacket(const std::string& aTransportId,
                   MediaPacket&& aPacket) override;
 
+  TransportLayer::State GetState(const std::string& aTransportId,
+                                 bool aRtcp) const override;
+
   RefPtr<StatsPromise> GetIceStats(
       const std::string& aTransportId, DOMHighResTimeStamp aNow,
       std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) override;
 
  private:
   RefPtr<TransportFlow> CreateTransportFlow(const std::string& aTransportId,
                                             bool aIsRtcp,
                                             RefPtr<DtlsIdentity> aDtlsIdentity,
@@ -116,25 +116,16 @@ class MediaTransportHandlerSTS : public 
                                             const DtlsDigestList& aDigests,
                                             bool aPrivacyRequested);
 
   struct Transport {
     RefPtr<TransportFlow> mFlow;
     RefPtr<TransportFlow> mRtcpFlow;
   };
 
-  using MediaTransportHandler::OnAlpnNegotiated;
-  using MediaTransportHandler::OnCandidate;
-  using MediaTransportHandler::OnConnectionStateChange;
-  using MediaTransportHandler::OnEncryptedSending;
-  using MediaTransportHandler::OnGatheringStateChange;
-  using MediaTransportHandler::OnPacketReceived;
-  using MediaTransportHandler::OnRtcpStateChange;
-  using MediaTransportHandler::OnStateChange;
-
   void OnGatheringStateChange(NrIceCtx* aIceCtx,
                               NrIceCtx::GatheringState aState);
   void OnConnectionStateChange(NrIceCtx* aIceCtx,
                                NrIceCtx::ConnectionState aState);
   void OnCandidateFound(NrIceMediaStream* aStream,
                         const std::string& aCandidate);
   void OnStateChange(TransportLayer* aLayer, TransportLayer::State);
   void OnRtcpStateChange(TransportLayer* aLayer, TransportLayer::State);
@@ -145,35 +136,33 @@ class MediaTransportHandlerSTS : public 
   void GetIceStats(const NrIceMediaStream& aStream, DOMHighResTimeStamp aNow,
                    dom::RTCStatsReportInternal* aReport) const;
 
   virtual ~MediaTransportHandlerSTS() = default;
   nsCOMPtr<nsISerialEventTarget> mStsThread;
   RefPtr<NrIceCtx> mIceCtx;
   RefPtr<NrIceResolver> mDNSResolver;
   std::map<std::string, Transport> mTransports;
+  std::map<std::string, TransportLayer::State> mStateCache;
+  std::map<std::string, TransportLayer::State> mRtcpStateCache;
   bool mProxyOnly = false;
 };
 
 /* static */
-already_AddRefed<MediaTransportHandler> MediaTransportHandler::Create(
-    nsISerialEventTarget* aCallbackThread) {
+already_AddRefed<MediaTransportHandler> MediaTransportHandler::Create() {
   RefPtr<MediaTransportHandler> result;
-  if (XRE_IsContentProcess() &&
-      Preferences::GetBool("media.peerconnection.mtransport_process")) {
-    result = new MediaTransportHandlerIPC(aCallbackThread);
+  if (Preferences::GetBool("media.peerconnection.mtransport_process")) {
+    // TODO: Return a MediaTransportHandlerIPC
   } else {
-    result = new MediaTransportHandlerSTS(aCallbackThread);
+    result = new MediaTransportHandlerSTS;
   }
   return result.forget();
 }
 
-MediaTransportHandlerSTS::MediaTransportHandlerSTS(
-    nsISerialEventTarget* aCallbackThread)
-    : MediaTransportHandler(aCallbackThread) {
+MediaTransportHandlerSTS::MediaTransportHandlerSTS() {
   nsresult rv;
   mStsThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
   if (!mStsThread) {
     MOZ_CRASH();
   }
 }
 
 static NrIceCtx::Policy toNrIcePolicy(dom::RTCIceTransportPolicy aPolicy) {
@@ -290,48 +279,36 @@ static nsresult addNrIceServer(const nsS
     if (!server) {
       return NS_ERROR_FAILURE;
     }
     aStunServersOut->emplace_back(std::move(*server));
   }
   return NS_OK;
 }
 
-/* static */
-nsresult MediaTransportHandler::ConvertIceServers(
-    const nsTArray<dom::RTCIceServer>& aIceServers,
-    std::vector<NrIceStunServer>* aStunServers,
-    std::vector<NrIceTurnServer>* aTurnServers) {
+nsresult MediaTransportHandlerSTS::Init(
+    const std::string& aName, const nsTArray<dom::RTCIceServer>& aIceServers,
+    dom::RTCIceTransportPolicy aIcePolicy) {
+  std::vector<NrIceStunServer> stunServers;
+  std::vector<NrIceTurnServer> turnServers;
+
+  nsresult rv;
   for (const auto& iceServer : aIceServers) {
     NS_ENSURE_STATE(iceServer.mUrls.WasPassed());
     NS_ENSURE_STATE(iceServer.mUrls.Value().IsStringSequence());
     for (const auto& iceUrl : iceServer.mUrls.Value().GetAsStringSequence()) {
-      nsresult rv =
-          addNrIceServer(iceUrl, iceServer, aStunServers, aTurnServers);
+      rv = addNrIceServer(iceUrl, iceServer, &stunServers, &turnServers);
       if (NS_FAILED(rv)) {
         CSFLogError(LOGTAG, "%s: invalid STUN/TURN server: %s", __FUNCTION__,
                     NS_ConvertUTF16toUTF8(iceUrl).get());
         return rv;
       }
     }
   }
 
-  return NS_OK;
-}
-
-nsresult MediaTransportHandlerSTS::CreateIceCtx(
-    const std::string& aName, const nsTArray<dom::RTCIceServer>& aIceServers,
-    dom::RTCIceTransportPolicy aIcePolicy) {
-  std::vector<NrIceStunServer> stunServers;
-  std::vector<NrIceTurnServer> turnServers;
-  nsresult rv = ConvertIceServers(aIceServers, &stunServers, &turnServers);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
   // This stuff will probably live on the other side of IPC; errors down here
   // will either need to be ignored, or plumbed back in some way other than
   // the return.
   bool allowLoopback =
       Preferences::GetBool("media.peerconnection.ice.loopback", false);
   bool tcpEnabled = Preferences::GetBool("media.peerconnection.ice.tcp", false);
   bool allowLinkLocal =
       Preferences::GetBool("media.peerconnection.ice.link_local", false);
@@ -375,23 +352,16 @@ nsresult MediaTransportHandlerSTS::Creat
     CSFLogError(LOGTAG, "%s: Failed to get dns resolver", __FUNCTION__);
     return rv;
   }
 
   return NS_OK;
 }
 
 void MediaTransportHandlerSTS::Destroy() {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                                      &MediaTransportHandlerSTS::Destroy),
-                         NS_DISPATCH_NORMAL);
-    return;
-  }
-
   disconnect_all();
   if (mIceCtx) {
     NrIceStats stats = mIceCtx->Destroy();
     CSFLogDebug(LOGTAG,
                 "Ice Telemetry: stun (retransmits: %d)"
                 "   turn (401s: %d   403s: %d   438s: %d)",
                 stats.stun_retransmits, stats.turn_401s, stats.turn_403s,
                 stats.turn_438s);
@@ -406,38 +376,22 @@ void MediaTransportHandlerSTS::Destroy()
                          stats.turn_438s);
     mIceCtx = nullptr;
   }
   mTransports.clear();
 }
 
 void MediaTransportHandlerSTS::SetProxyServer(
     NrSocketProxyConfig&& aProxyConfig) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(NewRunnableMethod<NrSocketProxyConfig&&>(
-        __func__, this, &MediaTransportHandlerSTS::SetProxyServer,
-        std::move(aProxyConfig)));
-    return;
-  }
-
   mIceCtx->SetProxyServer(std::move(aProxyConfig));
 }
 
 void MediaTransportHandlerSTS::EnsureProvisionalTransport(
     const std::string& aTransportId, const std::string& aUfrag,
     const std::string& aPwd, size_t aComponentCount) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::EnsureProvisionalTransport,
-                     aTransportId, aUfrag, aPwd, aComponentCount),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   RefPtr<NrIceMediaStream> stream(mIceCtx->GetStream(aTransportId));
   if (!stream) {
     CSFLogDebug(LOGTAG, "%s: Creating ICE media stream=%s components=%u",
                 mIceCtx->name().c_str(), aTransportId.c_str(),
                 static_cast<unsigned>(aComponentCount));
 
     std::ostringstream os;
     os << mIceCtx->name() << " transport-id=" << aTransportId;
@@ -461,27 +415,16 @@ void MediaTransportHandlerSTS::EnsurePro
 
 void MediaTransportHandlerSTS::ActivateTransport(
     const std::string& aTransportId, const std::string& aLocalUfrag,
     const std::string& aLocalPwd, size_t aComponentCount,
     const std::string& aUfrag, const std::string& aPassword,
     const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,
     SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
     bool aPrivacyRequested) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::ActivateTransport, aTransportId,
-                     aLocalUfrag, aLocalPwd, aComponentCount, aUfrag, aPassword,
-                     aKeyDer, aCertDer, aAuthType, aDtlsClient, aDigests,
-                     aPrivacyRequested),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   MOZ_ASSERT(aComponentCount);
   RefPtr<DtlsIdentity> dtlsIdentity(
       DtlsIdentity::Deserialize(aKeyDer, aCertDer, aAuthType));
   if (!dtlsIdentity) {
     MOZ_ASSERT(false);
     return;
   }
 
@@ -546,25 +489,16 @@ void MediaTransportHandlerSTS::ActivateT
     stream->DisableComponent(2);
   }
 
   mTransports[aTransportId] = transport;
 }
 
 void MediaTransportHandlerSTS::StartIceGathering(
     bool aDefaultRouteOnly, const nsTArray<NrIceStunAddr>& aStunAddrs) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::StartIceGathering,
-                     aDefaultRouteOnly, aStunAddrs),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   // Belt and suspenders - in e10s mode, the call below to SetStunAddrs
   // needs to have the proper flags set on ice ctx.  For non-e10s,
   // setting those flags happens in StartGathering.  We could probably
   // just set them here, and only do it here.
   mIceCtx->SetCtxFlags(aDefaultRouteOnly, mProxyOnly);
 
   if (aStunAddrs.Length()) {
     mIceCtx->SetStunAddrs(aStunAddrs);
@@ -578,30 +512,22 @@ void MediaTransportHandlerSTS::StartIceG
 
   CSFLogWarn(LOGTAG,
              "%s: No streams to start gathering on. Can happen with rollback",
              __FUNCTION__);
 
   // If there are no streams, we're probably in a situation where we've rolled
   // back while still waiting for our proxy configuration to come back. Make
   // sure content knows that the rollback has stuck wrt gathering.
-  OnGatheringStateChange(dom::PCImplIceGatheringState::Complete);
+  SignalGatheringStateChange(dom::PCImplIceGatheringState::Complete);
 }
 
 void MediaTransportHandlerSTS::StartIceChecks(
     bool aIsControlling, bool aIsOfferer,
     const std::vector<std::string>& aIceOptions) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                                      &MediaTransportHandlerSTS::StartIceChecks,
-                                      aIsControlling, aIsOfferer, aIceOptions),
-                         NS_DISPATCH_NORMAL);
-    return;
-  }
-
   nsresult rv = mIceCtx->ParseGlobalAttributes(aIceOptions);
   if (NS_FAILED(rv)) {
     CSFLogError(LOGTAG, "%s: couldn't parse global parameters", __FUNCTION__);
     return;
   }
 
   rv = mIceCtx->SetControlling(aIsControlling ? NrIceCtx::ICE_CONTROLLING
                                               : NrIceCtx::ICE_CONTROLLED);
@@ -615,25 +541,16 @@ void MediaTransportHandlerSTS::StartIceC
   if (NS_FAILED(rv)) {
     CSFLogError(LOGTAG, "%s: couldn't start checks", __FUNCTION__);
     return;
   }
 }
 
 void MediaTransportHandlerSTS::AddIceCandidate(const std::string& aTransportId,
                                                const std::string& aCandidate) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::AddIceCandidate, aTransportId,
-                     aCandidate),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   RefPtr<NrIceMediaStream> stream(mIceCtx->GetStream(aTransportId));
   if (!stream) {
     CSFLogError(LOGTAG, "No ICE stream for candidate with transport id %s: %s",
                 aTransportId.c_str(), aCandidate.c_str());
     return;
   }
 
   nsresult rv = stream->ParseTrickleCandidate(aCandidate);
@@ -641,62 +558,38 @@ void MediaTransportHandlerSTS::AddIceCan
     CSFLogError(LOGTAG,
                 "Couldn't process ICE candidate with transport id %s: "
                 "%s",
                 aTransportId.c_str(), aCandidate.c_str());
   }
 }
 
 void MediaTransportHandlerSTS::UpdateNetworkState(bool aOnline) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::UpdateNetworkState, aOnline),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   mIceCtx->UpdateNetworkState(aOnline);
 }
 
 void MediaTransportHandlerSTS::RemoveTransportsExcept(
     const std::set<std::string>& aTransportIds) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::RemoveTransportsExcept,
-                     aTransportIds),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   for (auto it = mTransports.begin(); it != mTransports.end();) {
     if (!aTransportIds.count(it->first)) {
       if (it->second.mFlow) {
-        OnStateChange(it->first, TransportLayer::TS_NONE);
-        OnRtcpStateChange(it->first, TransportLayer::TS_NONE);
+        SignalStateChange(it->first, TransportLayer::TS_NONE);
+        SignalRtcpStateChange(it->first, TransportLayer::TS_NONE);
       }
       mIceCtx->DestroyStream(it->first);
       it = mTransports.erase(it);
     } else {
       MOZ_ASSERT(it->second.mFlow);
       ++it;
     }
   }
 }
 
 void MediaTransportHandlerSTS::SendPacket(const std::string& aTransportId,
                                           MediaPacket&& aPacket) {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(NewRunnableMethod<std::string, MediaPacket&&>(
-        __func__, this, &MediaTransportHandlerSTS::SendPacket, aTransportId,
-        std::move(aPacket)));
-    return;
-  }
-
   MOZ_ASSERT(aPacket.type() != MediaPacket::UNCLASSIFIED);
   RefPtr<TransportFlow> flow =
       GetTransportFlow(aTransportId, aPacket.type() == MediaPacket::RTCP);
 
   if (!flow) {
     CSFLogError(LOGTAG, "%s: No such transport flow (%s) for outgoing packet",
                 mIceCtx->name().c_str(), aTransportId.c_str());
     MOZ_ASSERT(false);
@@ -722,228 +615,66 @@ void MediaTransportHandlerSTS::SendPacke
   MOZ_ASSERT(layer);
 
   if (layer->SendPacket(aPacket) < 0) {
     CSFLogError(LOGTAG, "%s: Transport flow (%s) failed to send packet",
                 mIceCtx->name().c_str(), aTransportId.c_str());
   }
 }
 
-TransportLayer::State MediaTransportHandler::GetState(
+TransportLayer::State MediaTransportHandlerSTS::GetState(
     const std::string& aTransportId, bool aRtcp) const {
   // TODO Bug 1520692: we should allow Datachannel to connect without
   // DTLS SRTP keys
-  if (mCallbackThread) {
-    MOZ_ASSERT(mCallbackThread->IsOnCurrentThread());
-  }
-
-  const std::map<std::string, TransportLayer::State>* cache = nullptr;
-  if (aRtcp) {
-    cache = &mRtcpStateCache;
-  } else {
-    cache = &mStateCache;
-  }
-
-  auto it = cache->find(aTransportId);
-  if (it != cache->end()) {
-    return it->second;
+  RefPtr<TransportFlow> flow = GetTransportFlow(aTransportId, aRtcp);
+  if (flow) {
+    return flow->GetLayer(TransportLayerDtls::ID())->state();
   }
   return TransportLayer::TS_NONE;
 }
 
-void MediaTransportHandler::OnCandidate(const std::string& aTransportId,
-                                        const CandidateInfo& aCandidateInfo) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                                           &MediaTransportHandler::OnCandidate,
-                                           aTransportId, aCandidateInfo),
-                              NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  SignalCandidate(aTransportId, aCandidateInfo);
-}
-
-void MediaTransportHandler::OnAlpnNegotiated(const std::string& aAlpn) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnAlpnNegotiated, aAlpn),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  SignalAlpnNegotiated(aAlpn);
-}
-
-void MediaTransportHandler::OnGatheringStateChange(
-    dom::PCImplIceGatheringState aState) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnGatheringStateChange, aState),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  SignalGatheringStateChange(aState);
-}
-
-void MediaTransportHandler::OnConnectionStateChange(
-    dom::PCImplIceConnectionState aState) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnConnectionStateChange, aState),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  SignalConnectionStateChange(aState);
-}
-
-void MediaTransportHandler::OnPacketReceived(const std::string& aTransportId,
-                                             MediaPacket& aPacket) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnPacketReceived, aTransportId,
-                     aPacket),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  SignalPacketReceived(aTransportId, aPacket);
-}
-
-void MediaTransportHandler::OnEncryptedSending(const std::string& aTransportId,
-                                               MediaPacket& aPacket) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnEncryptedSending, aTransportId,
-                     aPacket),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  SignalEncryptedSending(aTransportId, aPacket);
-}
-
-void MediaTransportHandler::OnStateChange(const std::string& aTransportId,
-                                          TransportLayer::State aState) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnStateChange, aTransportId,
-                     aState),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  if (aState == TransportLayer::TS_NONE) {
-    mStateCache.erase(aTransportId);
-  } else {
-    mStateCache[aTransportId] = aState;
-  }
-  SignalStateChange(aTransportId, aState);
-}
-
-void MediaTransportHandler::OnRtcpStateChange(const std::string& aTransportId,
-                                              TransportLayer::State aState) {
-  if (mCallbackThread && !mCallbackThread->IsOnCurrentThread()) {
-    mCallbackThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandler>(this),
-                     &MediaTransportHandler::OnRtcpStateChange, aTransportId,
-                     aState),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  if (aState == TransportLayer::TS_NONE) {
-    mRtcpStateCache.erase(aTransportId);
-  } else {
-    mRtcpStateCache[aTransportId] = aState;
-  }
-  SignalRtcpStateChange(aTransportId, aState);
-}
-
 RefPtr<MediaTransportHandler::StatsPromise>
 MediaTransportHandlerSTS::GetIceStats(
     const std::string& aTransportId, DOMHighResTimeStamp aNow,
     std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) {
-  return InvokeAsync(
-      mStsThread, __func__,
-      [=, aReport = std::move(aReport),
-       self = RefPtr<MediaTransportHandlerSTS>(this)]() mutable {
-        if (mIceCtx) {
-          for (const auto& stream : mIceCtx->GetStreams()) {
-            if (aTransportId.empty() || aTransportId == stream->GetId()) {
-              GetIceStats(*stream, aNow, aReport.get());
-            }
-          }
-        }
-        return StatsPromise::CreateAndResolve(std::move(aReport), __func__);
-      });
+  for (const auto& stream : mIceCtx->GetStreams()) {
+    if (aTransportId.empty() || aTransportId == stream->GetId()) {
+      GetIceStats(*stream, aNow, aReport.get());
+    }
+  }
+  return StatsPromise::CreateAndResolve(std::move(aReport), __func__);
 }
 
 RefPtr<MediaTransportHandler::IceLogPromise>
 MediaTransportHandlerSTS::GetIceLog(const nsCString& aPattern) {
-  return InvokeAsync(
-      mStsThread, __func__, [=, self = RefPtr<MediaTransportHandlerSTS>(this)] {
-        dom::Sequence<nsString> converted;
-        RLogConnector* logs = RLogConnector::GetInstance();
-        nsAutoPtr<std::deque<std::string>> result(new std::deque<std::string>);
-        // Might not exist yet.
-        if (logs) {
-          logs->Filter(aPattern.get(), 0, result);
-        }
-        for (auto& line : *result) {
-          converted.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()),
-                                  fallible);
-        }
-        return IceLogPromise::CreateAndResolve(std::move(converted), __func__);
-      });
+  RLogConnector* logs = RLogConnector::GetInstance();
+  nsAutoPtr<std::deque<std::string>> result(new std::deque<std::string>);
+  // Might not exist yet.
+  if (logs) {
+    logs->Filter(aPattern.get(), 0, result);
+  }
+  dom::Sequence<nsString> converted;
+  for (auto& line : *result) {
+    converted.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()), fallible);
+  }
+  return IceLogPromise::CreateAndResolve(std::move(converted), __func__);
 }
 
 void MediaTransportHandlerSTS::ClearIceLog() {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                                      &MediaTransportHandlerSTS::ClearIceLog),
-                         NS_DISPATCH_NORMAL);
-    return;
-  }
-
   RLogConnector* logs = RLogConnector::GetInstance();
   if (logs) {
     logs->Clear();
   }
 }
 
 void MediaTransportHandlerSTS::EnterPrivateMode() {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::EnterPrivateMode),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   RLogConnector::CreateInstance()->EnterPrivateMode();
 }
 
 void MediaTransportHandlerSTS::ExitPrivateMode() {
-  if (!mStsThread->IsOnCurrentThread()) {
-    mStsThread->Dispatch(
-        WrapRunnable(RefPtr<MediaTransportHandlerSTS>(this),
-                     &MediaTransportHandlerSTS::ExitPrivateMode),
-        NS_DISPATCH_NORMAL);
-    return;
-  }
-
   auto* log = RLogConnector::GetInstance();
   MOZ_ASSERT(log);
   if (log) {
     log->ExitPrivateMode();
   }
 }
 
 static void ToRTCIceCandidateStats(
@@ -976,18 +707,16 @@ static void ToRTCIceCandidateStats(
       report->mTrickledIceCandidateStats.Value().AppendElement(cand, fallible);
     }
   }
 }
 
 void MediaTransportHandlerSTS::GetIceStats(
     const NrIceMediaStream& aStream, DOMHighResTimeStamp aNow,
     dom::RTCStatsReportInternal* aReport) const {
-  MOZ_ASSERT(mStsThread->IsOnCurrentThread());
-
   NS_ConvertASCIItoUTF16 transportId(aStream.GetId().c_str());
 
   std::vector<NrIceCandidatePair> candPairs;
   nsresult res = aStream.GetCandidatePairs(&candPairs);
   if (NS_FAILED(res)) {
     CSFLogError(LOGTAG,
                 "%s: Error getting candidate pairs for transport id \"%s\"",
                 __FUNCTION__, aStream.GetId().c_str());
@@ -1143,17 +872,17 @@ static mozilla::dom::PCImplIceGatheringS
 
 void MediaTransportHandlerSTS::OnGatheringStateChange(
     NrIceCtx* aIceCtx, NrIceCtx::GatheringState aState) {
   if (aState == NrIceCtx::ICE_CTX_GATHER_COMPLETE) {
     for (const auto& stream : mIceCtx->GetStreams()) {
       OnCandidateFound(stream, "");
     }
   }
-  OnGatheringStateChange(toDomIceGatheringState(aState));
+  SignalGatheringStateChange(toDomIceGatheringState(aState));
 }
 
 static mozilla::dom::PCImplIceConnectionState toDomIceConnectionState(
     NrIceCtx::ConnectionState aState) {
   switch (aState) {
     case NrIceCtx::ICE_CTX_INIT:
       return dom::PCImplIceConnectionState::New;
     case NrIceCtx::ICE_CTX_CHECKING:
@@ -1169,17 +898,17 @@ static mozilla::dom::PCImplIceConnection
     case NrIceCtx::ICE_CTX_CLOSED:
       return dom::PCImplIceConnectionState::Closed;
   }
   MOZ_CRASH();
 }
 
 void MediaTransportHandlerSTS::OnConnectionStateChange(
     NrIceCtx* aIceCtx, NrIceCtx::ConnectionState aState) {
-  OnConnectionStateChange(toDomIceConnectionState(aState));
+  SignalConnectionStateChange(toDomIceConnectionState(aState));
 }
 
 // The stuff below here will eventually go into the MediaTransportChild class
 void MediaTransportHandlerSTS::OnCandidateFound(NrIceMediaStream* aStream,
                                                 const std::string& aCandidate) {
   CandidateInfo info;
   info.mCandidate = aCandidate;
   NrIceCandidate defaultRtpCandidate;
@@ -1197,39 +926,49 @@ void MediaTransportHandlerSTS::OnCandida
   }
 
   // Optional; component won't exist if doing rtcp-mux
   if (NS_SUCCEEDED(aStream->GetDefaultCandidate(2, &defaultRtcpCandidate))) {
     info.mDefaultHostRtcp = defaultRtcpCandidate.cand_addr.host;
     info.mDefaultPortRtcp = defaultRtcpCandidate.cand_addr.port;
   }
 
-  OnCandidate(aStream->GetId(), info);
+  SignalCandidate(aStream->GetId(), info);
 }
 
 void MediaTransportHandlerSTS::OnStateChange(TransportLayer* aLayer,
                                              TransportLayer::State aState) {
   if (aState == TransportLayer::TS_OPEN) {
     MOZ_ASSERT(aLayer->id() == TransportLayerDtls::ID());
     TransportLayerDtls* dtlsLayer = static_cast<TransportLayerDtls*>(aLayer);
-    OnAlpnNegotiated(dtlsLayer->GetNegotiatedAlpn());
+    SignalAlpnNegotiated(dtlsLayer->GetNegotiatedAlpn());
   }
 
   // DTLS state indicates the readiness of the transport as a whole, because
   // SRTP uses the keys from the DTLS handshake.
-  MediaTransportHandler::OnStateChange(aLayer->flow_id(), aState);
+  if (aState == TransportLayer::TS_NONE) {
+    mStateCache.erase(aLayer->flow_id());
+  } else {
+    mStateCache[aLayer->flow_id()] = aState;
+  }
+  SignalStateChange(aLayer->flow_id(), aState);
 }
 
 void MediaTransportHandlerSTS::OnRtcpStateChange(TransportLayer* aLayer,
                                                  TransportLayer::State aState) {
-  MediaTransportHandler::OnRtcpStateChange(aLayer->flow_id(), aState);
+  if (aState == TransportLayer::TS_NONE) {
+    mRtcpStateCache.erase(aLayer->flow_id());
+  } else {
+    mRtcpStateCache[aLayer->flow_id()] = aState;
+  }
+  SignalRtcpStateChange(aLayer->flow_id(), aState);
 }
 
 void MediaTransportHandlerSTS::PacketReceived(TransportLayer* aLayer,
                                               MediaPacket& aPacket) {
-  OnPacketReceived(aLayer->flow_id(), aPacket);
+  SignalPacketReceived(aLayer->flow_id(), aPacket);
 }
 
 void MediaTransportHandlerSTS::EncryptedPacketSending(TransportLayer* aLayer,
                                                       MediaPacket& aPacket) {
-  OnEncryptedSending(aLayer->flow_id(), aPacket);
+  SignalEncryptedSending(aLayer->flow_id(), aPacket);
 }
 }  // namespace mozilla
--- a/media/webrtc/signaling/src/peerconnection/MediaTransportHandler.h
+++ b/media/webrtc/signaling/src/peerconnection/MediaTransportHandler.h
@@ -10,17 +10,16 @@
 #include "sigslot.h"
 #include "transportlayer.h"  // Need the State enum
 #include "dtlsidentity.h"    // For DtlsDigest
 #include "mozilla/dom/PeerConnectionImplEnumsBinding.h"
 #include "mozilla/dom/RTCConfigurationBinding.h"
 #include "nricectx.h"               // Need some enums
 #include "nsDOMNavigationTiming.h"  // DOMHighResTimeStamp
 #include "signaling/src/common/CandidateInfo.h"
-#include "nr_socket_proxy_config.h"
 
 #include "nsString.h"
 
 #include <string>
 #include <set>
 #include <vector>
 
 namespace mozilla {
@@ -33,47 +32,34 @@ class RTCStatsQuery;
 
 namespace dom {
 struct RTCStatsReportInternal;
 }
 
 class MediaTransportHandler {
  public:
   // Creates either a MediaTransportHandlerSTS or a MediaTransportHandlerIPC,
-  // as appropriate. If you want signals to fire on a specific thread, pass
-  // the event target here, otherwise they will fire on whatever is convenient.
-  // Note: This also determines what thread the state cache is updated on!
-  // Don't call GetState on any other thread!
-  static already_AddRefed<MediaTransportHandler> Create(
-      nsISerialEventTarget* aCallbackThread);
-
-  explicit MediaTransportHandler(nsISerialEventTarget* aCallbackThread)
-      : mCallbackThread(aCallbackThread) {}
-
-  static nsresult ConvertIceServers(
-      const nsTArray<dom::RTCIceServer>& aIceServers,
-      std::vector<NrIceStunServer>* aStunServers,
-      std::vector<NrIceTurnServer>* aTurnServers);
+  // as appropriate.
+  static already_AddRefed<MediaTransportHandler> Create();
 
   typedef MozPromise<dom::Sequence<nsString>, nsresult, true> IceLogPromise;
 
   // There's a wrinkle here; the ICE logging is not separated out by
   // MediaTransportHandler. These are a little more like static methods, but
   // to avoid needing yet another IPC interface, we bolt them on here.
   virtual RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) = 0;
   virtual void ClearIceLog() = 0;
   virtual void EnterPrivateMode() = 0;
   virtual void ExitPrivateMode() = 0;
 
+  virtual nsresult Init(const std::string& aName,
+                        const nsTArray<dom::RTCIceServer>& aIceServers,
+                        dom::RTCIceTransportPolicy aIcePolicy) = 0;
   virtual void Destroy() = 0;
 
-  virtual nsresult CreateIceCtx(const std::string& aName,
-                                const nsTArray<dom::RTCIceServer>& aIceServers,
-                                dom::RTCIceTransportPolicy aIcePolicy) = 0;
-
   // We will probably be able to move the proxy lookup stuff into
   // this class once we move mtransport to its own process.
   virtual void SetProxyServer(NrSocketProxyConfig&& aProxyConfig) = 0;
 
   virtual void EnsureProvisionalTransport(const std::string& aTransportId,
                                           const std::string& aLocalUfrag,
                                           const std::string& aLocalPwd,
                                           size_t aComponentCount) = 0;
@@ -104,16 +90,19 @@ class MediaTransportHandler {
   virtual void SendPacket(const std::string& aTransportId,
                           MediaPacket&& aPacket) = 0;
 
   virtual void AddIceCandidate(const std::string& aTransportId,
                                const std::string& aCandidate) = 0;
 
   virtual void UpdateNetworkState(bool aOnline) = 0;
 
+  virtual TransportLayer::State GetState(const std::string& aTransportId,
+                                         bool aRtcp) const = 0;
+
   // dom::RTCStatsReportInternal doesn't have move semantics.
   typedef MozPromise<std::unique_ptr<dom::RTCStatsReportInternal>, nsresult,
                      true>
       StatsPromise;
   virtual RefPtr<StatsPromise> GetIceStats(
       const std::string& aTransportId, DOMHighResTimeStamp aNow,
       std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) = 0;
 
@@ -124,33 +113,15 @@ class MediaTransportHandler {
 
   sigslot::signal2<const std::string&, MediaPacket&> SignalPacketReceived;
   sigslot::signal2<const std::string&, MediaPacket&> SignalEncryptedSending;
   sigslot::signal2<const std::string&, TransportLayer::State> SignalStateChange;
   sigslot::signal2<const std::string&, TransportLayer::State>
       SignalRtcpStateChange;
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTransportHandler)
 
-  TransportLayer::State GetState(const std::string& aTransportId,
-                                 bool aRtcp) const;
-
  protected:
-  void OnCandidate(const std::string& aTransportId,
-                   const CandidateInfo& aCandidateInfo);
-  void OnAlpnNegotiated(const std::string& aAlpn);
-  void OnGatheringStateChange(dom::PCImplIceGatheringState aState);
-  void OnConnectionStateChange(dom::PCImplIceConnectionState aState);
-  void OnPacketReceived(const std::string& aTransportId, MediaPacket& aPacket);
-  void OnEncryptedSending(const std::string& aTransportId,
-                          MediaPacket& aPacket);
-  void OnStateChange(const std::string& aTransportId,
-                     TransportLayer::State aState);
-  void OnRtcpStateChange(const std::string& aTransportId,
-                         TransportLayer::State aState);
   virtual ~MediaTransportHandler() = default;
-  std::map<std::string, TransportLayer::State> mStateCache;
-  std::map<std::string, TransportLayer::State> mRtcpStateCache;
-  RefPtr<nsISerialEventTarget> mCallbackThread;
 };
 
 }  // namespace mozilla
 
 #endif  //_MTRANSPORTHANDLER_H__
deleted file mode 100644
--- a/media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "MediaTransportHandlerIPC.h"
-#include "mozilla/dom/MediaTransportChild.h"
-#include "nsThreadUtils.h"
-#include "mozilla/net/SocketProcessBridgeChild.h"
-#include "mozilla/RefPtr.h"
-
-namespace mozilla {
-
-static const char* mthipcLogTag = "MediaTransportHandler";
-#ifdef LOGTAG
-#undef LOGTAG
-#endif
-#define LOGTAG mthipcLogTag
-
-MediaTransportHandlerIPC::MediaTransportHandlerIPC(
-    nsISerialEventTarget* aCallbackThread)
-    : MediaTransportHandler(aCallbackThread) {
-  mInitPromise = net::SocketProcessBridgeChild::GetSocketProcessBridge()->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [this, self = RefPtr<MediaTransportHandlerIPC>(this)](
-          const RefPtr<net::SocketProcessBridgeChild>& aBridge) {
-        mChild = new MediaTransportChild(this);
-        // SocketProcessBridgeChild owns mChild! When it is done with it,
-        // mChild will let us know it it going away.
-        aBridge->SetEventTargetForActor(mChild, GetMainThreadEventTarget());
-        aBridge->SendPMediaTransportConstructor(mChild);
-        return InitPromise::CreateAndResolve(true, __func__);
-      },
-      [=](const nsCString& aError) {
-        CSFLogError(LOGTAG,
-                    "MediaTransportHandlerIPC async init failed! Webrtc "
-                    "networking will not work! Error was %s",
-                    aError.get());
-        NS_WARNING(
-            "MediaTransportHandlerIPC async init failed! Webrtc networking "
-            "will not work!");
-        return InitPromise::CreateAndReject(aError, __func__);
-      });
-}
-
-RefPtr<MediaTransportHandler::IceLogPromise>
-MediaTransportHandlerIPC::GetIceLog(const nsCString& aPattern) {
-  return mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /* dummy */) {
-        if (!mChild) {
-          return IceLogPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
-        }
-        // Compiler has trouble deducing the return type here for some reason,
-        // so we use a temp variable as a hint.
-        // SendGetIceLog _almost_ returns an IceLogPromise; the reject value
-        // differs (ipc::ResponseRejectReason vs nsresult) so we need to
-        // convert.
-        RefPtr<IceLogPromise> promise = mChild->SendGetIceLog(aPattern)->Then(
-            GetMainThreadSerialEventTarget(), __func__,
-            [](WebrtcGlobalLog&& aLogLines) {
-              return IceLogPromise::CreateAndResolve(std::move(aLogLines),
-                                                     __func__);
-            },
-            [](ipc::ResponseRejectReason aReason) {
-              return IceLogPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
-            });
-        return promise;
-      },
-      [](const nsCString& aError) {
-        return IceLogPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
-      });
-}
-
-void MediaTransportHandlerIPC::ClearIceLog() {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendClearIceLog();
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::EnterPrivateMode() {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendEnterPrivateMode();
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::ExitPrivateMode() {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendExitPrivateMode();
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-nsresult MediaTransportHandlerIPC::CreateIceCtx(
-    const std::string& aName, const nsTArray<dom::RTCIceServer>& aIceServers,
-    dom::RTCIceTransportPolicy aIcePolicy) {
-  // Run some validation on this side of the IPC boundary so we can return
-  // errors synchronously. We don't actually use the results. It might make
-  // sense to move this check to PeerConnection and have this API take the
-  // converted form, but we would need to write IPC serialization code for
-  // the NrIce*Server types.
-  std::vector<NrIceStunServer> stunServers;
-  std::vector<NrIceTurnServer> turnServers;
-  nsresult rv = ConvertIceServers(aIceServers, &stunServers, &turnServers);
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendCreateIceCtx(aName, aIceServers, aIcePolicy);
-        }
-      },
-      [](const nsCString& aError) {});
-
-  return NS_OK;
-}
-
-void MediaTransportHandlerIPC::Destroy() {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          MediaTransportChild::Send__delete__(mChild);
-          mChild = nullptr;
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-// We will probably be able to move the proxy lookup stuff into
-// this class once we move mtransport to its own process.
-void MediaTransportHandlerIPC::SetProxyServer(
-    NrSocketProxyConfig&& aProxyConfig) {
-  // TODO(bug 1521113): This doesn't work on IPC
-#if 0
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [aProxyConfig = std::move(aProxyConfig), this,
-       self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) mutable {
-        if (mChild) {
-          mChild->SendSetProxyServer(aProxyConfig.GetBrowser(),
-                                     aProxyConfig.GetAlpn());
-        }
-      },
-      [](const nsCString& aError) {});
-#endif
-}
-
-void MediaTransportHandlerIPC::EnsureProvisionalTransport(
-    const std::string& aTransportId, const std::string& aLocalUfrag,
-    const std::string& aLocalPwd, size_t aComponentCount) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendEnsureProvisionalTransport(aTransportId, aLocalUfrag,
-                                                 aLocalPwd, aComponentCount);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-// We set default-route-only as late as possible because it depends on what
-// capture permissions have been granted on the window, which could easily
-// change between Init (ie; when the PC is created) and StartIceGathering
-// (ie; when we set the local description).
-void MediaTransportHandlerIPC::StartIceGathering(
-    bool aDefaultRouteOnly,
-    // TODO(bug 1522205): It probably makes sense to look this up internally
-    const nsTArray<NrIceStunAddr>& aStunAddrs) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendStartIceGathering(aDefaultRouteOnly, aStunAddrs);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::ActivateTransport(
-    const std::string& aTransportId, const std::string& aLocalUfrag,
-    const std::string& aLocalPwd, size_t aComponentCount,
-    const std::string& aUfrag, const std::string& aPassword,
-    const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,
-    SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
-    bool aPrivacyRequested) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendActivateTransport(
-              aTransportId, aLocalUfrag, aLocalPwd, aComponentCount, aUfrag,
-              aPassword, aKeyDer, aCertDer, aAuthType, aDtlsClient, aDigests,
-              aPrivacyRequested);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::RemoveTransportsExcept(
-    const std::set<std::string>& aTransportIds) {
-  std::vector<std::string> transportIds(aTransportIds.begin(),
-                                        aTransportIds.end());
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendRemoveTransportsExcept(transportIds);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::StartIceChecks(
-    bool aIsControlling, bool aIsOfferer,
-    const std::vector<std::string>& aIceOptions) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendStartIceChecks(aIsControlling, aIsOfferer, aIceOptions);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::SendPacket(const std::string& aTransportId,
-                                          MediaPacket&& aPacket) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [this, self = RefPtr<MediaTransportHandlerIPC>(this), aTransportId,
-       aPacket = std::move(aPacket)](bool /*dummy*/) mutable {
-        if (mChild) {
-          mChild->SendSendPacket(aTransportId, aPacket);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::AddIceCandidate(const std::string& aTransportId,
-                                               const std::string& aCandidate) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendAddIceCandidate(aTransportId, aCandidate);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-void MediaTransportHandlerIPC::UpdateNetworkState(bool aOnline) {
-  mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [=, self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) {
-        if (mChild) {
-          mChild->SendUpdateNetworkState(aOnline);
-        }
-      },
-      [](const nsCString& aError) {});
-}
-
-RefPtr<MediaTransportHandler::StatsPromise>
-MediaTransportHandlerIPC::GetIceStats(
-    const std::string& aTransportId, DOMHighResTimeStamp aNow,
-    std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) {
-  return mInitPromise->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      [aReport = std::move(aReport), aTransportId, aNow, this,
-       self = RefPtr<MediaTransportHandlerIPC>(this)](bool /*dummy*/) mutable {
-        if (!mChild) {
-          return StatsPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
-        }
-        RefPtr<StatsPromise> promise =
-            mChild->SendGetIceStats(aTransportId, aNow, *aReport)
-                ->Then(GetMainThreadSerialEventTarget(), __func__,
-                       [](const dom::MovableRTCStatsReportInternal& aReport) {
-                         std::unique_ptr<dom::RTCStatsReportInternal> report(
-                             new dom::RTCStatsReportInternal(aReport));
-                         return StatsPromise::CreateAndResolve(
-                             std::move(report), __func__);
-                       },
-                       [](ipc::ResponseRejectReason aReason) {
-                         return StatsPromise::CreateAndReject(NS_ERROR_FAILURE,
-                                                              __func__);
-                       });
-        return promise;
-      },
-      [](const nsCString& aError) {
-        return StatsPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
-      });
-}
-
-MediaTransportChild::MediaTransportChild(MediaTransportHandlerIPC* aUser)
-    : mUser(aUser) {}
-
-MediaTransportChild::~MediaTransportChild() {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->mChild = nullptr;
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnCandidate(
-    const string& transportId, const CandidateInfo& candidateInfo) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->OnCandidate(transportId, candidateInfo);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnAlpnNegotiated(
-    const string& alpn) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->OnAlpnNegotiated(alpn);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnGatheringStateChange(
-    const int& state) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->OnGatheringStateChange(
-      static_cast<dom::PCImplIceGatheringState>(state));
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnConnectionStateChange(
-    const int& state) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->OnConnectionStateChange(
-      static_cast<dom::PCImplIceConnectionState>(state));
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnPacketReceived(
-    const string& transportId, const MediaPacket& packet) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  MediaPacket copy(packet);  // Laaaaaame! Might be safe to const_cast?
-  mUser->OnPacketReceived(transportId, copy);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnEncryptedSending(
-    const string& transportId, const MediaPacket& packet) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  MediaPacket copy(packet);  // Laaaaaame! Might be safe to const_cast?
-  mUser->OnEncryptedSending(transportId, copy);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnStateChange(
-    const string& transportId, const int& state) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->OnStateChange(transportId, static_cast<TransportLayer::State>(state));
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportChild::RecvOnRtcpStateChange(
-    const string& transportId, const int& state) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mUser->OnRtcpStateChange(transportId,
-                           static_cast<TransportLayer::State>(state));
-  return ipc::IPCResult::Ok();
-}
-
-}  // namespace mozilla
deleted file mode 100644
--- a/media/webrtc/signaling/src/peerconnection/MediaTransportHandlerIPC.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _MTRANSPORTHANDLER_IPC_H__
-#define _MTRANSPORTHANDLER_IPC_H__
-
-#include "signaling/src/peerconnection/MediaTransportHandler.h"
-#include "mozilla/dom/PMediaTransportChild.h"
-
-namespace mozilla {
-
-class MediaTransportChild;
-
-// Implementation of MediaTransportHandler that uses IPC (PMediaTransport) to
-// talk to mtransport on another process.
-class MediaTransportHandlerIPC : public MediaTransportHandler {
- public:
-  explicit MediaTransportHandlerIPC(nsISerialEventTarget* aCallbackThread);
-  RefPtr<IceLogPromise> GetIceLog(const nsCString& aPattern) override;
-  void ClearIceLog() override;
-  void EnterPrivateMode() override;
-  void ExitPrivateMode() override;
-
-  nsresult CreateIceCtx(const std::string& aName,
-                        const nsTArray<dom::RTCIceServer>& aIceServers,
-                        dom::RTCIceTransportPolicy aIcePolicy) override;
-  void Destroy() override;
-
-  // We will probably be able to move the proxy lookup stuff into
-  // this class once we move mtransport to its own process.
-  void SetProxyServer(NrSocketProxyConfig&& aProxyConfig) override;
-
-  void EnsureProvisionalTransport(const std::string& aTransportId,
-                                  const std::string& aLocalUfrag,
-                                  const std::string& aLocalPwd,
-                                  size_t aComponentCount) override;
-
-  // We set default-route-only as late as possible because it depends on what
-  // capture permissions have been granted on the window, which could easily
-  // change between Init (ie; when the PC is created) and StartIceGathering
-  // (ie; when we set the local description).
-  void StartIceGathering(bool aDefaultRouteOnly,
-                         // TODO: It probably makes sense to look
-                         // this up internally
-                         const nsTArray<NrIceStunAddr>& aStunAddrs) override;
-
-  void ActivateTransport(
-      const std::string& aTransportId, const std::string& aLocalUfrag,
-      const std::string& aLocalPwd, size_t aComponentCount,
-      const std::string& aUfrag, const std::string& aPassword,
-      const nsTArray<uint8_t>& aKeyDer, const nsTArray<uint8_t>& aCertDer,
-      SSLKEAType aAuthType, bool aDtlsClient, const DtlsDigestList& aDigests,
-      bool aPrivacyRequested) override;
-
-  void RemoveTransportsExcept(
-      const std::set<std::string>& aTransportIds) override;
-
-  void StartIceChecks(bool aIsControlling, bool aIsOfferer,
-                      const std::vector<std::string>& aIceOptions) override;
-
-  void SendPacket(const std::string& aTransportId,
-                  MediaPacket&& aPacket) override;
-
-  void AddIceCandidate(const std::string& aTransportId,
-                       const std::string& aCandidate) override;
-
-  void UpdateNetworkState(bool aOnline) override;
-
-  RefPtr<StatsPromise> GetIceStats(
-      const std::string& aTransportId, DOMHighResTimeStamp aNow,
-      std::unique_ptr<dom::RTCStatsReportInternal>&& aReport) override;
-
- private:
-  friend class MediaTransportChild;
-
-  // We do not own this; it will tell us when it is going away.
-  MediaTransportChild* mChild = nullptr;
-
-  // |mChild| can only be initted asynchronously, |mInitPromise| resolves
-  // when that happens. The |Then| calls make it convenient to dispatch API
-  // calls to main, which is a bonus.
-  // Init promise is not exclusive; this lets us call |Then| on it for every
-  // API call we get, instead of creating another promise each time.
-  typedef MozPromise<bool, nsCString, false> InitPromise;
-  RefPtr<InitPromise> mInitPromise;
-};
-
-}  // namespace mozilla
-
-#endif  //_MTRANSPORTHANDLER_IPC_H__
deleted file mode 100644
--- a/media/webrtc/signaling/src/peerconnection/MediaTransportParent.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/MediaTransportParent.h"
-#include "signaling/src/peerconnection/MediaTransportHandler.h"
-
-#include "nss.h"                // For NSS_NoDB_Init
-#include "mozilla/PublicSSL.h"  // For psm::InitializeCipherSuite
-#include "sigslot.h"
-
-namespace mozilla {
-
-// Deals with the MediaTransportHandler interface, so MediaTransportParent
-// doesn't have to..
-class MediaTransportParent::Impl : public sigslot::has_slots<> {
- public:
-  explicit Impl(MediaTransportParent* aParent)
-      : mHandler(
-            MediaTransportHandler::Create(GetMainThreadSerialEventTarget())),
-        mParent(aParent) {
-    mHandler->SignalCandidate.connect(this,
-                                      &MediaTransportParent::Impl::OnCandidate);
-    mHandler->SignalAlpnNegotiated.connect(
-        this, &MediaTransportParent::Impl::OnAlpnNegotiated);
-    mHandler->SignalGatheringStateChange.connect(
-        this, &MediaTransportParent::Impl::OnGatheringStateChange);
-    mHandler->SignalConnectionStateChange.connect(
-        this, &MediaTransportParent::Impl::OnConnectionStateChange);
-    mHandler->SignalPacketReceived.connect(
-        this, &MediaTransportParent::Impl::OnPacketReceived);
-    mHandler->SignalEncryptedSending.connect(
-        this, &MediaTransportParent::Impl::OnEncryptedSending);
-    mHandler->SignalStateChange.connect(
-        this, &MediaTransportParent::Impl::OnStateChange);
-    mHandler->SignalRtcpStateChange.connect(
-        this, &MediaTransportParent::Impl::OnRtcpStateChange);
-  }
-
-  virtual ~Impl() {
-    disconnect_all();
-    mHandler->Destroy();
-    mHandler = nullptr;
-  }
-
-  void OnCandidate(const std::string& aTransportId,
-                   const CandidateInfo& aCandidateInfo) {
-    NS_ENSURE_TRUE_VOID(mParent->SendOnCandidate(aTransportId, aCandidateInfo));
-  }
-
-  void OnAlpnNegotiated(const std::string& aAlpn) {
-    NS_ENSURE_TRUE_VOID(mParent->SendOnAlpnNegotiated(aAlpn));
-  }
-
-  void OnGatheringStateChange(dom::PCImplIceGatheringState aState) {
-    NS_ENSURE_TRUE_VOID(
-        mParent->SendOnGatheringStateChange(static_cast<int>(aState)));
-  }
-
-  void OnConnectionStateChange(dom::PCImplIceConnectionState aState) {
-    NS_ENSURE_TRUE_VOID(
-        mParent->SendOnConnectionStateChange(static_cast<int>(aState)));
-  }
-
-  void OnPacketReceived(const std::string& aTransportId, MediaPacket& aPacket) {
-    NS_ENSURE_TRUE_VOID(mParent->SendOnPacketReceived(aTransportId, aPacket));
-  }
-
-  void OnEncryptedSending(const std::string& aTransportId,
-                          MediaPacket& aPacket) {
-    NS_ENSURE_TRUE_VOID(mParent->SendOnEncryptedSending(aTransportId, aPacket));
-  }
-
-  void OnStateChange(const std::string& aTransportId,
-                     TransportLayer::State aState) {
-    NS_ENSURE_TRUE_VOID(mParent->SendOnStateChange(aTransportId, aState));
-  }
-
-  void OnRtcpStateChange(const std::string& aTransportId,
-                         TransportLayer::State aState) {
-    NS_ENSURE_TRUE_VOID(mParent->SendOnRtcpStateChange(aTransportId, aState));
-  }
-
-  RefPtr<MediaTransportHandler> mHandler;
-
- private:
-  MediaTransportParent* mParent;
-};
-
-MediaTransportParent::MediaTransportParent() : mImpl(new Impl(this)) {}
-
-MediaTransportParent::~MediaTransportParent() {}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvGetIceLog(
-    const nsCString& pattern, GetIceLogResolver&& aResolve) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->GetIceLog(pattern)->Then(
-      GetMainThreadSerialEventTarget(), __func__,
-      // IPDL doesn't give us a reject function, so we cannot reject async, so
-      // we are forced to resolve with an empty result. Laaaaaaame.
-      [aResolve = std::move(aResolve)](
-          MediaTransportHandler::IceLogPromise::ResolveOrRejectValue&&
-              aResult) mutable {
-        WebrtcGlobalLog logLines;
-        if (aResult.IsResolve()) {
-          logLines = std::move(aResult.ResolveValue());
-        }
-        aResolve(logLines);
-      });
-
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvClearIceLog() {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->ClearIceLog();
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvEnterPrivateMode() {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->EnterPrivateMode();
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvExitPrivateMode() {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->ExitPrivateMode();
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvCreateIceCtx(
-    const string& name, nsTArray<RTCIceServer>&& iceServers,
-    const RTCIceTransportPolicy& icePolicy) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  static bool nssStarted = false;
-  if (!nssStarted) {
-    if (NSS_NoDB_Init(nullptr) != SECSuccess) {
-      MOZ_CRASH();
-      return ipc::IPCResult::Fail(WrapNotNull(this), __func__,
-                                  "NSS_NoDB_Init failed");
-    }
-
-    if (NS_FAILED(mozilla::psm::InitializeCipherSuite())) {
-      MOZ_CRASH();
-      return ipc::IPCResult::Fail(WrapNotNull(this), __func__,
-                                  "InitializeCipherSuite failed");
-    }
-
-    mozilla::psm::DisableMD5();
-  }
-
-  nssStarted = true;
-
-  nsresult rv = mImpl->mHandler->CreateIceCtx(name, iceServers, icePolicy);
-  if (NS_FAILED(rv)) {
-    return ipc::IPCResult::Fail(WrapNotNull(this), __func__,
-                                "MediaTransportHandler::Init failed");
-  }
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvSetProxyServer(
-    const PBrowserOrId& browserOrId, const nsCString& alpn) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->SetProxyServer(NrSocketProxyConfig(browserOrId, alpn));
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvEnsureProvisionalTransport(
-    const string& transportId, const string& localUfrag, const string& localPwd,
-    const int& componentCount) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->EnsureProvisionalTransport(transportId, localUfrag, localPwd,
-                                              componentCount);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvStartIceGathering(
-    const bool& defaultRouteOnly, const net::NrIceStunAddrArray& stunAddrs) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->StartIceGathering(defaultRouteOnly, stunAddrs);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvActivateTransport(
-    const string& transportId, const string& localUfrag, const string& localPwd,
-    const int& componentCount, const string& remoteUfrag,
-    const string& remotePwd, nsTArray<uint8_t>&& keyDer,
-    nsTArray<uint8_t>&& certDer, const int& authType, const bool& dtlsClient,
-    const DtlsDigestList& digests, const bool& privacyRequested) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->ActivateTransport(
-      transportId, localUfrag, localPwd, componentCount, remoteUfrag, remotePwd,
-      keyDer, certDer, static_cast<SSLKEAType>(authType), dtlsClient, digests,
-      privacyRequested);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvRemoveTransportsExcept(
-    const StringVector& transportIds) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  std::set<std::string> ids(transportIds.begin(), transportIds.end());
-  mImpl->mHandler->RemoveTransportsExcept(ids);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvStartIceChecks(
-    const bool& isControlling, const bool& isOfferer,
-    const StringVector& iceOptions) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->StartIceChecks(isControlling, isOfferer, iceOptions);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvSendPacket(
-    const string& transportId, const MediaPacket& packet) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  MediaPacket copy(packet);  // Laaaaaaame.
-  mImpl->mHandler->SendPacket(transportId, std::move(copy));
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvAddIceCandidate(
-    const string& transportId, const string& candidate) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->AddIceCandidate(transportId, candidate);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvUpdateNetworkState(
-    const bool& online) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  mImpl->mHandler->UpdateNetworkState(online);
-  return ipc::IPCResult::Ok();
-}
-
-mozilla::ipc::IPCResult MediaTransportParent::RecvGetIceStats(
-    const string& transportId, const double& now,
-    const RTCStatsReportInternal& reportIn, GetIceStatsResolver&& aResolve) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-  // Copy, because we are handed a const reference (lame), and put in a
-  // unique_ptr because RTCStatsReportInternal doesn't have move semantics
-  // (also lame).
-  std::unique_ptr<dom::RTCStatsReportInternal> report(
-      new dom::RTCStatsReportInternal(reportIn));
-
-  mImpl->mHandler->GetIceStats(transportId, now, std::move(report))
-      ->Then(
-          GetMainThreadSerialEventTarget(), __func__,
-          // IPDL doesn't give us a reject function, so we cannot reject async,
-          // so we are forced to resolve with an unmodified result. Laaaaaaame.
-          [aResolve = std::move(aResolve),
-           reportIn](MediaTransportHandler::StatsPromise::ResolveOrRejectValue&&
-                         aResult) {
-            if (aResult.IsResolve()) {
-              MovableRTCStatsReportInternal copy(*aResult.ResolveValue());
-              aResolve(copy);
-            } else {
-              aResolve(MovableRTCStatsReportInternal(reportIn));
-            }
-          });
-
-  return ipc::IPCResult::Ok();
-}
-
-void MediaTransportParent::ActorDestroy(ActorDestroyReason aWhy) {
-  MOZ_ASSERT(GetMainThreadEventTarget()->IsOnCurrentThread());
-}
-
-}  // namespace mozilla
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
@@ -67,19 +67,17 @@ class PeerConnectionCtx {
 
   const std::map<const std::string, PeerConnectionImpl*>& mGetPeerConnections();
 
  private:
   // We could make these available only via accessors but it's too much trouble.
   std::map<const std::string, PeerConnectionImpl*> mPeerConnections;
 
   PeerConnectionCtx()
-      : mGMPReady(false),
-        mTransportHandler(
-            MediaTransportHandler::Create(GetMainThreadSerialEventTarget())) {}
+      : mGMPReady(false), mTransportHandler(MediaTransportHandler::Create()) {}
   // This is a singleton, so don't copy construct it, etc.
   PeerConnectionCtx(const PeerConnectionCtx& other) = delete;
   void operator=(const PeerConnectionCtx& other) = delete;
   virtual ~PeerConnectionCtx();
 
   nsresult Initialize();
   nsresult Cleanup();
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -303,17 +303,17 @@ PeerConnectionImpl::PeerConnectionImpl(c
       mSignalingState(PCImplSignalingState::SignalingStable),
       mIceConnectionState(PCImplIceConnectionState::New),
       mIceGatheringState(PCImplIceGatheringState::New),
       mWindow(nullptr),
       mCertificate(nullptr),
       mSTSThread(nullptr),
       mForceIceTcp(false),
       mMedia(nullptr),
-      mTransportHandler(nullptr),
+      mTransportHandler(MediaTransportHandler::Create()),
       mUuidGen(MakeUnique<PCUuidGenerator>()),
       mIceRestartCount(0),
       mIceRollbackCount(0),
       mHaveConfiguredCodecs(false),
       mAddCandidateErrorCount(0),
       mTrickle(true)  // TODO(ekr@rtfm.com): Use pref
       ,
       mPrivateWindow(false),
@@ -398,20 +398,16 @@ nsresult PeerConnectionImpl::Initialize(
 
   mPCObserver = do_GetWeakReference(&aObserver);
 
   // Find the STS thread
 
   mSTSThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &res);
   MOZ_ASSERT(mSTSThread);
 
-  // We do callback handling on STS instead of main to avoid media jank.
-  // Someday, we may have a dedicated thread for this.
-  mTransportHandler = MediaTransportHandler::Create(mSTSThread);
-
   // Initialize NSS if we are in content process. For chrome process, NSS should
   // already been initialized.
   if (XRE_IsParentProcess()) {
     // This code interferes with the C++ unit test startup code.
     nsCOMPtr<nsISupports> nssDummy = do_GetService("@mozilla.org/psm;1", &res);
     NS_ENSURE_SUCCESS(res, res);
   } else {
     NS_ENSURE_SUCCESS(res = InitNSSInContent(), res);
@@ -463,18 +459,18 @@ nsresult PeerConnectionImpl::Initialize(
   res = PeerConnectionCtx::InitializeGlobal(mThread, mSTSThread);
   NS_ENSURE_SUCCESS(res, res);
 
   nsTArray<dom::RTCIceServer> iceServers;
   if (aConfiguration.mIceServers.WasPassed()) {
     iceServers = aConfiguration.mIceServers.Value();
   }
 
-  res = mTransportHandler->CreateIceCtx("PC:" + GetName(), iceServers,
-                                        aConfiguration.mIceTransportPolicy);
+  res = mTransportHandler->Init("PC:" + GetName(), iceServers,
+                                aConfiguration.mIceTransportPolicy);
   if (NS_FAILED(res)) {
     CSFLogError(LOGTAG, "%s: Failed to init mtransport", __FUNCTION__);
     return NS_ERROR_FAILURE;
   }
 
   mMedia = new PeerConnectionMedia(this);
 
   // Connect ICE slots.
--- a/media/webrtc/signaling/src/peerconnection/moz.build
+++ b/media/webrtc/signaling/src/peerconnection/moz.build
@@ -19,18 +19,16 @@ LOCAL_INCLUDES += [
     '/media/webrtc/signaling/src/mediapipeline',
     '/media/webrtc/trunk',
     '/media/webrtc/trunk/webrtc',
     '/netwerk/srtp/src/include',
 ]
 
 UNIFIED_SOURCES += [
     'MediaTransportHandler.cpp',
-    'MediaTransportHandlerIPC.cpp',
-    'MediaTransportParent.cpp',
     'PacketDumper.cpp',
     'PeerConnectionCtx.cpp',
     'PeerConnectionImpl.cpp',
     'PeerConnectionMedia.cpp',
     'TransceiverImpl.cpp',
     'WebrtcGlobalInformation.cpp',
 ]
 
--- a/modules/libpref/components.conf
+++ b/modules/libpref/components.conf
@@ -13,16 +13,15 @@ UnloadFunc = 'mozilla::UnloadPrefsModule
 Classes = [
     {
         'cid': '{91ca2441-050f-4f7c-9df8-75b40ea40156}',
         'contract_ids': ['@mozilla.org/preferences-service;1'],
         'singleton': True,
         'type': 'mozilla::Preferences',
         'headers': ['mozilla/Preferences.h'],
         'constructor': 'mozilla::Preferences::GetInstanceForService',
-        'processes': ProcessSelector.ALLOW_IN_SOCKET_PROCESS,
     },
     {
         'cid': '{064d9cee-1dd2-11b2-83e3-d25ab0193c26}',
         'contract_ids': ['@mozilla.org/pref-localizedstring;1'],
         'type': 'nsPrefLocalizedString',
     },
 ]
--- a/netwerk/ipc/NeckoChild.cpp
+++ b/netwerk/ipc/NeckoChild.cpp
@@ -19,17 +19,16 @@
 #include "mozilla/net/DNSRequestChild.h"
 #include "mozilla/net/ChannelDiverterChild.h"
 #include "mozilla/net/IPCTransportProvider.h"
 #include "mozilla/dom/network/TCPSocketChild.h"
 #include "mozilla/dom/network/TCPServerSocketChild.h"
 #include "mozilla/dom/network/UDPSocketChild.h"
 #include "mozilla/net/AltDataOutputStreamChild.h"
 #include "mozilla/net/TrackingDummyChannelChild.h"
-#include "mozilla/net/SocketProcessBridgeChild.h"
 #ifdef MOZ_WEBRTC
 #  include "mozilla/net/StunAddrsRequestChild.h"
 #  include "mozilla/net/WebrtcProxyChannelChild.h"
 #endif
 
 #include "SerializedLoadContext.h"
 #include "nsGlobalWindow.h"
 #include "nsIOService.h"
@@ -63,17 +62,16 @@ void NeckoChild::InitNeckoChild() {
     mozilla::dom::ContentChild* cpc =
         mozilla::dom::ContentChild::GetSingleton();
     NS_ASSERTION(cpc, "Content Protocol is NULL!");
     if (NS_WARN_IF(cpc->IsShuttingDown())) {
       return;
     }
     gNeckoChild = cpc->SendPNeckoConstructor();
     NS_ASSERTION(gNeckoChild, "PNecko Protocol init failed!");
-    SocketProcessBridgeChild::GetSocketProcessBridge();
   }
 }
 
 PHttpChannelChild* NeckoChild::AllocPHttpChannelChild(
     const PBrowserOrId& browser, const SerializedLoadContext& loadContext,
     const HttpChannelCreationArgs& aOpenArgs) {
   // We don't allocate here: instead we always use IPDL constructor that takes
   // an existing HttpChildChannel
--- a/netwerk/ipc/PSocketProcessBridge.ipdl
+++ b/netwerk/ipc/PSocketProcessBridge.ipdl
@@ -1,35 +1,30 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PBackground;
-include protocol PMediaTransport;
 
 namespace mozilla {
 namespace net {
 
 /**
   * PSocketProcessBridge is the IPC protocol between content process and
   * socket process. This protocol allows socket process to send data to
   * content process bypassing parent process.
   * Once created, PSocketProcessBridgeChild is the actor that lives in
   * content process and PSocketProcessBridgeParent lives in
   * socket process.
   */
 nested(upto inside_cpow) sync protocol PSocketProcessBridge
 {
-  manages PMediaTransport;
-
 parent:
   async InitBackground(Endpoint<PBackgroundParent> aEndpoint);
 
-  async PMediaTransport();
-
 both:
   async Test();
 };
 
 }
 }
--- a/netwerk/ipc/SocketProcessBridgeChild.cpp
+++ b/netwerk/ipc/SocketProcessBridgeChild.cpp
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SocketProcessBridgeChild.h"
 #include "SocketProcessLogging.h"
 
 #include "mozilla/net/NeckoChild.h"
 #include "nsIObserverService.h"
 #include "nsThreadUtils.h"
-#include "mozilla/dom/PMediaTransportChild.h"
 
 namespace mozilla {
 namespace net {
 
 StaticRefPtr<SocketProcessBridgeChild>
     SocketProcessBridgeChild::sSocketProcessBridgeChild;
 
 NS_IMPL_ISUPPORTS(SocketProcessBridgeChild, nsIObserver)
@@ -43,59 +42,45 @@ SocketProcessBridgeChild::GetSingleton()
     return nullptr;
   }
 
   RefPtr<SocketProcessBridgeChild> child = sSocketProcessBridgeChild.get();
   return child.forget();
 }
 
 // static
-RefPtr<SocketProcessBridgeChild::GetPromise>
-SocketProcessBridgeChild::GetSocketProcessBridge() {
+void SocketProcessBridgeChild::EnsureSocketProcessBridge(
+    std::function<void()>&& aOnSuccess, std::function<void()>&& aOnFailure) {
+  MOZ_ASSERT(IsNeckoChild() && gNeckoChild);
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!gNeckoChild) {
-    return GetPromise::CreateAndReject(nsCString("No NeckoChild!"), __func__);
+    aOnFailure();
+    return;
   }
 
   if (sSocketProcessBridgeChild) {
-    return GetPromise::CreateAndResolve(sSocketProcessBridgeChild, __func__);
+    aOnSuccess();
+    return;
   }
 
-  return gNeckoChild->SendInitSocketProcessBridge()->Then(
+  gNeckoChild->SendInitSocketProcessBridge()->Then(
       GetMainThreadSerialEventTarget(), __func__,
-      [](NeckoChild::InitSocketProcessBridgePromise::ResolveOrRejectValue&&
-             aResult) {
-        if (!sSocketProcessBridgeChild) {
-          if (aResult.IsReject()) {
-            return GetPromise::CreateAndReject(
-                nsCString("SendInitSocketProcessBridge failed"), __func__);
-          }
-
-          if (!aResult.ResolveValue().IsValid()) {
-            return GetPromise::CreateAndReject(
-                nsCString(
-                    "SendInitSocketProcessBridge resolved with an invalid "
-                    "endpoint!"),
-                __func__);
-          }
-
-          if (!SocketProcessBridgeChild::Create(
-                  std::move(aResult.ResolveValue()))) {
-            return GetPromise::CreateAndReject(
-                nsCString("SendInitSocketProcessBridge resolved with a valid "
-                          "endpoint, "
-                          "but SocketProcessBridgeChild::Create failed!"),
-                __func__);
+      [onSuccess = std::move(aOnSuccess), onFailure = std::move(aOnFailure)](
+          Endpoint<PSocketProcessBridgeChild>&& aEndpoint) {
+        if (aEndpoint.IsValid()) {
+          if (SocketProcessBridgeChild::Create(std::move(aEndpoint))) {
+            onSuccess();
+            return;
           }
         }
-
-        return GetPromise::CreateAndResolve(sSocketProcessBridgeChild,
-                                            __func__);
-      });
+        onFailure();
+      },
+      [onFailure = std::move(aOnFailure)](
+          const mozilla::ipc::ResponseRejectReason) { onFailure(); });
 }
 
 SocketProcessBridgeChild::SocketProcessBridgeChild(
     Endpoint<PSocketProcessBridgeChild>&& aEndpoint)
     : mShuttingDown(false) {
   LOG(("CONSTRUCT SocketProcessBridgeChild::SocketProcessBridgeChild\n"));
 
   mInited = aEndpoint.Bind(this);
@@ -143,26 +128,10 @@ SocketProcessBridgeChild::Observe(nsISup
 }
 
 void SocketProcessBridgeChild::DeferredDestroy() {
   MOZ_ASSERT(NS_IsMainThread());
 
   sSocketProcessBridgeChild = nullptr;
 }
 
-dom::PMediaTransportChild*
-SocketProcessBridgeChild::AllocPMediaTransportChild() {
-  // We don't allocate here: MediaTransportHandlerIPC is in charge of that,
-  // so we don't need to know the implementation particulars here.
-  MOZ_ASSERT_UNREACHABLE(
-      "The only thing that ought to be creating a PMediaTransportChild is "
-      "MediaTransportHandlerIPC!");
-  return nullptr;
-}
-
-bool SocketProcessBridgeChild::DeallocPMediaTransportChild(
-    dom::PMediaTransportChild* aActor) {
-  delete aActor;
-  return true;
-}
-
 }  // namespace net
 }  // namespace mozilla
--- a/netwerk/ipc/SocketProcessBridgeChild.h
+++ b/netwerk/ipc/SocketProcessBridgeChild.h
@@ -17,34 +17,30 @@ namespace net {
 // This is allocated and kept alive by NeckoChild. When "content-child-shutdown"
 // topic is observed, this actor will be destroyed.
 class SocketProcessBridgeChild final : public PSocketProcessBridgeChild,
                                        public nsIObserver {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
+  static bool Create(Endpoint<PSocketProcessBridgeChild>&& aEndpoint);
   static already_AddRefed<SocketProcessBridgeChild> GetSingleton();
-  typedef MozPromise<RefPtr<SocketProcessBridgeChild>, nsCString, false>
-      GetPromise;
-  static RefPtr<GetPromise> GetSocketProcessBridge();
+  static void EnsureSocketProcessBridge(std::function<void()>&& aOnSuccess,
+                                        std::function<void()>&& aOnFailure);
 
   mozilla::ipc::IPCResult RecvTest();
   void ActorDestroy(ActorDestroyReason aWhy) override;
   void DeferredDestroy();
   bool IsShuttingDown() const { return mShuttingDown; };
   bool Inited() const { return mInited; };
   ProcessId SocketProcessPid() const { return mSocketProcessPid; };
 
-  dom::PMediaTransportChild* AllocPMediaTransportChild();
-  bool DeallocPMediaTransportChild(dom::PMediaTransportChild* aActor);
-
  private:
   DISALLOW_COPY_AND_ASSIGN(SocketProcessBridgeChild);
-  static bool Create(Endpoint<PSocketProcessBridgeChild>&& aEndpoint);
   explicit SocketProcessBridgeChild(
       Endpoint<PSocketProcessBridgeChild>&& aEndpoint);
   virtual ~SocketProcessBridgeChild();
 
   static StaticRefPtr<SocketProcessBridgeChild> sSocketProcessBridgeChild;
   bool mShuttingDown;
   bool mInited = false;
   ProcessId mSocketProcessPid;
--- a/netwerk/ipc/SocketProcessBridgeParent.cpp
+++ b/netwerk/ipc/SocketProcessBridgeParent.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SocketProcessBridgeParent.h"
 #include "SocketProcessLogging.h"
 
 #include "mozilla/ipc/BackgroundParent.h"
 #include "SocketProcessChild.h"
-#include "mozilla/dom/MediaTransportParent.h"
 
 namespace mozilla {
 namespace net {
 
 SocketProcessBridgeParent::SocketProcessBridgeParent(
     ProcessId aId, Endpoint<PSocketProcessBridgeParent>&& aEndpoint)
     : mId(aId) {
   LOG((
@@ -52,26 +51,10 @@ void SocketProcessBridgeParent::ActorDes
       NewRunnableMethod("net::SocketProcessBridgeParent::DeferredDestroy", this,
                         &SocketProcessBridgeParent::DeferredDestroy));
 }
 
 void SocketProcessBridgeParent::DeferredDestroy() {
   SocketProcessChild::GetSingleton()->DestroySocketProcessBridgeParent(mId);
 }
 
-dom::PMediaTransportParent*
-SocketProcessBridgeParent::AllocPMediaTransportParent() {
-#ifdef MOZ_WEBRTC
-  return new MediaTransportParent;
-#endif
-  return nullptr;
-}
-
-bool SocketProcessBridgeParent::DeallocPMediaTransportParent(
-    dom::PMediaTransportParent* aActor) {
-#ifdef MOZ_WEBRTC
-  delete aActor;
-#endif
-  return true;
-}
-
 }  // namespace net
 }  // namespace mozilla
--- a/netwerk/ipc/SocketProcessBridgeParent.h
+++ b/netwerk/ipc/SocketProcessBridgeParent.h
@@ -24,19 +24,16 @@ class SocketProcessBridgeParent final : 
 
   mozilla::ipc::IPCResult RecvTest();
   mozilla::ipc::IPCResult RecvInitBackground(
       Endpoint<PBackgroundParent>&& aEndpoint);
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
   void DeferredDestroy();
 
-  dom::PMediaTransportParent* AllocPMediaTransportParent();
-  bool DeallocPMediaTransportParent(dom::PMediaTransportParent* aActor);
-
  private:
   ~SocketProcessBridgeParent();
 
   ProcessId mId;
 };
 
 }  // namespace net
 }  // namespace mozilla
--- a/netwerk/ipc/moz.build
+++ b/netwerk/ipc/moz.build
@@ -57,18 +57,16 @@ if not CONFIG['MOZ_WEBRTC']:
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/caps',
     '/dom/base',
-    '/media/mtransport',
-    '/media/webrtc',
     '/modules/libjar',
     '/netwerk/base',
     '/netwerk/protocol/http',
     '/xpcom/threads'
 ]
 
 # Add libFuzzer configuration directives
 include('/tools/fuzzing/libfuzzer-config.mozbuild')
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -13,19 +13,17 @@ treeherder:
         'Bpgo': 'Profile-guided optimization builds'
         'Fetch-URL': 'Fetch and store content'
         'Fxfn-l': 'Firefox functional tests (local)'
         'Fxfn-l-e10s': 'Firefox functional tests (local) with e10s'
         'Fxfn-r': 'Firefox functional tests (remote)'
         'Fxfn-r-e10s': 'Firefox functional tests (remote) with e10s'
         'M': 'Mochitests'
         'M-sw': 'Mochitests with serviceworker redesign'
-        'M-spi': 'Mochitests with socket process'
         'M-e10s': 'Mochitests with e10s'
-        'M-e10s-spi': 'Mochitests with socket process and e10s'
         'M-sw-e10s': 'Mochitests with serviceworker redesign and e10s'
         'M-V': 'Mochitests on Valgrind'
         'MSI': 'Repack installers into MSIs'
         'MSIs': 'Signing of Repacked installers of MSIs'
         'R': 'Reftests'
         'R-sw': 'Reftests with serviceworker redesign enabled'
         'R-e10s': 'Reftests with e10s'
         'R-sw-e10s': 'Reftests with serviceworker redesign and e10s'
--- a/taskcluster/ci/test/mochitest.yml
+++ b/taskcluster/ci/test/mochitest.yml
@@ -2,17 +2,16 @@ job-defaults:
     target:
         by-test-platform:
             android-em-7.*: geckoview-androidTest.apk
             default: null
     serviceworker-e10s:
         by-test-platform:
             linux64/debug: both
             default: false
-    socketprocess-e10s: false
     mozharness:
         script:
             by-test-platform:
                 android-em.*: android_emulator_unittest.py
                 android-hw.*: android_hardware_unittest.py
                 default: desktop_unittest.py
         config:
             by-test-platform:
@@ -279,20 +278,16 @@ mochitest-media:
     suite: mochitest/mochitest-media
     treeherder-symbol: M(mda)
     max-run-time:
         by-test-platform:
             windows10-64-ccov/debug: 7200
             macosx64-ccov/debug: 7200
             default: 5400
     run-on-projects: built-projects
-    socketprocess-e10s:
-        by-test-platform:
-            android.*: false
-            default: both
     loopback-video: true
     virtualization:
         by-test-platform:
             windows10-64(?:-pgo)?-qr/.*: virtual-with-gpu
             default: virtual
     instance-size:
         by-test-platform:
             android-em.*: xlarge
--- a/taskcluster/docs/attributes.rst
+++ b/taskcluster/docs/attributes.rst
@@ -131,22 +131,16 @@ This is the chunk number of a chunked te
 that this is a string!
 
 serviceworker_e10s
 ==================
 
 For test suites which distinguish whether or not they run with the serviceworker
 e10s redesign enabled.
 
-socketprocess_e10s
-==================
-
-For test suites which distinguish whether or not they run with the socket
-process enabled.
-
 e10s
 ====
 
 For test suites which distinguish whether they run with or without e10s, this
 boolean value identifies this particular run.
 
 image_name
 ==========
--- a/taskcluster/taskgraph/transforms/tests.py
+++ b/taskcluster/taskgraph/transforms/tests.py
@@ -218,24 +218,16 @@ test_description_schema = Schema({
     # Whether to run this task with e10s.  If false, run
     # without e10s; if true, run with e10s; if 'both', run one task with and
     # one task without e10s.  E10s tasks have "-e10s" appended to the test name
     # and treeherder group.
     Required('e10s'): optionally_keyed_by(
         'test-platform', 'project',
         Any(bool, 'both')),
 
-    # Whether to run this task with the socket process enabled (desktop-test
-    # only).  If 'both', run one task with and one task without.  Tasks with
-    # this enabled have have "-spi" appended to the test name and treeherder
-    # group.
-    Optional('socketprocess-e10s'): optionally_keyed_by(
-        'test-platform', 'project',
-        Any(bool, 'both')),
-
     # Whether the task should run with WebRender enabled or not.
     Optional('webrender'): bool,
 
     # The EC2 instance size to run these tests on.
     Required('instance-size'): optionally_keyed_by(
         'test-platform',
         Any('default', 'large', 'xlarge')),
 
@@ -487,17 +479,16 @@ def set_defaults(config, tests):
         test.setdefault('max-run-time', 3600)
         test.setdefault('reboot', False)
         test.setdefault('virtualization', 'virtual')
         test.setdefault('loopback-audio', False)
         test.setdefault('loopback-video', False)
         test.setdefault('docker-image', {'in-tree': 'desktop1604-test'})
         test.setdefault('checkout', False)
         test.setdefault('serviceworker-e10s', False)
-        test.setdefault('socketprocess-e10s', False)
         test.setdefault('require-signed-extensions', False)
 
         test['mozharness'].setdefault('extra-options', [])
         test['mozharness'].setdefault('requires-signed-builds', False)
         test['mozharness'].setdefault('tooltool-downloads', 'public')
         test['mozharness'].setdefault('set-moz-node-path', False)
         test['mozharness'].setdefault('chunked', False)
         test['mozharness'].setdefault('chunking-args', 'this-chunk')
@@ -729,17 +720,16 @@ def handle_keyed_by(config, tests):
     """Resolve fields that can be keyed by platform, etc."""
     fields = [
         'instance-size',
         'docker-image',
         'max-run-time',
         'chunks',
         'serviceworker-e10s',
         'e10s',
-        'socketprocess-e10s',
         'suite',
         'run-on-projects',
         'os-groups',
         'run-as-administrator',
         'mozharness.chunked',
         'mozharness.config',
         'mozharness.extra-options',
         'mozharness.requires-signed-builds',
@@ -859,20 +849,16 @@ def handle_run_on_projects(config, tests
         if test['run-on-projects'] == 'built-projects':
             test['run-on-projects'] = test['build-attributes'].get('run_on_projects', ['all'])
         yield test
 
 
 @transforms.add
 def split_serviceworker_e10s(config, tests):
     for test in tests:
-        if test['attributes'].get('socketprocess_e10s'):
-            yield test
-            continue
-
         sw = test.pop('serviceworker-e10s')
 
         test['serviceworker-e10s'] = False
         test['attributes']['serviceworker_e10s'] = False
 
         if sw == 'both':
             yield copy.deepcopy(test)
             sw = True
@@ -922,49 +908,16 @@ def split_e10s(config, tests):
                     if option.startswith('--suite='):
                         test['mozharness']['extra-options'][i] += '-e10s'
             else:
                 test['mozharness']['extra-options'].append('--e10s')
         yield test
 
 
 @transforms.add
-def split_socketprocess_e10s(config, tests):
-    for test in tests:
-        if test['attributes'].get('serviceworker_e10s'):
-            yield test
-            continue
-
-        sw = test.pop('socketprocess-e10s')
-
-        test['socketprocess-e10s'] = False
-        test['attributes']['socketprocess_e10s'] = False
-
-        if sw == 'both':
-            yield copy.deepcopy(test)
-            sw = True
-        if sw:
-            test['description'] += " with socket process enabled"
-            test['test-name'] += '-spi'
-            test['try-name'] += '-spi'
-            test['attributes']['socketprocess_e10s'] = True
-            group, symbol = split_symbol(test['treeherder-symbol'])
-            if group != '?':
-                group += '-spi'
-            else:
-                symbol += '-spi'
-            test['treeherder-symbol'] = join_symbol(group, symbol)
-            test['mozharness']['extra-options'].append(
-                '--setpref="media.peerconnection.mtransport_process=true"')
-            test['mozharness']['extra-options'].append(
-                '--setpref="network.process.enabled=true"')
-        yield test
-
-
-@transforms.add
 def split_chunks(config, tests):
     """Based on the 'chunks' key, split tests up into chunks by duplicating
     them and assigning 'this-chunk' appropriately and updating the treeherder
     symbol."""
     for test in tests:
         if test['suite'].startswith('test-verify') or \
            test['suite'].startswith('test-coverage'):
             env = config.params.get('try_task_config', {}) or {}
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -2546,18 +2546,16 @@ toolbar#nav-bar {
             options.e10s = False
 
         # for test manifest parsing.
         mozinfo.update({
             "e10s": options.e10s,
             "headless": options.headless,
             "serviceworker_e10s": self.extraPrefs.get(
                 'dom.serviceWorkers.parent_intercept', False),
-            "socketprocess_e10s": self.extraPrefs.get(
-                'network.process.enabled', False),
         })
 
         self.setTestRoot(options)
 
         # Despite our efforts to clean up servers started by this script, in practice
         # we still see infrequent cases where a process is orphaned and interferes
         # with future tests, typically because the old server is keeping the port in use.
         # Try to avoid those failures by checking for and killing servers before
@@ -2774,18 +2772,16 @@ toolbar#nav-bar {
                 self.buildURLOptions(options, self.browserEnv)
                 if self.urlOpts:
                     testURL += "?" + "&".join(self.urlOpts)
 
                 self.log.info("runtests.py | Running with scheme: {}".format(scheme))
                 self.log.info("runtests.py | Running with e10s: {}".format(options.e10s))
                 self.log.info("runtests.py | Running with serviceworker_e10s: {}".format(
                     mozinfo.info.get('serviceworker_e10s', False)))
-                self.log.info("runtests.py | Running with socketprocess_e10s: {}".format(
-                    mozinfo.info.get('socketprocess_e10s', False)))
                 self.log.info("runtests.py | Running tests: start.\n")
                 ret, _ = self.runApp(
                     testURL,
                     self.browserEnv,
                     options.app,
                     profile=self.profile,
                     extraArgs=options.browserArgs,
                     utilityPath=options.utilityPath,