Backed out changesets f04c846c7492, 9bc5c5a8554e, and a4f2af4617da (bug 906990) for WebRTC mochitest failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 13 Jan 2014 10:53:40 -0500
changeset 163198 1ac9a01f2d001c7782b6d107bd3e365d743778cb
parent 163197 456104e27a9a624fb0b90949eac89481d446f9b3
child 163199 92d1972990e475236f5b309f798fa80117ef60c0
push id25984
push userryanvm@gmail.com
push dateMon, 13 Jan 2014 22:44:31 +0000
treeherdermozilla-central@425579efbac3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs906990
milestone29.0a1
backs outf04c846c7492f1bf39abb9eb637f3cd0fee09157
9bc5c5a8554efc1763c49e3e33621c0c6f062321
a4f2af4617da8d08fd459a97ada04d69e6d62604
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 changesets f04c846c7492, 9bc5c5a8554e, and a4f2af4617da (bug 906990) for WebRTC mochitest failures. CLOSED TREE
dom/media/PeerConnection.js
dom/webidl/RTCStatsReport.webidl
media/mtransport/nricemediastream.cpp
media/mtransport/nricemediastream.h
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
media/webrtc/signaling/test/mediapipeline_unittest.cpp
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -114,36 +114,28 @@ GlobalPCList.prototype = {
         this._networkdown = true;
       } else if (data == "online") {
         this._networkdown = false;
       }
     }
   },
 
   getStatsForEachPC: function(callback, errorCallback) {
-    function getStatsFromPC(pcref) {
-      try {
-        pcref.get().getStatsInternal(null, callback, errorCallback);
-      } catch (e) {
-        errorCallback("Some error getting stats from PC: " + e.toString());
-      }
-    }
-
     for (let winId in this._list) {
       if (this._list.hasOwnProperty(winId)) {
         this.removeNullRefs(winId);
         if (this._list[winId]) {
-          this._list[winId].forEach(getStatsFromPC);
+          this._list[winId].forEach(function(pcref) {
+            pcref.get().getStatsInternal(null, callback, errorCallback);
+          });
         }
       }
     }
   },
 
-  // TODO(bcampen@mozilla.com): Handle this with a global object in c++
-  // (Bug 958221)
   getLoggingFromFirstPC: function(pattern, callback, errorCallback) {
     for (let winId in this._list) {
       this.removeNullRefs(winId);
       if (this._list[winId]) {
         // We expect removeNullRefs to not leave us with an empty array here
         let pcref = this._list[winId][0];
         pcref.get().getLogging(pattern, callback, errorCallback);
         return;
@@ -157,18 +149,16 @@ function WebrtcGlobalInformation() {
 }
 WebrtcGlobalInformation.prototype = {
   classDescription: "WebrtcGlobalInformation",
   classID: WEBRTC_GLOBAL_CID,
   contractID: WEBRTC_GLOBAL_CONTRACT,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
 
   getAllStats: function(successCallback, failureCallback) {
-    // TODO(bcampen@mozilla.com): Move the work of fanout into c++, and
-    // only callback once. (Bug 958221)
     if (_globalPCList) {
       _globalPCList.getStatsForEachPC(successCallback, failureCallback);
     } else {
       failureCallback("No global PeerConnection list");
     }
   },
 
   getCandPairLogs: function(candPairId, callback, errorCallback) {
--- a/dom/webidl/RTCStatsReport.webidl
+++ b/dom/webidl/RTCStatsReport.webidl
@@ -99,17 +99,16 @@ dictionary RTCIceCandidatePairStats : RT
 enum RTCStatsIceCandidateType {
   "host",
   "serverreflexive",
   "peerreflexive",
   "relayed"
 };
 
 dictionary RTCIceCandidateStats : RTCStats {
-  DOMString componentId;
   DOMString candidateId;
   DOMString ipAddress;
   long portNumber;
   RTCStatsIceCandidateType candidateType;
 };
 
 dictionary RTCCodecStats : RTCStats {
   unsigned long payloadType;       // As used in RTP encoding.
--- a/media/mtransport/nricemediastream.cpp
+++ b/media/mtransport/nricemediastream.cpp
@@ -399,59 +399,16 @@ std::vector<std::string> NrIceMediaStrea
     RFREE(attrs[i]);
   }
 
   RFREE(attrs);
 
   return ret;
 }
 
-static nsresult GetCandidatesFromStream(
-    nr_ice_media_stream *stream,
-    std::vector<NrIceCandidate> *candidates) {
-  MOZ_ASSERT(candidates);
-  nr_ice_component* comp=STAILQ_FIRST(&stream->components);
-  while(comp){
-    if (comp->state != NR_ICE_COMPONENT_DISABLED) {
-      nr_ice_candidate *cand = TAILQ_FIRST(&comp->candidates);
-      while(cand){
-        NrIceCandidate new_cand;
-        // This can fail if the candidate is server reflexive or relayed, and
-        // has not yet received a response (ie; it doesn't know its address
-        // yet). For the purposes of this code, this isn't a candidate we're
-        // interested in, since it is not fully baked yet.
-        if (ToNrIceCandidate(*cand, &new_cand)) {
-          candidates->push_back(new_cand);
-        }
-        cand=TAILQ_NEXT(cand,entry_comp);
-      }
-    }
-    comp=STAILQ_NEXT(comp,entry);
-  }
-
-  return NS_OK;
-}
-
-nsresult NrIceMediaStream::GetLocalCandidates(
-    std::vector<NrIceCandidate>* candidates) const {
-  return GetCandidatesFromStream(stream_, candidates);
-}
-
-nsresult NrIceMediaStream::GetRemoteCandidates(
-    std::vector<NrIceCandidate>* candidates) const {
-  nr_ice_media_stream* peer_stream;
-  int r = nr_ice_peer_ctx_find_pstream(ctx_->peer(), stream_, &peer_stream);
-  if (r != 0) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return GetCandidatesFromStream(peer_stream, candidates);
-}
-
-
 nsresult NrIceMediaStream::DisableComponent(int component_id) {
   if (!stream_)
     return NS_ERROR_FAILURE;
 
   int r = nr_ice_media_stream_disable_component(stream_,
                                                 component_id);
   if (r) {
     MOZ_MTLOG(ML_ERROR, "Couldn't disable '" << name_ << "':" <<
--- a/media/mtransport/nricemediastream.h
+++ b/media/mtransport/nricemediastream.h
@@ -132,19 +132,16 @@ class NrIceMediaStream {
   State state() const { return state_; }
 
   // The name of the stream
   const std::string& name() const { return name_; }
 
   // Get all the candidates
   std::vector<std::string> GetCandidates() const;
 
-  nsresult GetLocalCandidates(std::vector<NrIceCandidate>* candidates) const;
-  nsresult GetRemoteCandidates(std::vector<NrIceCandidate>* candidates) const;
-
   // Get all candidate pairs, whether in the check list or triggered check
   // queue, in priority order. |out_pairs| is cleared before being filled.
   nsresult GetCandidatePairs(std::vector<NrIceCandidatePair>* out_pairs) const;
 
   // Get the default candidate as host and port
   nsresult GetDefaultCandidate(int component, std::string *host, int *port);
 
   // Parse remote attributes
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -1584,17 +1584,16 @@ static int vcmRxStartICE_m(cc_mcapid_t m
     // Now we have all the pieces, create the pipeline
     mozilla::RefPtr<mozilla::MediaPipeline> pipeline =
       new mozilla::MediaPipelineReceiveAudio(
         pc.impl()->GetHandle(),
         pc.impl()->GetMainThread().get(),
         pc.impl()->GetSTSThread(),
         stream->GetMediaStream()->GetStream(),
         pc_track_id,
-        level,
         conduit, rtp_flow, rtcp_flow);
 
     nsresult res = pipeline->Init();
     if (NS_FAILED(res)) {
       CSFLogError(logTag, "Failure initializing audio pipeline");
       return VCM_ERROR;
     }
 
@@ -1636,17 +1635,16 @@ static int vcmRxStartICE_m(cc_mcapid_t m
     // Now we have all the pieces, create the pipeline
     mozilla::RefPtr<mozilla::MediaPipeline> pipeline =
         new mozilla::MediaPipelineReceiveVideo(
             pc.impl()->GetHandle(),
             pc.impl()->GetMainThread().get(),
             pc.impl()->GetSTSThread(),
             stream->GetMediaStream()->GetStream(),
             pc_track_id,
-            level,
             conduit, rtp_flow, rtcp_flow);
 
     nsresult res = pipeline->Init();
     if (NS_FAILED(res)) {
       CSFLogError(logTag, "Failure initializing video pipeline");
       return VCM_ERROR;
     }
 
@@ -2238,17 +2236,16 @@ static int vcmTxStartICE_m(cc_mcapid_t m
 
     mozilla::RefPtr<mozilla::MediaPipeline> pipeline =
         new mozilla::MediaPipelineTransmit(
             pc.impl()->GetHandle(),
             pc.impl()->GetMainThread().get(),
             pc.impl()->GetSTSThread(),
             stream->GetMediaStream(),
             pc_track_id,
-            level,
             conduit, rtp_flow, rtcp_flow);
 
     nsresult res = pipeline->Init();
     if (NS_FAILED(res)) {
       CSFLogError(logTag, "Failure initializing audio pipeline");
       return VCM_ERROR;
     }
     CSFLogDebug(logTag, "Created audio pipeline %p, conduit=%p, pc_stream=%d pc_track=%d",
@@ -2289,17 +2286,16 @@ static int vcmTxStartICE_m(cc_mcapid_t m
     // Now we have all the pieces, create the pipeline
     mozilla::RefPtr<mozilla::MediaPipeline> pipeline =
         new mozilla::MediaPipelineTransmit(
             pc.impl()->GetHandle(),
             pc.impl()->GetMainThread().get(),
             pc.impl()->GetSTSThread(),
             stream->GetMediaStream(),
             pc_track_id,
-            level,
             conduit, rtp_flow, rtcp_flow);
 
     nsresult res = pipeline->Init();
     if (NS_FAILED(res)) {
       CSFLogError(logTag, "Failure initializing video pipeline");
       return VCM_ERROR;
     }
 
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -66,24 +66,22 @@ class MediaPipeline : public sigslot::ha
   enum Direction { TRANSMIT, RECEIVE };
   enum State { MP_CONNECTING, MP_OPEN, MP_CLOSED };
   MediaPipeline(const std::string& pc,
                 Direction direction,
                 nsCOMPtr<nsIEventTarget> main_thread,
                 nsCOMPtr<nsIEventTarget> sts_thread,
                 MediaStream *stream,
                 TrackID track_id,
-                int level,
                 RefPtr<MediaSessionConduit> conduit,
                 RefPtr<TransportFlow> rtp_transport,
                 RefPtr<TransportFlow> rtcp_transport)
       : direction_(direction),
         stream_(stream),
         track_id_(track_id),
-        level_(level),
         conduit_(conduit),
         rtp_transport_(rtp_transport),
         rtp_state_(MP_CONNECTING),
         rtcp_transport_(rtcp_transport),
         rtcp_state_(MP_CONNECTING),
         main_thread_(main_thread),
         sts_thread_(sts_thread),
         rtp_send_srtp_(),
@@ -123,17 +121,16 @@ class MediaPipeline : public sigslot::ha
       DetachMediaStream();
     }
   }
 
   virtual nsresult Init();
 
   virtual Direction direction() const { return direction_; }
   virtual TrackID trackid() const { return track_id_; }
-  virtual int level() const { return level_; }
 
   bool IsDoingRtcpMux() const {
     return (rtp_transport_ == rtcp_transport_);
   }
 
   int32_t rtp_packets_sent() const { return rtp_packets_sent_; }
   int64_t rtp_bytes_sent() const { return rtp_bytes_sent_; }
   int32_t rtcp_packets_sent() const { return rtcp_packets_sent_; }
@@ -192,17 +189,16 @@ class MediaPipeline : public sigslot::ha
                       size_t len);
 
   Direction direction_;
   RefPtr<MediaStream> stream_;  // A pointer to the stream we are servicing.
                                 // Written on the main thread.
                                 // Used on STS and MediaStreamGraph threads.
   TrackID track_id_;            // The track on the stream.
                                 // Written and used as the stream_;
-  int level_; // The m-line index (starting at 1, to match convention)
   RefPtr<MediaSessionConduit> conduit_;  // Our conduit. Written on the main
                                          // thread. Read on STS thread.
 
   // The transport objects. Read/written on STS thread.
   RefPtr<TransportFlow> rtp_transport_;
   State rtp_state_;
   RefPtr<TransportFlow> rtcp_transport_;
   State rtcp_state_;
@@ -314,23 +310,22 @@ private:
 class MediaPipelineTransmit : public MediaPipeline {
  public:
   // Set rtcp_transport to nullptr to use rtcp-mux
   MediaPipelineTransmit(const std::string& pc,
                         nsCOMPtr<nsIEventTarget> main_thread,
                         nsCOMPtr<nsIEventTarget> sts_thread,
                         DOMMediaStream *domstream,
                         TrackID track_id,
-                        int level,
                         RefPtr<MediaSessionConduit> conduit,
                         RefPtr<TransportFlow> rtp_transport,
                         RefPtr<TransportFlow> rtcp_transport) :
       MediaPipeline(pc, TRANSMIT, main_thread, sts_thread,
-                    domstream->GetStream(), track_id, level,
-                    conduit, rtp_transport, rtcp_transport),
+                    domstream->GetStream(), track_id, conduit, rtp_transport,
+                    rtcp_transport),
       listener_(new PipelineListener(conduit)),
       domstream_(domstream)
   {}
 
   // Initialize (stuff here may fail)
   virtual nsresult Init();
 
   // Called on the main thread.
@@ -437,22 +432,21 @@ class MediaPipelineTransmit : public Med
 class MediaPipelineReceive : public MediaPipeline {
  public:
   // Set rtcp_transport to nullptr to use rtcp-mux
   MediaPipelineReceive(const std::string& pc,
                        nsCOMPtr<nsIEventTarget> main_thread,
                        nsCOMPtr<nsIEventTarget> sts_thread,
                        MediaStream *stream,
                        TrackID track_id,
-                       int level,
                        RefPtr<MediaSessionConduit> conduit,
                        RefPtr<TransportFlow> rtp_transport,
                        RefPtr<TransportFlow> rtcp_transport) :
       MediaPipeline(pc, RECEIVE, main_thread, sts_thread,
-                    stream, track_id, level, conduit, rtp_transport,
+                    stream, track_id, conduit, rtp_transport,
                     rtcp_transport),
       segments_added_(0) {
   }
 
   int segments_added() const { return segments_added_; }
 
  protected:
   int segments_added_;
@@ -465,22 +459,21 @@ class MediaPipelineReceive : public Medi
 // rendering audio.
 class MediaPipelineReceiveAudio : public MediaPipelineReceive {
  public:
   MediaPipelineReceiveAudio(const std::string& pc,
                             nsCOMPtr<nsIEventTarget> main_thread,
                             nsCOMPtr<nsIEventTarget> sts_thread,
                             MediaStream *stream,
                             TrackID track_id,
-                            int level,
                             RefPtr<AudioSessionConduit> conduit,
                             RefPtr<TransportFlow> rtp_transport,
                             RefPtr<TransportFlow> rtcp_transport) :
       MediaPipelineReceive(pc, main_thread, sts_thread,
-                           stream, track_id, level, conduit, rtp_transport,
+                           stream, track_id, conduit, rtp_transport,
                            rtcp_transport),
       listener_(new PipelineListener(stream->AsSourceStream(),
                                      track_id, conduit)) {
   }
 
   virtual void DetachMediaStream() {
     ASSERT_ON_THREAD(main_thread_);
     listener_->EndTrack();
@@ -528,22 +521,21 @@ class MediaPipelineReceiveAudio : public
 // rendering video.
 class MediaPipelineReceiveVideo : public MediaPipelineReceive {
  public:
   MediaPipelineReceiveVideo(const std::string& pc,
                             nsCOMPtr<nsIEventTarget> main_thread,
                             nsCOMPtr<nsIEventTarget> sts_thread,
                             MediaStream *stream,
                             TrackID track_id,
-                            int level,
                             RefPtr<VideoSessionConduit> conduit,
                             RefPtr<TransportFlow> rtp_transport,
                             RefPtr<TransportFlow> rtcp_transport) :
       MediaPipelineReceive(pc, main_thread, sts_thread,
-                           stream, track_id, level, conduit, rtp_transport,
+                           stream, track_id, conduit, rtp_transport,
                            rtcp_transport),
       renderer_(new PipelineRenderer(MOZ_THIS_IN_INITIALIZER_LIST())),
       listener_(new PipelineListener(stream->AsSourceStream(), track_id)) {
   }
 
   // Called on the main thread.
   virtual void DetachMediaStream() {
     ASSERT_ON_THREAD(main_thread_);
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -1,16 +1,15 @@
 /* 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 <cstdlib>
 #include <cerrno>
 #include <deque>
-#include <sstream>
 
 #include "base/histogram.h"
 #include "vcm.h"
 #include "CSFLog.h"
 #include "timecard.h"
 #include "ccapi_call_info.h"
 #include "CC_SIPCCCallInfo.h"
 #include "ccapi_device_info.h"
@@ -28,17 +27,16 @@
 #include "nsIPropertyBag2.h"
 #include "nsIServiceManager.h"
 #include "nsISimpleEnumerator.h"
 #include "nsServiceManagerUtils.h"
 #include "nsISocketTransportService.h"
 #include "nsIConsoleService.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
-#include "prtime.h"
 
 #include "runnable_utils.h"
 #include "PeerConnectionCtx.h"
 #include "PeerConnectionImpl.h"
 #include "PeerConnectionMedia.h"
 #include "nsDOMDataChannelDeclarations.h"
 #include "dtlsidentity.h"
 
@@ -53,17 +51,16 @@
 #include "nsContentUtils.h"
 #include "nsDOMJSUtils.h"
 #include "nsIDocument.h"
 #include "nsIScriptError.h"
 #include "nsPrintfCString.h"
 #include "nsURLHelper.h"
 #include "nsNetUtil.h"
 #include "nsIDOMDataChannel.h"
-#include "nsIDOMLocation.h"
 #include "mozilla/dom/RTCConfigurationBinding.h"
 #include "mozilla/dom/RTCStatsReportBinding.h"
 #include "mozilla/dom/RTCPeerConnectionBinding.h"
 #include "mozilla/dom/PeerConnectionImplBinding.h"
 #include "mozilla/dom/DataChannelBinding.h"
 #include "MediaStreamList.h"
 #include "MediaStreamTrack.h"
 #include "AudioStreamTrack.h"
@@ -707,46 +704,18 @@ PeerConnectionImpl::Initialize(PeerConne
     NS_ENSURE_SUCCESS(res = InitNSSInContent(), res);
   }
 
   // Currently no standalone unit tests for DataChannel,
   // which is the user of mWindow
   MOZ_ASSERT(aWindow);
   mWindow = aWindow;
   NS_ENSURE_STATE(mWindow);
-
 #endif // MOZILLA_INTERNAL_API
 
-  PRTime timestamp = PR_Now();
-  // Ok if we truncate this.
-  char temp[128];
-
-#ifdef MOZILLA_INTERNAL_API
-  nsIDOMLocation* location = nullptr;
-  mWindow->GetLocation(&location);
-  MOZ_ASSERT(location);
-  nsString locationAStr;
-  location->ToString(locationAStr);
-  location->Release();
-
-  nsCString locationCStr;
-  CopyUTF16toUTF8(locationAStr, locationCStr);
-  MOZ_ASSERT(mWindow);
-  PR_snprintf(temp,
-              sizeof(temp),
-              "%llu (id=%u url=%s)",
-              (unsigned long long)timestamp,
-              (unsigned)mWindow->WindowID(),
-              locationCStr.get() ? locationCStr.get() : "NULL");
-#else
-  PR_snprintf(temp, sizeof(temp), "%llu", (unsigned long long)timestamp);
-#endif // MOZILLA_INTERNAL_API
-
-  mName = temp;
-
   // Generate a random handle
   unsigned char handle_bin[8];
   SECStatus rv;
   rv = PK11_GenerateRandom(handle_bin, sizeof(handle_bin));
   if (rv != SECSuccess) {
     MOZ_CRASH();
     return NS_ERROR_UNEXPECTED;
   }
@@ -1281,82 +1250,59 @@ PushBackSelect(std::vector<RefPtr<MediaP
 }
 #endif
 
 NS_IMETHODIMP
 PeerConnectionImpl::GetStats(MediaStreamTrack *aSelector, bool internalStats) {
   PC_AUTO_ENTER_API_CALL(true);
 
 #ifdef MOZILLA_INTERNAL_API
-  if (!mMedia) {
-    // Since we zero this out before the d'tor, we should check.
-    return NS_ERROR_UNEXPECTED;
-  }
+  MOZ_ASSERT(mMedia);
 
   // Gather up pipelines from mMedia and dispatch them to STS for inspection
 
-  std::vector<RefPtr<MediaPipeline>> pipelines;
+  nsAutoPtr<std::vector<RefPtr<MediaPipeline>>> pipelines(
+      new std::vector<RefPtr<MediaPipeline>>());
   TrackID trackId = aSelector ? aSelector->GetTrackID() : 0;
 
   for (int i = 0, len = mMedia->LocalStreamsLength(); i < len; i++) {
-    PushBackSelect(pipelines, mMedia->GetLocalStream(i)->GetPipelines(), trackId);
+    PushBackSelect(*pipelines, mMedia->GetLocalStream(i)->GetPipelines(), trackId);
   }
   for (int i = 0, len = mMedia->RemoteStreamsLength(); i < len; i++) {
-    PushBackSelect(pipelines, mMedia->GetRemoteStream(i)->GetPipelines(), trackId);
-  }
-
-  // From the list of MediaPipelines, determine the set of NrIceMediaStreams
-  // we are interested in.
-  std::vector<RefPtr<NrIceMediaStream> > streams;
-  RefPtr<NrIceCtx> iceCtx(mMedia->ice_ctx());
-  for (auto p = pipelines.begin(); p != pipelines.end(); ++p) {
-    size_t level = p->get()->level();
-    // TODO(bcampen@mozilla.com): I may need to revisit this for bundle.
-    // (Bug 786234)
-    RefPtr<NrIceMediaStream> temp(mMedia->ice_media_stream(level-1));
-    if (temp.get()) {
-      streams.push_back(temp);
-    } else {
-       CSFLogError(logTag, "Failed to get NrIceMediaStream for level %u "
-                           "in %s:  %s",
-                           level, __FUNCTION__, mHandle.c_str());
-       MOZ_CRASH();
-    }
+    PushBackSelect(*pipelines, mMedia->GetRemoteStream(i)->GetPipelines(), trackId);
   }
 
   DOMHighResTimeStamp now;
   nsresult rv = GetTimeSinceEpoch(&now);
   NS_ENSURE_SUCCESS(rv, rv);
 
+  nsRefPtr<PeerConnectionImpl> pc(this);
   RUN_ON_THREAD(mSTSThread,
-                WrapRunnableNM(&PeerConnectionImpl::GetStats_s,
-                               mHandle,
-                               mName,
-                               mThread,
-                               internalStats,
-                               pipelines,
-                               iceCtx,
-                               streams,
-                               now),
+                WrapRunnable(pc,
+                             &PeerConnectionImpl::GetStats_s,
+                             trackId,
+                             internalStats,
+                             pipelines,
+                             now),
                 NS_DISPATCH_NORMAL);
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PeerConnectionImpl::GetLogging(const nsAString& aPattern) {
-  PC_AUTO_ENTER_API_CALL_NO_CHECK();
+  PC_AUTO_ENTER_API_CALL(true);
 
 #ifdef MOZILLA_INTERNAL_API
   std::string pattern(NS_ConvertUTF16toUTF8(aPattern).get());
+  nsRefPtr<PeerConnectionImpl> pc(this);
   RUN_ON_THREAD(mSTSThread,
-                WrapRunnableNM(&PeerConnectionImpl::GetLogging_s,
-                               mHandle,
-                               mThread,
-                               pattern),
+                WrapRunnable(pc,
+                             &PeerConnectionImpl::GetLogging_s,
+                             pattern),
                 NS_DISPATCH_NORMAL);
 
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PeerConnectionImpl::AddIceCandidate(const char* aCandidate, const char* aMid, unsigned short aLevel) {
@@ -1786,23 +1732,16 @@ PeerConnectionWrapper::PeerConnectionWra
 
 const std::string&
 PeerConnectionImpl::GetHandle()
 {
   PC_AUTO_ENTER_API_CALL_NO_CHECK();
   return mHandle;
 }
 
-const std::string&
-PeerConnectionImpl::GetName()
-{
-  PC_AUTO_ENTER_API_CALL_NO_CHECK();
-  return mName;
-}
-
 static mozilla::dom::PCImplIceConnectionState
 toDomIceConnectionState(NrIceCtx::ConnectionState state) {
   switch (state) {
     case NrIceCtx::ICE_CTX_INIT:
       return PCImplIceConnectionState::New;
     case NrIceCtx::ICE_CTX_CHECKING:
       return PCImplIceConnectionState::Checking;
     case NrIceCtx::ICE_CTX_OPEN:
@@ -1938,31 +1877,27 @@ PeerConnectionImpl::IceGatheringStateCha
                              &PeerConnectionObserver::OnStateChange,
                              PCObserverStateType::IceGatheringState,
                              rv, static_cast<JSCompartment*>(nullptr)),
                 NS_DISPATCH_NORMAL);
   return NS_OK;
 }
 
 #ifdef MOZILLA_INTERNAL_API
-
 nsresult
 PeerConnectionImpl::GetStatsImpl_s(
+    TrackID trackId,
     bool internalStats,
-    const std::vector<RefPtr<MediaPipeline>>& pipelines,
-    const RefPtr<NrIceCtx>& iceCtx,
-    const std::vector<RefPtr<NrIceMediaStream>>& streams,
+    nsAutoPtr<std::vector<RefPtr<MediaPipeline>>> pipelines,
     DOMHighResTimeStamp now,
-    RTCStatsReportInternal* report) {
-
-  ASSERT_ON_THREAD(iceCtx->thread());
+    RTCStatsReportInternal *report) {
 
   // Gather stats from pipelines provided (can't touch mMedia + stream on STS)
 
-  for (auto it = pipelines.begin(); it != pipelines.end(); ++it) {
+  for (auto it = pipelines->begin(); it != pipelines->end(); ++it) {
     const MediaPipeline& mp = **it;
     nsString idstr = (mp.Conduit()->type() == MediaSessionConduit::AUDIO) ?
         NS_LITERAL_STRING("audio_") : NS_LITERAL_STRING("video_");
     idstr.AppendInt(mp.trackid());
 
     switch (mp.direction()) {
       case MediaPipeline::TRANSMIT: {
         RTCOutboundRTPStreamStats s;
@@ -1986,209 +1921,162 @@ PeerConnectionImpl::GetStatsImpl_s(
         s.mPacketsReceived.Construct(mp.rtp_packets_received());
         s.mBytesReceived.Construct(mp.rtp_bytes_received());
         report->mInboundRTPStreamStats.Value().AppendElement(s);
         break;
       }
     }
   }
 
-  // Gather stats from ICE
-  for (auto s = streams.begin(); s != streams.end(); ++s) {
-    FillStatsReport_s(**s, internalStats, now, report);
+  if (mMedia) {
+
+    // Gather stats from ICE
+
+    RefPtr<NrIceMediaStream> mediaStream(mMedia->ice_media_stream(trackId));
+    if (mediaStream) {
+      std::vector<NrIceCandidatePair> candPairs;
+      mediaStream->GetCandidatePairs(&candPairs);
+      NS_ConvertASCIItoUTF16 componentId(mediaStream->name().c_str());
+      for (auto p = candPairs.begin(); p != candPairs.end(); ++p) {
+        NS_ConvertASCIItoUTF16 codeword(p->codeword.c_str());
+        NS_ConvertASCIItoUTF16 localCodeword(p->local.codeword.c_str());
+        NS_ConvertASCIItoUTF16 remoteCodeword(p->remote.codeword.c_str());
+        // Only expose candidate-pair statistics to chrome, until we've thought
+        // through the implications of exposing it to content.
+
+        if (internalStats) {
+          RTCIceCandidatePairStats s;
+          s.mId.Construct(codeword);
+          s.mComponentId.Construct(componentId);
+          s.mTimestamp.Construct(now);
+          s.mType.Construct(RTCStatsType::Candidatepair);
+
+          // Not quite right; we end up with duplicate candidates. Will fix.
+          s.mLocalCandidateId.Construct(localCodeword);
+          s.mRemoteCandidateId.Construct(remoteCodeword);
+          s.mNominated.Construct(p->nominated);
+          s.mMozPriority.Construct(p->priority);
+          s.mSelected.Construct(p->selected);
+          s.mState.Construct(RTCStatsIceCandidatePairState(p->state));
+          report->mIceCandidatePairStats.Value().AppendElement(s);
+        }
+
+        {
+          RTCIceCandidateStats local;
+          local.mId.Construct(localCodeword);
+          local.mTimestamp.Construct(now);
+          local.mType.Construct(RTCStatsType::Localcandidate);
+          local.mCandidateType.Construct(
+              RTCStatsIceCandidateType(p->local.type));
+          local.mIpAddress.Construct(
+              NS_ConvertASCIItoUTF16(p->local.cand_addr.host.c_str()));
+          local.mPortNumber.Construct(p->local.cand_addr.port);
+          report->mIceCandidateStats.Value().AppendElement(local);
+        }
+
+        {
+          RTCIceCandidateStats remote;
+          remote.mId.Construct(remoteCodeword);
+          remote.mTimestamp.Construct(now);
+          remote.mType.Construct(RTCStatsType::Remotecandidate);
+          remote.mCandidateType.Construct(
+              RTCStatsIceCandidateType(p->remote.type));
+          remote.mIpAddress.Construct(
+              NS_ConvertASCIItoUTF16(p->remote.cand_addr.host.c_str()));
+          remote.mPortNumber.Construct(p->remote.cand_addr.port);
+          report->mIceCandidateStats.Value().AppendElement(remote);
+        }
+      }
+    }
   }
-
   return NS_OK;
 }
 
-static void ToRTCIceCandidateStats(
-    const std::vector<NrIceCandidate>& candidates,
-    RTCStatsType candidateType,
-    const nsString& componentId,
-    DOMHighResTimeStamp now,
-    RTCStatsReportInternal* report) {
-
-  MOZ_ASSERT(report);
-  for (auto c = candidates.begin(); c != candidates.end(); ++c) {
-    RTCIceCandidateStats cand;
-    cand.mType.Construct(candidateType);
-    NS_ConvertASCIItoUTF16 codeword(c->codeword.c_str());
-    cand.mComponentId.Construct(componentId);
-    cand.mId.Construct(codeword);
-    cand.mTimestamp.Construct(now);
-    cand.mCandidateType.Construct(
-        RTCStatsIceCandidateType(c->type));
-    cand.mIpAddress.Construct(
-        NS_ConvertASCIItoUTF16(c->cand_addr.host.c_str()));
-    cand.mPortNumber.Construct(c->cand_addr.port);
-    report->mIceCandidateStats.Value().AppendElement(cand);
-  }
-}
-
-void PeerConnectionImpl::FillStatsReport_s(
-    NrIceMediaStream& mediaStream,
+void PeerConnectionImpl::GetStats_s(
+    TrackID trackId,
     bool internalStats,
-    DOMHighResTimeStamp now,
-    RTCStatsReportInternal* report) {
-
-  NS_ConvertASCIItoUTF16 componentId(mediaStream.name().c_str());
-  if (internalStats) {
-    std::vector<NrIceCandidatePair> candPairs;
-    nsresult res = mediaStream.GetCandidatePairs(&candPairs);
-    if (NS_FAILED(res)) {
-      CSFLogError(logTag, "%s: Error getting candidate pairs", __FUNCTION__);
-      return;
-    }
-
-    for (auto p = candPairs.begin(); p != candPairs.end(); ++p) {
-      NS_ConvertASCIItoUTF16 codeword(p->codeword.c_str());
-      NS_ConvertASCIItoUTF16 localCodeword(p->local.codeword.c_str());
-      NS_ConvertASCIItoUTF16 remoteCodeword(p->remote.codeword.c_str());
-      // Only expose candidate-pair statistics to chrome, until we've thought
-      // through the implications of exposing it to content.
-
-      RTCIceCandidatePairStats s;
-      s.mId.Construct(codeword);
-      s.mComponentId.Construct(componentId);
-      s.mTimestamp.Construct(now);
-      s.mType.Construct(RTCStatsType::Candidatepair);
-      s.mLocalCandidateId.Construct(localCodeword);
-      s.mRemoteCandidateId.Construct(remoteCodeword);
-      s.mNominated.Construct(p->nominated);
-      s.mMozPriority.Construct(p->priority);
-      s.mSelected.Construct(p->selected);
-      s.mState.Construct(RTCStatsIceCandidatePairState(p->state));
-      report->mIceCandidatePairStats.Value().AppendElement(s);
-    }
-  }
-
-  std::vector<NrIceCandidate> candidates;
-  if (NS_SUCCEEDED(mediaStream.GetLocalCandidates(&candidates))) {
-    ToRTCIceCandidateStats(candidates,
-                           RTCStatsType::Localcandidate,
-                           componentId,
-                           now,
-                           report);
-  }
-  candidates.clear();
-
-  if (NS_SUCCEEDED(mediaStream.GetRemoteCandidates(&candidates))) {
-    ToRTCIceCandidateStats(candidates,
-                           RTCStatsType::Remotecandidate,
-                           componentId,
-                           now,
-                           report);
-  }
-}
-
-void PeerConnectionImpl::GetStats_s(
-    const std::string& pcHandle, // The Runnable holds the memory
-    const std::string& pcName, // The Runnable holds the memory
-    nsCOMPtr<nsIThread> callbackThread,
-    bool internalStats,
-    const std::vector<RefPtr<MediaPipeline>>& pipelines,
-    const RefPtr<NrIceCtx>& iceCtx,
-    const std::vector<RefPtr<NrIceMediaStream>>& streams,
+    nsAutoPtr<std::vector<RefPtr<MediaPipeline>>> pipelines,
     DOMHighResTimeStamp now) {
 
-  ASSERT_ON_THREAD(iceCtx->thread());
+  nsAutoPtr<RTCStatsReportInternal> report(new RTCStatsReportInternalConstruct(
+      NS_ConvertASCIItoUTF16(mHandle.c_str()), now));
 
-  // We do not use the pcHandle here, since that's risky to expose to content.
-  nsAutoPtr<RTCStatsReportInternal> report(
-      new RTCStatsReportInternalConstruct(
-          NS_ConvertASCIItoUTF16(pcName.c_str()),
-          now));
+  nsresult rv = report ? GetStatsImpl_s(trackId, internalStats, pipelines, now,
+                                        report)
+                       : NS_ERROR_UNEXPECTED;
 
-  nsresult rv = GetStatsImpl_s(internalStats,
-                               pipelines,
-                               iceCtx,
-                               streams,
-                               now,
-                               report);
-
-  RUN_ON_THREAD(callbackThread,
-                WrapRunnableNM(&PeerConnectionImpl::OnStatsReport_m,
-                               pcHandle,
-                               rv,
-                               pipelines, // return for release on main thread
-                               report),
+  nsRefPtr<PeerConnectionImpl> pc(this);
+  RUN_ON_THREAD(mThread,
+                WrapRunnable(pc,
+                             &PeerConnectionImpl::OnStatsReport_m,
+                             rv,
+                             pipelines, // return for release on main thread
+                             report),
                 NS_DISPATCH_NORMAL);
 }
 
 void PeerConnectionImpl::OnStatsReport_m(
-    const std::string& pcHandle,
     nsresult result,
-    const std::vector<RefPtr<MediaPipeline>>& pipelines, //returned for release
+    nsAutoPtr<std::vector<RefPtr<MediaPipeline>>> pipelines, //returned for release
     nsAutoPtr<RTCStatsReportInternal> report) {
+  nsRefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
+  if (pco) {
+    JSErrorResult rv;
+    if (NS_SUCCEEDED(result)) {
+      pco->OnGetStatsSuccess(*report, rv);
+    } else {
+      pco->OnGetStatsError(kInternalError,
+                           ObString("Failed to fetch statistics"),
+                           rv);
+    }
 
-  // Is the PeerConnectionImpl still around?
-  PeerConnectionWrapper pcw(pcHandle);
-  if (pcw.impl()) {
-    nsRefPtr<PeerConnectionObserver> pco =
-        do_QueryObjectReferent(pcw.impl()->mPCObserver);
-    if (pco) {
-      JSErrorResult rv;
-      if (NS_SUCCEEDED(result)) {
-        pco->OnGetStatsSuccess(*report, rv);
-      } else {
-        pco->OnGetStatsError(kInternalError,
-            ObString("Failed to fetch statistics"),
-            rv);
-      }
-
-      if (rv.Failed()) {
-        CSFLogError(logTag, "Error firing stats observer callback");
-      }
+    if (rv.Failed()) {
+      CSFLogError(logTag, "Error firing stats observer callback");
     }
   }
 }
 
-void PeerConnectionImpl::GetLogging_s(const std::string& pcHandle,
-                                      nsCOMPtr<nsIThread> callbackThread,
-                                      const std::string& pattern) {
+void PeerConnectionImpl::GetLogging_s(const std::string& pattern) {
   RLogRingBuffer* logs = RLogRingBuffer::GetInstance();
-  nsAutoPtr<std::deque<std::string>> result(new std::deque<std::string>);
-  logs->Filter(pattern, 0, result);
-  RUN_ON_THREAD(callbackThread,
-                WrapRunnableNM(&PeerConnectionImpl::OnGetLogging_m,
-                               pcHandle,
-                               pattern,
-                               result),
+  std::deque<std::string> result;
+  logs->Filter(pattern, 0, &result);
+  nsRefPtr<PeerConnectionImpl> pc(this);
+  RUN_ON_THREAD(mThread,
+                WrapRunnable(pc,
+                             &PeerConnectionImpl::OnGetLogging_m,
+                             pattern,
+                             result),
                 NS_DISPATCH_NORMAL);
 }
 
-void PeerConnectionImpl::OnGetLogging_m(
-    const std::string& pcHandle,
-    const std::string& pattern,
-    nsAutoPtr<std::deque<std::string>> logging) {
+void PeerConnectionImpl::OnGetLogging_m(const std::string& pattern,
+                                        const std::deque<std::string>& logging) {
+  nsRefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
+  if (!pco) {
+    return;
+  }
 
-  // Is the PeerConnectionImpl still around?
-  PeerConnectionWrapper pcw(pcHandle);
-  if (pcw.impl()) {
-    nsRefPtr<PeerConnectionObserver> pco =
-        do_QueryObjectReferent(pcw.impl()->mPCObserver);
-    if (pco) {
-      JSErrorResult rv;
-      if (!logging->empty()) {
-        Sequence<nsString> nsLogs;
-        for (auto l = logging->begin(); l != logging->end(); ++l) {
-          nsLogs.AppendElement(ObString(l->c_str()));
-        }
-        pco->OnGetLoggingSuccess(nsLogs, rv);
-      } else {
-        pco->OnGetLoggingError(kInternalError,
-            ObString(("No logging matching pattern " + pattern).c_str()), rv);
-      }
+  JSErrorResult rv;
+  if (!logging.empty()) {
+    Sequence<nsString> nsLogs;
+    for (auto l = logging.begin(); l != logging.end(); ++l) {
+      nsLogs.AppendElement(ObString(l->c_str()));
+    }
+    pco->OnGetLoggingSuccess(nsLogs, rv);
+  } else {
+    pco->OnGetLoggingError(kInternalError,
+        ObString(("No logging matching pattern " + pattern).c_str()), rv);
+  }
 
-      if (rv.Failed()) {
-        CSFLogError(logTag, "Error firing stats observer callback");
-      }
-    }
+  if (rv.Failed()) {
+    CSFLogError(logTag, "Error firing stats observer callback");
   }
 }
+
+
 #endif
 
 void
 PeerConnectionImpl::IceStreamReady(NrIceMediaStream *aStream)
 {
   PC_AUTO_ENTER_API_CALL_NO_CHECK();
   MOZ_ASSERT(aStream);
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -218,19 +218,16 @@ public:
   const nsRefPtr<PeerConnectionMedia>& media() const {
     PC_AUTO_ENTER_API_CALL_NO_CHECK();
     return mMedia;
   }
 
   // Handle system to allow weak references to be passed through C code
   virtual const std::string& GetHandle();
 
-  // Name suitable for exposing to content
-  virtual const std::string& GetName();
-
   // ICE events
   void IceConnectionStateChange(NrIceCtx* ctx,
                                 NrIceCtx::ConnectionState state);
   void IceGatheringStateChange(NrIceCtx* ctx,
                                NrIceCtx::GatheringState state);
   void IceStreamReady(NrIceMediaStream *aStream);
 
   static void ListenThread(void *aData);
@@ -538,61 +535,42 @@ private:
   nsresult IceGatheringStateChange_m(
       mozilla::dom::PCImplIceGatheringState aState);
 
   NS_IMETHOD FingerprintSplitHelper(
       std::string& fingerprint, size_t& spaceIdx) const;
 
 
 #ifdef MOZILLA_INTERNAL_API
-  // TODO(bcampen@mozilla.com): Once the dust settles on this stuff, it
-  // probably makes sense to make these static in PeerConnectionImpl.cpp
-  // (ie; stop exporting them)
-
   // Fills in an RTCStatsReportInternal. Must be run on STS.
-  static void GetStats_s(
-      const std::string& pcHandle,
-      const std::string& pcName,
-      nsCOMPtr<nsIThread> callbackThread,
+  void GetStats_s(
+      mozilla::TrackID trackId,
       bool internalStats,
-      const std::vector<mozilla::RefPtr<mozilla::MediaPipeline>> &pipelines,
-      const mozilla::RefPtr<NrIceCtx> &iceCtx,
-      const std::vector<mozilla::RefPtr<NrIceMediaStream>> &streams,
+      nsAutoPtr<std::vector<mozilla::RefPtr<mozilla::MediaPipeline>>> pipelines,
       DOMHighResTimeStamp now);
 
-  static nsresult GetStatsImpl_s(
+  nsresult GetStatsImpl_s(
+      mozilla::TrackID trackId,
       bool internalStats,
-      const std::vector<mozilla::RefPtr<mozilla::MediaPipeline>> &pipelines,
-      const mozilla::RefPtr<NrIceCtx> &iceCtx,
-      const std::vector<mozilla::RefPtr<NrIceMediaStream>> &streams,
+      nsAutoPtr<std::vector<mozilla::RefPtr<mozilla::MediaPipeline>>> pipelines,
       DOMHighResTimeStamp now,
       mozilla::dom::RTCStatsReportInternal *report);
 
-  static void FillStatsReport_s(
-      NrIceMediaStream& stream,
-      bool internalStats,
-      DOMHighResTimeStamp now,
-      mozilla::dom::RTCStatsReportInternal* stats);
-
   // Sends an RTCStatsReport to JS. Must run on main thread.
-  static void OnStatsReport_m(
-      const std::string& pcHandle,
+  void OnStatsReport_m(
       nsresult result,
-      const std::vector<mozilla::RefPtr<mozilla::MediaPipeline>> &pipelines,
+      nsAutoPtr<std::vector<mozilla::RefPtr<mozilla::MediaPipeline>>> pipelines,
       nsAutoPtr<mozilla::dom::RTCStatsReportInternal> report);
 
   // Fetches logs matching pattern from RLogRingBuffer. Must be run on STS.
-  static void GetLogging_s(const std::string& pcHandle,
-                           nsCOMPtr<nsIThread> callbackThread,
-                           const std::string& pattern);
+  void GetLogging_s(const std::string& pattern);
 
   // Sends logging to JS. Must run on main thread.
-  static void OnGetLogging_m(const std::string& pcHandle,
-                             const std::string& pattern,
-                             nsAutoPtr<std::deque<std::string>> logging);
+  void OnGetLogging_m(const std::string& pattern,
+                      const std::deque<std::string>& logging);
 #endif
 
   // Timecard used to measure processing time. This should be the first class
   // attribute so that we accurately measure the time required to instantiate
   // any other attributes of this class.
   Timecard *mTimeCard;
 
   // The call
@@ -622,19 +600,16 @@ private:
   std::string mRemoteFingerprint;
 
   // The DTLS identity
   mozilla::RefPtr<DtlsIdentity> mIdentity;
 
   // A handle to refer to this PC with
   std::string mHandle;
 
-  // A name for this PC that we are willing to expose to content.
-  std::string mName;
-
   // The target to run stuff on
   nsCOMPtr<nsIEventTarget> mSTSThread;
 
 #ifdef MOZILLA_INTERNAL_API
   // DataConnection that's used to get all the DataChannels
 	nsRefPtr<mozilla::DataChannelConnection> mDataConnection;
 #endif
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -143,17 +143,17 @@ PeerConnectionMedia::PeerConnectionMedia
       mMainThread(mParent->GetMainThread()),
       mSTSThread(mParent->GetSTSThread()) {}
 
 nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
                                    const std::vector<NrIceTurnServer>& turn_servers)
 {
   // TODO(ekr@rtfm.com): need some way to set not offerer later
   // Looks like a bug in the NrIceCtx API.
-  mIceCtx = NrIceCtx::Create("PC:" + mParent->GetName(), true);
+  mIceCtx = NrIceCtx::Create("PC:" + mParent->GetHandle(), true);
   if(!mIceCtx) {
     CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
     return NS_ERROR_FAILURE;
   }
   nsresult rv;
   if (NS_FAILED(rv = mIceCtx->SetStunServers(stun_servers))) {
     CSFLogError(logTag, "%s: Failed to set stun servers", __FUNCTION__);
     return rv;
@@ -186,21 +186,21 @@ nsresult PeerConnectionMedia::Init(const
   mIceCtx->SignalConnectionStateChange.connect(
       this,
       &PeerConnectionMedia::IceConnectionStateChange);
 
   // Create three streams to start with.
   // One each for audio, video and DataChannel
   // TODO: this will be re-visited
   RefPtr<NrIceMediaStream> audioStream =
-    mIceCtx->CreateStream((mParent->GetName()+": stream1/audio").c_str(), 2);
+    mIceCtx->CreateStream((mParent->GetHandle()+"/stream1/audio").c_str(), 2);
   RefPtr<NrIceMediaStream> videoStream =
-    mIceCtx->CreateStream((mParent->GetName()+": stream2/video").c_str(), 2);
+    mIceCtx->CreateStream((mParent->GetHandle()+"/stream2/video").c_str(), 2);
   RefPtr<NrIceMediaStream> dcStream =
-    mIceCtx->CreateStream((mParent->GetName()+": stream3/data").c_str(), 2);
+    mIceCtx->CreateStream((mParent->GetHandle()+"/stream3/data").c_str(), 2);
 
   if (!audioStream) {
     CSFLogError(logTag, "%s: audio stream is NULL", __FUNCTION__);
     return NS_ERROR_FAILURE;
   } else {
     mIceStreams.push_back(audioStream);
   }
 
--- a/media/webrtc/signaling/test/mediapipeline_unittest.cpp
+++ b/media/webrtc/signaling/test/mediapipeline_unittest.cpp
@@ -192,17 +192,16 @@ class TestAgentSend : public TestAgent {
     }
 
     audio_pipeline_ = new mozilla::MediaPipelineTransmit(
         test_pc,
         nullptr,
         test_utils->sts_target(),
         audio_,
         1,
-        1,
         audio_conduit_,
         audio_rtp_transport_.flow_,
         audio_rtcp_transport_.flow_);
 
     audio_pipeline_->Init();
   }
 
   int GetAudioRtpCount() {
@@ -242,17 +241,17 @@ class TestAgentReceive : public TestAgen
     if (aIsRtcpMux) {
       ASSERT_FALSE(audio_rtcp_transport_.flow_);
     }
 
     audio_pipeline_ = new mozilla::MediaPipelineReceiveAudio(
         test_pc,
         nullptr,
         test_utils->sts_target(),
-        audio_->GetStream(), 1, 1,
+        audio_->GetStream(), 1,
         static_cast<mozilla::AudioSessionConduit *>(audio_conduit_.get()),
         audio_rtp_transport_.flow_, audio_rtcp_transport_.flow_);
 
     audio_pipeline_->Init();
   }
 
   int GetAudioRtpCount() {
     return audio_pipeline_->rtp_packets_received();