Backed out 4 changesets (bug 842549) for assertions
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 19 Sep 2013 19:53:33 -0700
changeset 148044 50ba1a4576ae087825725d970c7638d759ec007d
parent 148043 e309a5ebdd9b0470d2d88ffbbf51d071b11760bb
child 148045 e1998769de9e78033786a8212efda4b21825a839
push id2760
push useremorley@mozilla.com
push dateFri, 20 Sep 2013 09:38:33 +0000
treeherderfx-team@3ca60aa3a003 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs842549
milestone27.0a1
backs out9f2d0e38fdf85fd768afc7d998e796f88fe6882c
f6941e490ba2d614d44141ca50ef907c3faa27c4
c3444536fd8eddae6a842bb8939122284a83d623
2af2bfe5e66a069dd816114c398a9bc0668ec341
Backed out 4 changesets (bug 842549) for assertions CLOSED TREE Backed out changeset 9f2d0e38fdf8 (bug 842549) Backed out changeset f6941e490ba2 (bug 842549) Backed out changeset c3444536fd8e (bug 842549) Backed out changeset 2af2bfe5e66a (bug 842549)
dom/media/PeerConnection.js
dom/media/bridge/IPeerConnection.idl
media/mtransport/nricectx.cpp
media/mtransport/nricectx.h
media/mtransport/nricemediastream.cpp
media/mtransport/nricemediastream.h
media/mtransport/test/ice_unittest.cpp
media/mtransport/third_party/nICEr/src/ice/ice_candidate.c
media/mtransport/third_party/nICEr/src/ice/ice_component.c
media/mtransport/third_party/nICEr/src/ice/ice_component.h
media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
media/mtransport/third_party/nICEr/src/ice/ice_ctx.h
media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h
media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.h
media/webrtc/signaling/include/CC_CallInfo.h
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
media/webrtc/signaling/src/media/VcmSIPCCBinding.h
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
media/webrtc/signaling/src/sipcc/core/common/ui.c
media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
media/webrtc/signaling/src/sipcc/core/includes/sessionConstants.h
media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
media/webrtc/signaling/src/sipcc/core/includes/uiapi.h
media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
media/webrtc/signaling/src/sipcc/include/cc_constants.h
media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h
media/webrtc/signaling/test/Makefile.in
media/webrtc/signaling/test/sdp_unittests.cpp
media/webrtc/signaling/test/signaling_unittests.cpp
modules/libpref/src/init/all.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -232,17 +232,16 @@ function RTCPeerConnection() {
   this._onCreateOfferSuccess = null;
   this._onCreateOfferFailure = null;
   this._onCreateAnswerSuccess = null;
   this._onCreateAnswerFailure = null;
 
   this._pendingType = null;
   this._localType = null;
   this._remoteType = null;
-  this._trickleIce = false;
 
   /**
    * Everytime we get a request from content, we put it in the queue. If
    * there are no pending operations though, we will execute it immediately.
    * In PeerConnectionObserver, whenever we are notified that an operation
    * has finished, we will check the queue for the next operation and execute
    * if neccesary. The _pending flag indicates whether an operation is currently
    * in progress.
@@ -261,17 +260,16 @@ RTCPeerConnection.prototype = {
   classID: PC_CID,
   contractID: PC_CONTRACT,
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
                                          Ci.nsIDOMGlobalPropertyInitializer,
                                          Ci.nsISupportsWeakReference]),
   init: function(win) { this._win = win; },
 
   __init: function(rtcConfig) {
-    this._trickleIce = Services.prefs.getBoolPref("media.peerconnection.trickle_ice");
     if (!rtcConfig.iceServers ||
         !Services.prefs.getBoolPref("media.peerconnection.use_document_iceservers")) {
       rtcConfig = {iceServers:
         JSON.parse(Services.prefs.getCharPref("media.peerconnection.default_iceservers"))};
     }
     this._mustValidateRTCConfiguration(rtcConfig,
         "RTCPeerConnection constructor passed invalid RTCConfiguration");
     if (_globalPCList._networkdown) {
@@ -293,21 +291,21 @@ RTCPeerConnection.prototype = {
              createInstance(Ci.IPeerConnection);
     this._observer = new PeerConnectionObserver(this);
     this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
 
     // Add a reference to the PeerConnection to global list (before init).
     _globalPCList.addPC(this);
 
+    // Nothing starts until ICE gathering completes.
     this._queueOrRun({
       func: this._getPC().initialize,
       args: [this._observer, this._win, rtcConfig, Services.tm.currentThread],
-      // If not trickling, suppress start.
-      wait: !this._trickleIce
+      wait: true
     });
   },
 
   _getPC: function() {
     if (!this._pc) {
       throw new this._win.DOMError("",
           "RTCPeerConnection is gone (did you enter Offline mode?)");
     }
@@ -963,21 +961,23 @@ PeerConnectionObserver.prototype = {
     this._dompc._executeNext();
   },
 
   onSetLocalDescriptionSuccess: function() {
     this._dompc._localType = this._dompc._pendingType;
     this._dompc._pendingType = null;
     this.callCB(this._dompc._onSetLocalDescriptionSuccess);
 
-    if (this._iceGatheringState == "complete") {
-        // If we are not trickling or we completed gathering prior
-        // to setLocal, then trigger a call of onicecandidate here.
-        this.foundIceCandidate(null);
-    }
+    // Until we support generating trickle ICE candidates,
+    // we go ahead and trigger a call of onicecandidate here.
+    // This is to provide some level of compatibility with
+    // scripts that expect this behavior (which is how Chrome
+    // signals that no further trickle candidates will be sent).
+    // TODO: This needs to be removed when Bug 842459 lands.
+    this.foundIceCandidate(null);
 
     this._dompc._executeNext();
   },
 
   onSetRemoteDescriptionSuccess: function() {
     this._dompc._remoteType = this._dompc._pendingType;
     this._dompc._pendingType = null;
     this.callCB(this._dompc._onSetRemoteDescriptionSuccess);
@@ -1005,45 +1005,25 @@ PeerConnectionObserver.prototype = {
   },
 
   onAddIceCandidateError: function(code, message) {
     this._dompc._pendingType = null;
     this.callCB(this._dompc._onAddIceCandidateError, new RTCError(code, message));
     this._dompc._executeNext();
   },
 
-  onIceCandidate: function(level, mid, candidate) {
-    this.foundIceCandidate(new this._dompc._win.mozRTCIceCandidate(
-        {
-            candidate: candidate,
-            sdpMid: mid,
-            sdpMLineIndex: level
-        }
-    ));
-  },
-
   handleIceStateChanges: function(iceState) {
     var histogram = Services.telemetry.getHistogramById("WEBRTC_ICE_SUCCESS_RATE");
     switch (iceState) {
       case Ci.IPeerConnection.kIceWaiting:
         this._dompc.changeIceConnectionState("new");
         this.callCB(this._dompc.ongatheringchange, "complete");
         this.callCB(this._onicechange, "starting");
-
-        if (!this._dompc._trickleIce) {
-          // If we are not trickling, then the queue is in a pending state
-          // waiting for ICE gathering and executeNext frees it
-          this._dompc._executeNext();
-        }
-        else if (this.localDescription) {
-          // If we are trickling but we have already done setLocal,
-          // then we need to send a final foundIceCandidate(null) to indicate
-          // that we are done gathering.
-          this.foundIceCandidate(null);
-        }
+        // Now that the PC is ready to go, execute any pending operations.
+        this._dompc._executeNext();
         break;
       case Ci.IPeerConnection.kIceChecking:
         this._dompc.changeIceConnectionState("checking");
         this.callCB(this._onicechange, "checking");
         break;
       case Ci.IPeerConnection.kIceGathering:
         this._dompc.changeIceGatheringState("gathering");
         this.callCB(this._ongatheringchange, "gathering");
@@ -1096,23 +1076,19 @@ PeerConnectionObserver.prototype = {
                                                              { stream: stream }));
   },
 
   onRemoveStream: function(stream, type) {
     this.dispatchEvent(new this._dompc._win.MediaStreamEvent("removestream",
                                                              { stream: stream }));
   },
 
-  foundIceCandidate: function(cand, mid, line) {
+  foundIceCandidate: function(c) {
     this.dispatchEvent(new this._dompc._win.RTCPeerConnectionIceEvent("icecandidate",
-                                                                      {
-                                                                          candidate: cand,
-                                                                          sdpMid: mid,
-                                                                          sdpMLineIndex: line
-                                                                      }));
+                                                                      { candidate: c }));
   },
 
   notifyDataChannel: function(channel) {
     this.dispatchEvent(new this._dompc._win.RTCDataChannelEvent("datachannel",
                                                                 { channel: channel }));
   },
 
   notifyConnection: function() {
--- a/dom/media/bridge/IPeerConnection.idl
+++ b/dom/media/bridge/IPeerConnection.idl
@@ -19,17 +19,17 @@ interface IPeerConnectionManager : nsISu
 %}
 
 /* Do not confuse with nsIDOMRTCPeerConnection. This interface is purely for
  * communication between the PeerConnection JS DOM binding and the C++
  * implementation in SIPCC.
  *
  * See media/webrtc/signaling/include/PeerConnectionImpl.h
  */
-[scriptable, uuid(896dc16a-05d6-45e4-bdbf-aba57123ed3e)]
+[scriptable, uuid(cf9152f0-c9a8-4093-9435-1daa056e0177)]
 interface IPeerConnectionObserver : nsISupports
 {
   /* Constants */
   const long kReadyState = 0x1;
   const long kIceState = 0x2;
   const long kSdpState = 0x3;
   const long kSipccState = 0x4;
   const long kSignalingState = 0x5;
@@ -40,31 +40,37 @@ interface IPeerConnectionObserver : nsIS
   void onCreateAnswerSuccess(in string answer);
   void onCreateAnswerError(in unsigned long name, in string message);
   void onSetLocalDescriptionSuccess();
   void onSetRemoteDescriptionSuccess();
   void onSetLocalDescriptionError(in unsigned long name, in string message);
   void onSetRemoteDescriptionError(in unsigned long name, in string message);
   void onAddIceCandidateSuccess();
   void onAddIceCandidateError(in unsigned long name, in string message);
-  void onIceCandidate(in unsigned short level, in string mid, in string candidate);
 
   /* Data channel callbacks */
   void notifyDataChannel(in nsIDOMDataChannel channel);
   void notifyConnection();
   void notifyClosedConnection();
 
   /* Notification of one of several types of state changed */
   void onStateChange(in unsigned long state);
 
   /* Changes to MediaStreams */
   void onAddStream(in nsIDOMMediaStream stream);
   void onRemoveStream();
   void onAddTrack();
   void onRemoveTrack();
+
+  /* When SDP is parsed and a candidate line is found this method is called.
+   * It should hook back into the media transport to notify it of ICE candidates
+   * listed in the SDP PeerConnectionImpl does not parse ICE candidates, just
+   * pulls them out of the SDP.
+   */
+  void foundIceCandidate(in string candidate);
 };
 
 [scriptable, uuid(930dce8b-7c5e-4393-b8c0-cb3a928f68bd)]
 interface IPeerConnection : nsISupports
 {
   const unsigned long kHintAudio = 0x00000001;
   const unsigned long kHintVideo = 0x00000002;
 
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -247,17 +247,17 @@ int NrIceCtx::select_pair(void *obj,nr_i
             << potential_ct);
 
   return 0;
 }
 
 int NrIceCtx::stream_ready(void *obj, nr_ice_media_stream *stream) {
   MOZ_MTLOG(ML_DEBUG, "stream_ready called");
 
-  // Get the ICE ctx.
+  // Get the ICE ctx
   NrIceCtx *ctx = static_cast<NrIceCtx *>(obj);
 
   RefPtr<NrIceMediaStream> s = ctx->FindStream(stream);
 
   // Streams which do not exist should never be ready.
   MOZ_ASSERT(s);
 
   s->Ready();
@@ -301,40 +301,16 @@ int NrIceCtx::msg_recvd(void *obj, nr_ic
   // Streams which do not exist should never have packets.
   MOZ_ASSERT(s);
 
   s->SignalPacketReceived(s, component_id, msg, len);
 
   return 0;
 }
 
-void NrIceCtx::trickle_cb(void *arg, nr_ice_ctx *ice_ctx,
-                          nr_ice_media_stream *stream,
-                          int component_id,
-                          nr_ice_candidate *candidate) {
-  // Get the ICE ctx
-  NrIceCtx *ctx = static_cast<NrIceCtx *>(arg);
-  RefPtr<NrIceMediaStream> s = ctx->FindStream(stream);
-
-  // Streams which do not exist shouldn't have candidates.
-  MOZ_ASSERT(s);
-
-  // Format the candidate.
-  char candidate_str[NR_ICE_MAX_ATTRIBUTE_SIZE];
-  int r = nr_ice_format_candidate_attribute(candidate, candidate_str,
-                                            sizeof(candidate_str));
-  MOZ_ASSERT(!r);
-  if (r)
-    return;
-
-  MOZ_MTLOG(ML_INFO, "NrIceCtx(" << ctx->name_ << "): trickling candidate "
-            << candidate_str);
-
-  s->SignalCandidate(s, candidate_str);
-}
 
 RefPtr<NrIceCtx> NrIceCtx::Create(const std::string& name,
                                   bool offerer,
                                   bool set_interface_priorities) {
   RefPtr<NrIceCtx> ctx = new NrIceCtx(name, offerer);
 
   // Initialize the crypto callbacks
   if (!initialized) {
@@ -402,24 +378,16 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const 
 
   r = nr_ice_ctx_set_interface_prioritizer(ctx->ctx_, prioritizer);
   if (r) {
     MOZ_MTLOG(PR_LOG_ERROR, "Couldn't set interface prioritizer.");
     return nullptr;
   }
 #endif  // USE_INTERFACE_PRIORITIZER
 
-  if (ctx->generating_trickle()) {
-    r = nr_ice_ctx_set_trickle_cb(ctx->ctx_, &NrIceCtx::trickle_cb, ctx);
-    if (r) {
-      MOZ_MTLOG(ML_ERROR, "Couldn't set trickle cb for '" << name << "'");
-      return nullptr;
-    }
-  }
-
   // Create the handler objects
   ctx->ice_handler_vtbl_ = new nr_ice_handler_vtbl();
   ctx->ice_handler_vtbl_->select_pair = &NrIceCtx::select_pair;
   ctx->ice_handler_vtbl_->stream_ready = &NrIceCtx::stream_ready;
   ctx->ice_handler_vtbl_->stream_failed = &NrIceCtx::stream_failed;
   ctx->ice_handler_vtbl_->ice_completed = &NrIceCtx::ice_completed;
   ctx->ice_handler_vtbl_->msg_recvd = &NrIceCtx::msg_recvd;
 
@@ -562,16 +530,25 @@ nsresult NrIceCtx::StartGathering() {
       return NS_ERROR_FAILURE;
   }
 
   SetState(ICE_CTX_GATHERING);
 
   return NS_OK;
 }
 
+void NrIceCtx::EmitAllCandidates() {
+  MOZ_MTLOG(ML_NOTICE, "Gathered all ICE candidates for '"
+            << name_ << "'");
+
+  for(size_t i=0; i<streams_.size(); ++i) {
+    streams_[i]->EmitAllCandidates();
+  }
+}
+
 RefPtr<NrIceMediaStream> NrIceCtx::FindStream(
     nr_ice_media_stream *stream) {
   for (size_t i=0; i<streams_.size(); ++i) {
     if (streams_[i]->stream() == stream) {
       return streams_[i];
     }
   }
 
@@ -648,16 +625,18 @@ nsresult NrIceCtx::StartChecks() {
 
   return NS_OK;
 }
 
 
 void NrIceCtx::initialized_cb(NR_SOCKET s, int h, void *arg) {
   NrIceCtx *ctx = static_cast<NrIceCtx *>(arg);
 
+  ctx->EmitAllCandidates();
+
   ctx->SetState(ICE_CTX_GATHERED);
 }
 
 nsresult NrIceCtx::Finalize() {
   int r = nr_ice_ctx_finalize(ctx_, peer_);
 
   if (r) {
     MOZ_MTLOG(ML_ERROR, "Couldn't finalize "
--- a/media/mtransport/nricectx.h
+++ b/media/mtransport/nricectx.h
@@ -64,17 +64,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
 #include "m_cpp_utils.h"
 
 typedef struct nr_ice_ctx_ nr_ice_ctx;
 typedef struct nr_ice_peer_ctx_ nr_ice_peer_ctx;
 typedef struct nr_ice_media_stream_ nr_ice_media_stream;
 typedef struct nr_ice_handler_ nr_ice_handler;
 typedef struct nr_ice_handler_vtbl_ nr_ice_handler_vtbl;
-typedef struct nr_ice_candidate_ nr_ice_candidate;
 typedef struct nr_ice_cand_pair_ nr_ice_cand_pair;
 typedef struct nr_ice_stun_server_ nr_ice_stun_server;
 typedef struct nr_ice_turn_server_ nr_ice_turn_server;
 typedef struct nr_resolver_ nr_resolver;
 
 typedef void* NR_SOCKET;
 
 namespace mozilla {
@@ -217,19 +216,16 @@ class NrIceCtx {
 
   // Start checking
   nsresult StartChecks();
 
   // Finalize the ICE negotiation. I.e., there will be no
   // more forking.
   nsresult Finalize();
 
-  // Are we trickling?
-  bool generating_trickle() const { return trickle_; }
-
   // Signals to indicate events. API users can (and should)
   // register for these.
   // TODO(ekr@rtfm.com): refactor this to be state change instead
   // so we don't need to keep adding signals?
   sigslot::signal1<NrIceCtx *> SignalGatheringCompleted;  // Done gathering
   sigslot::signal1<NrIceCtx *> SignalCompleted;  // Done handshaking
   sigslot::signal1<NrIceCtx *> SignalFailed;  // Failure.
 
@@ -243,18 +239,18 @@ class NrIceCtx {
            bool offerer)
   : state_(ICE_CTX_INIT),
     name_(name),
     offerer_(offerer),
     streams_(),
     ctx_(nullptr),
     peer_(nullptr),
     ice_handler_vtbl_(nullptr),
-    ice_handler_(nullptr),
-    trickle_(true) {
+    ice_handler_(nullptr)
+  {
     // XXX: offerer_ will be used eventually;  placate clang in the meantime.
     (void)offerer_;
   }
 
   DISALLOW_COPY_ASSIGN(NrIceCtx);
 
   // Callbacks for nICEr
   static void initialized_cb(NR_SOCKET s, int h, void *arg);  // ICE initialized
@@ -264,32 +260,33 @@ class NrIceCtx {
                          int component_id, nr_ice_cand_pair **potentials,
                          int potential_ct);
   static int stream_ready(void *obj, nr_ice_media_stream *stream);
   static int stream_failed(void *obj, nr_ice_media_stream *stream);
   static int ice_completed(void *obj, nr_ice_peer_ctx *pctx);
   static int msg_recvd(void *obj, nr_ice_peer_ctx *pctx,
                        nr_ice_media_stream *stream, int component_id,
                        unsigned char *msg, int len);
-  static void trickle_cb(void *arg, nr_ice_ctx *ctx, nr_ice_media_stream *stream,
-                         int component_id, nr_ice_candidate *candidate);
+
+  // Iterate through all media streams and emit the candidates
+  // Note that we don't do trickle ICE yet
+  void EmitAllCandidates();
 
   // Find a media stream by stream ptr. Gross
   RefPtr<NrIceMediaStream> FindStream(nr_ice_media_stream *stream);
 
   // Set the state
   void SetState(State state);
 
   State state_;
   const std::string name_;
   bool offerer_;
   std::vector<RefPtr<NrIceMediaStream> > streams_;
   nr_ice_ctx *ctx_;
   nr_ice_peer_ctx *peer_;
   nr_ice_handler_vtbl* ice_handler_vtbl_;  // Must be pointer
   nr_ice_handler* ice_handler_;  // Must be pointer
-  bool trickle_;
   nsCOMPtr<nsIEventTarget> sts_target_; // The thread to run on
 };
 
 
 }  // close namespace
 #endif
--- a/media/mtransport/nricemediastream.cpp
+++ b/media/mtransport/nricemediastream.cpp
@@ -238,16 +238,36 @@ nsresult NrIceMediaStream::GetActivePair
     *localp = local.forget();
   if (remotep)
     *remotep = remote.forget();
 
   return NS_OK;
 }
 
 
+void NrIceMediaStream::EmitAllCandidates() {
+  char **attrs = 0;
+  int attrct;
+  int r;
+  r = nr_ice_media_stream_get_attributes(stream_,
+                                         &attrs, &attrct);
+  if (r) {
+    MOZ_MTLOG(ML_ERROR, "Couldn't get ICE candidates for '"
+         << name_ << "'");
+    return;
+  }
+
+  for (int i=0; i<attrct; i++) {
+    SignalCandidate(this, attrs[i]);
+    RFREE(attrs[i]);
+  }
+
+  RFREE(attrs);
+}
+
 nsresult NrIceMediaStream::GetCandidatePairs(std::vector<NrIceCandidatePair>*
                                              out_pairs) const {
   MOZ_ASSERT(out_pairs);
 
   // Get the check_list on the peer stream (this is where the check_list
   // actually lives, not in stream_)
   nr_ice_media_stream* peer_stream;
   int r = nr_ice_peer_ctx_find_pstream(ctx_->peer(), stream_, &peer_stream);
@@ -307,45 +327,33 @@ nsresult NrIceMediaStream::GetDefaultCan
                                                std::string *addrp,
                                                int *portp) {
   nr_ice_candidate *cand;
   int r;
 
   r = nr_ice_media_stream_get_default_candidate(stream_,
                                                 component, &cand);
   if (r) {
-    if (ctx_->generating_trickle()) {
-      // Generate default trickle candidates.
-      // draft-ivov-mmusic-trickle-ice-01.txt says to use port 9
-      // but "::" instead of "0.0.0.0". Since we don't do any
-      // IPv6 we are ignoring that for now.
-      *addrp = "0.0.0.0";
-      *portp = 9;
-    }
-    else {
-      MOZ_MTLOG(ML_ERROR, "Couldn't get default ICE candidate for '"
-                << name_ << "'");
-
-      return NS_ERROR_NOT_AVAILABLE;
-    }
+    MOZ_MTLOG(ML_ERROR, "Couldn't get default ICE candidate for '"
+              << name_ << "'");
+    return NS_ERROR_NOT_AVAILABLE;
   }
-  else {
-    char addr[64];  // Enough for IPv6 with colons.
-    r = nr_transport_addr_get_addrstring(&cand->addr,addr,sizeof(addr));
-    if (r)
-      return NS_ERROR_FAILURE;
+
+  char addr[64];  // Enough for IPv6 with colons.
+  r = nr_transport_addr_get_addrstring(&cand->addr,addr,sizeof(addr));
+  if (r)
+    return NS_ERROR_FAILURE;
 
-    int port;
-    r=nr_transport_addr_get_port(&cand->addr,&port);
-    if (r)
-      return NS_ERROR_FAILURE;
+  int port;
+  r=nr_transport_addr_get_port(&cand->addr,&port);
+  if (r)
+    return NS_ERROR_FAILURE;
 
-    *addrp = addr;
-    *portp = port;
-  }
+  *addrp = addr;
+  *portp = port;
 
   return NS_OK;
 }
 
 std::vector<std::string> NrIceMediaStream::GetCandidates() const {
   char **attrs = 0;
   int attrct;
   int r;
--- a/media/mtransport/nricemediastream.h
+++ b/media/mtransport/nricemediastream.h
@@ -101,22 +101,16 @@ struct NrIceCandidatePair {
   // Set if this candidate pair has been selected. Note: Since we are using
   // aggressive nomination, this could change frequently as ICE runs.
   bool selected;
   NrIceCandidate local;
   NrIceCandidate remote;
   // TODO(bcampen@mozilla.com): Is it important to put the foundation in here?
 };
 
-// Abstract base class for opaque values.
-class NrIceOpaque {
- public:
-  virtual ~NrIceOpaque() {}
-};
-
 class NrIceMediaStream {
  public:
   static RefPtr<NrIceMediaStream> Create(NrIceCtx *ctx,
                                          const std::string& name,
                                          int components);
   ~NrIceMediaStream();
 
   enum State { ICE_CONNECTING, ICE_OPEN, ICE_CLOSED};
@@ -165,46 +159,42 @@ class NrIceMediaStream {
   void Ready();
 
   // Close the stream. Called by the NrIceCtx.
   // Different from the destructor because other people
   // might be holding RefPtrs but we want those writes to fail once
   // the context has been destroyed.
   void Close();
 
-  // Set an opaque value. Owned by the media stream.
-  void SetOpaque(NrIceOpaque *opaque) { opaque_ = opaque; }
-
-  // Get the opaque
-  NrIceOpaque* opaque() const { return opaque_; }
-
   sigslot::signal2<NrIceMediaStream *, const std::string& >
   SignalCandidate;  // A new ICE candidate:
   sigslot::signal1<NrIceMediaStream *> SignalReady;  // Candidate pair ready.
   sigslot::signal1<NrIceMediaStream *> SignalFailed;  // Candidate pair failed.
   sigslot::signal4<NrIceMediaStream *, int, const unsigned char *, int>
   SignalPacketReceived;  // Incoming packet
 
+  // Emit all the ICE candidates. Note that this doesn't
+  // work for trickle ICE yet--called internally
+  void EmitAllCandidates();
+
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(NrIceMediaStream)
 
  private:
   NrIceMediaStream(NrIceCtx *ctx,  const std::string& name,
                    int components) :
       state_(ICE_CONNECTING),
       ctx_(ctx),
       name_(name),
       components_(components),
-      stream_(nullptr),
-      opaque_(nullptr) {}
+      stream_(nullptr) {}
 
   DISALLOW_COPY_ASSIGN(NrIceMediaStream);
 
   State state_;
   NrIceCtx *ctx_;
   const std::string name_;
   const int components_;
   nr_ice_media_stream *stream_;
-  ScopedDeletePtr<NrIceOpaque> opaque_;
 };
 
 
 }  // close namespace
 #endif
--- a/media/mtransport/test/ice_unittest.cpp
+++ b/media/mtransport/test/ice_unittest.cpp
@@ -49,26 +49,23 @@ const std::string kDefaultStunServerAddr
 const std::string kDefaultStunServerHostname(
     (char *)"ec2-23-21-150-121.compute-1.amazonaws.com");
 const std::string kBogusStunServerHostname(
     (char *)"stun-server-nonexistent.invalid");
 const uint16_t kDefaultStunServerPort=3478;
 const std::string kBogusIceCandidate(
     (char *)"candidate:0 2 UDP 2113601790 192.168.178.20 50769 typ");
 
-std::string g_stun_server_address(kDefaultStunServerAddress);
-std::string g_stun_server_hostname(kDefaultStunServerHostname);
 std::string g_turn_server;
 std::string g_turn_user;
 std::string g_turn_password;
 
 namespace {
 
-enum TrickleMode { TRICKLE_NONE, TRICKLE_SIMULATE, TRICKLE_REAL };
-
+enum TrickleMode { TRICKLE_NONE, TRICKLE_DEFERRED };
 typedef bool (*CandidateFilter)(const std::string& candidate);
 
 static bool IsRelayCandidate(const std::string& candidate) {
   return candidate.find("typ relay") != std::string::npos;
 }
 
 bool ContainsSucceededPair(const std::vector<NrIceCandidatePair>& pairs) {
   for (size_t i = 0; i < pairs.size(); ++i) {
@@ -126,19 +123,17 @@ class IceTestPeer : public sigslot::has_
       ice_complete_(false),
       received_(0),
       sent_(0),
       fake_resolver_(),
       dns_resolver_(new NrIceResolver()),
       remote_(nullptr),
       candidate_filter_(nullptr),
       expected_local_type_(NrIceCandidate::ICE_HOST),
-      expected_remote_type_(NrIceCandidate::ICE_HOST),
-      trickle_mode_(TRICKLE_NONE),
-      trickled_(0) {
+      expected_remote_type_(NrIceCandidate::ICE_HOST) {
     ice_ctx_->SignalGatheringCompleted.connect(this,
                                                &IceTestPeer::GatheringComplete);
     ice_ctx_->SignalCompleted.connect(this, &IceTestPeer::IceCompleted);
   }
 
   ~IceTestPeer() {
     test_utils->sts_target()->Dispatch(WrapRunnable(this,
                                                     &IceTestPeer::Shutdown),
@@ -154,17 +149,17 @@ class IceTestPeer : public sigslot::has_
     snprintf(name, sizeof(name), "%s:stream%d", name_.c_str(),
              (int)streams_.size());
 
     mozilla::RefPtr<NrIceMediaStream> stream =
         ice_ctx_->CreateStream(static_cast<char *>(name), components);
 
     ASSERT_TRUE(stream);
     streams_.push_back(stream);
-    stream->SignalCandidate.connect(this, &IceTestPeer::CandidateInitialized);
+    stream->SignalCandidate.connect(this, &IceTestPeer::GotCandidate);
     stream->SignalReady.connect(this, &IceTestPeer::StreamReady);
     stream->SignalFailed.connect(this, &IceTestPeer::StreamFailed);
     stream->SignalPacketReceived.connect(this, &IceTestPeer::PacketReceived);
   }
 
   void SetStunServer(const std::string addr, uint16_t port) {
     std::vector<NrIceStunServer> stun_servers;
     ScopedDeletePtr<NrIceStunServer> server(NrIceStunServer::Create(addr,
@@ -189,21 +184,21 @@ class IceTestPeer : public sigslot::has_
         addr, port, username, password));
     turn_servers.push_back(*server);
     ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetTurnServers(turn_servers)));
   }
 
   void SetFakeResolver() {
     ASSERT_TRUE(NS_SUCCEEDED(dns_resolver_->Init()));
     PRNetAddr addr;
-    PRStatus status = PR_StringToNetAddr(g_stun_server_address.c_str(),
-                                          &addr);
+    PRStatus status = PR_StringToNetAddr(kDefaultStunServerAddress.c_str(),
+                                         &addr);
     addr.inet.port = kDefaultStunServerPort;
     ASSERT_EQ(PR_SUCCESS, status);
-    fake_resolver_.SetAddr(g_stun_server_hostname, addr);
+    fake_resolver_.SetAddr(kDefaultStunServerHostname, addr);
     ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetResolver(
         fake_resolver_.AllocateResolver())));
   }
 
   void SetDNSResolver() {
     ASSERT_TRUE(NS_SUCCEEDED(dns_resolver_->Init()));
     ASSERT_TRUE(NS_SUCCEEDED(ice_ctx_->SetResolver(
         dns_resolver_->AllocateResolver())));
@@ -219,28 +214,17 @@ class IceTestPeer : public sigslot::has_
     ASSERT_TRUE(NS_SUCCEEDED(res));
   }
 
   // Get various pieces of state
   std::vector<std::string> GetGlobalAttributes() {
     return ice_ctx_->GetGlobalAttributes();
   }
 
-   std::vector<std::string> GetCandidates(size_t stream) {
-    std::vector<std::string> v;
-
-    RUN_ON_THREAD(
-        test_utils->sts_target(),
-        WrapRunnableRet(this, &IceTestPeer::GetCandidates_s, stream, &v),
-        NS_DISPATCH_SYNC);
-
-    return v;
-  }
-
-  std::vector<std::string> GetCandidates_s(size_t stream) {
+  std::vector<std::string> GetCandidates(size_t stream) {
     std::vector<std::string> candidates;
 
     if (stream >= streams_.size())
       return candidates;
 
     std::vector<std::string> candidates_in =
       streams_[stream]->GetCandidates();
 
@@ -250,79 +234,71 @@ class IceTestPeer : public sigslot::has_
         std::cerr << "Returning candidate: " << candidates_in[i] << std::endl;
         candidates.push_back(candidates_in[i]);
       }
     }
 
     return candidates;
   }
 
-  void SetExpectedTypes(NrIceCandidate::Type local,
-                        NrIceCandidate::Type remote) {
+  void SetExpectedTypes(NrIceCandidate::Type local, NrIceCandidate::Type remote) {
     expected_local_type_ = local;
     expected_remote_type_ = remote;
   }
 
   bool gathering_complete() { return gathering_complete_; }
   int ready_ct() { return ready_ct_; }
   bool is_ready(size_t stream) {
     return streams_[stream]->state() == NrIceMediaStream::ICE_OPEN;
   }
   bool ice_complete() { return ice_complete_; }
   size_t received() { return received_; }
   size_t sent() { return sent_; }
 
   // Start connecting to another peer
-  void Connect_s(IceTestPeer *remote, TrickleMode trickle_mode,
-                 bool start = true) {
+  void Connect(IceTestPeer *remote, TrickleMode trickle_mode,
+               bool start = true) {
     nsresult res;
 
     remote_ = remote;
 
-    trickle_mode_ = trickle_mode;
-    res = ice_ctx_->ParseGlobalAttributes(remote->GetGlobalAttributes());
+    test_utils->sts_target()->Dispatch(
+      WrapRunnableRet(ice_ctx_,
+        &NrIceCtx::ParseGlobalAttributes, remote->GetGlobalAttributes(), &res),
+      NS_DISPATCH_SYNC);
     ASSERT_TRUE(NS_SUCCEEDED(res));
 
-    if (trickle_mode == TRICKLE_NONE ||
-        trickle_mode == TRICKLE_REAL) {
+    if (trickle_mode == TRICKLE_NONE) {
       for (size_t i=0; i<streams_.size(); ++i) {
-        std::vector<std::string> candidates =
-            remote->GetCandidates(i);
+        test_utils->sts_target()->Dispatch(
+            WrapRunnableRet(streams_[i], &NrIceMediaStream::ParseAttributes,
+                            remote->GetCandidates(i),
+                            &res), NS_DISPATCH_SYNC);
 
-        for (size_t j=0; j<candidates.size(); ++j) {
-          std::cerr << "Candidate: " + candidates[j] << std::endl;
-        }
-        res = streams_[i]->ParseAttributes(candidates);
         ASSERT_TRUE(NS_SUCCEEDED(res));
       }
     } else {
       // Parse empty attributes and then trickle them out later
       for (size_t i=0; i<streams_.size(); ++i) {
         std::vector<std::string> empty_attrs;
-        res = streams_[i]->ParseAttributes(empty_attrs);
+        test_utils->sts_target()->Dispatch(
+            WrapRunnableRet(streams_[i], &NrIceMediaStream::ParseAttributes,
+                            empty_attrs,
+                            &res), NS_DISPATCH_SYNC);
+
         ASSERT_TRUE(NS_SUCCEEDED(res));
       }
     }
 
     if (start) {
-      // Now start checks
-      res = ice_ctx_->StartChecks();
-      ASSERT_TRUE(NS_SUCCEEDED(res));
+      StartChecks();
     }
   }
 
-  void Connect(IceTestPeer *remote, TrickleMode trickle_mode,
-               bool start = true) {
-    test_utils->sts_target()->Dispatch(
-        WrapRunnable(
-            this, &IceTestPeer::Connect_s, remote, trickle_mode, start),
-        NS_DISPATCH_SYNC);
-  }
-
-  void SimulateTrickle(size_t stream) {
+  void DoTrickle(size_t stream) {
     std::cerr << "Doing trickle for stream " << stream << std::endl;
     // If we are in trickle deferred mode, now trickle in the candidates
     // for |stream}
     nsresult res;
 
     ASSERT_GT(remote_->streams_.size(), stream);
 
     std::vector<std::string> candidates =
@@ -411,51 +387,22 @@ class IceTestPeer : public sigslot::has_
     test_utils->sts_target()->Dispatch(
         WrapRunnableRet(ice_ctx_, &NrIceCtx::StartChecks, &res),
         NS_DISPATCH_SYNC);
     ASSERT_TRUE(NS_SUCCEEDED(res));
   }
 
   // Handle events
   void GatheringComplete(NrIceCtx *ctx) {
-    std::cerr << "Gathering complete for " <<  name_ << std::endl;
     gathering_complete_ = true;
-
-    std::cerr << "CANDIDATES:" << std::endl;
-    for (size_t i=0; i<streams_.size(); ++i) {
-      std::cerr << "Stream " << name_ << std::endl;
-      std::vector<std::string> candidates =
-          streams_[i]->GetCandidates();
-
-      for(size_t j=0; j<candidates.size(); ++j) {
-        std::cerr << candidates[j] << std::endl;
-      }
-    }
-    std::cerr << std::endl;
-
   }
 
-  void CandidateInitialized(NrIceMediaStream *stream, const std::string &candidate) {
-    std::cerr << "Candidate initialized: " << candidate << std::endl;
+  void GotCandidate(NrIceMediaStream *stream, const std::string &candidate) {
+    std::cerr << "Got candidate " << candidate << std::endl;
     candidates_[stream->name()].push_back(candidate);
-
-    // If we are connected, then try to trickle to the
-    // other side.
-    if (remote_ && remote_->remote_) {
-      std::vector<mozilla::RefPtr<NrIceMediaStream> >::iterator it =
-          std::find(streams_.begin(), streams_.end(), stream);
-      ASSERT_NE(streams_.end(), it);
-      size_t index = it - streams_.begin();
-
-      ASSERT_GT(remote_->streams_.size(), index);
-      nsresult res = remote_->streams_[index]->ParseTrickleCandidate(
-          candidate);
-      ASSERT_TRUE(NS_SUCCEEDED(res));
-      ++trickled_;
-    }
   }
 
   nsresult GetCandidatePairs(size_t stream_index,
                              std::vector<NrIceCandidatePair>* pairs) {
     MOZ_ASSERT(pairs);
     if (stream_index >= streams_.size()) {
       // Is there a better error for "no such index"?
       ADD_FAILURE() << "No such media stream index: " << stream_index;
@@ -618,57 +565,47 @@ class IceTestPeer : public sigslot::has_
   }
 
   void DisableComponent(size_t stream, int component_id) {
     ASSERT_LT(stream, streams_.size());
     nsresult res = streams_[stream]->DisableComponent(component_id);
     ASSERT_TRUE(NS_SUCCEEDED(res));
   }
 
-  int trickled() { return trickled_; }
-
  private:
   std::string name_;
   nsRefPtr<NrIceCtx> ice_ctx_;
   std::vector<mozilla::RefPtr<NrIceMediaStream> > streams_;
   std::map<std::string, std::vector<std::string> > candidates_;
   bool gathering_complete_;
   int ready_ct_;
   bool ice_complete_;
   size_t received_;
   size_t sent_;
   NrIceResolverFake fake_resolver_;
   nsRefPtr<NrIceResolver> dns_resolver_;
   IceTestPeer *remote_;
   CandidateFilter candidate_filter_;
   NrIceCandidate::Type expected_local_type_;
   NrIceCandidate::Type expected_remote_type_;
-  TrickleMode trickle_mode_;
-  int trickled_;
 };
 
 class IceGatherTest : public ::testing::Test {
  public:
   void SetUp() {
     test_utils->sts_target()->Dispatch(WrapRunnable(TestStunServer::GetInstance(),
                                                     &TestStunServer::Reset),
                                        NS_DISPATCH_SYNC);
     peer_ = new IceTestPeer("P1", true, false);
     peer_->AddStream(1);
   }
 
-  void Gather(bool wait = true) {
-     peer_->Gather();
+  void Gather() {
+    peer_->Gather();
 
-    if (wait) {
-      WaitForGather();
-    }
-  }
-
-  void WaitForGather() {
     ASSERT_TRUE_WAIT(peer_->gathering_complete(), 10000);
   }
 
   void UseFakeStunServerWithResponse(const std::string& fake_addr,
                                      uint16_t fake_port) {
     TestStunServer::GetInstance()->SetResponseAddr(fake_addr, fake_port);
     // Sets an additional stun server
     peer_->SetStunServer(TestStunServer::GetInstance()->addr(),
@@ -713,29 +650,28 @@ class IceConnectTest : public ::testing:
       p1_ = new IceTestPeer("P1", true, set_priorities);
       p2_ = new IceTestPeer("P2", false, set_priorities);
     }
     initted_ = true;
   }
 
   bool Gather(bool wait) {
     Init(false);
-    p1_->SetStunServer(g_stun_server_address, kDefaultStunServerPort);
-    p2_->SetStunServer(g_stun_server_address, kDefaultStunServerPort);
+    p1_->SetStunServer(kDefaultStunServerAddress, kDefaultStunServerPort);
+    p2_->SetStunServer(kDefaultStunServerAddress, kDefaultStunServerPort);
     p1_->Gather();
     p2_->Gather();
 
-    if (wait) {
-      EXPECT_TRUE_WAIT(p1_->gathering_complete(), 10000);
-      if (!p1_->gathering_complete())
-        return false;
-      EXPECT_TRUE_WAIT(p2_->gathering_complete(), 10000);
-      if (!p2_->gathering_complete())
-        return false;
-    }
+    EXPECT_TRUE_WAIT(p1_->gathering_complete(), 10000);
+    if (!p1_->gathering_complete())
+      return false;
+    EXPECT_TRUE_WAIT(p2_->gathering_complete(), 10000);
+    if (!p2_->gathering_complete())
+      return false;
+
     return true;
   }
 
   void SetTurnServer(const std::string addr, uint16_t port,
                      const std::string username,
                      const std::string password) {
     p1_->SetTurnServer(addr, port, username, password);
     p2_->SetTurnServer(addr, port, username, password);
@@ -779,39 +715,34 @@ class IceConnectTest : public ::testing:
   }
 
   void WaitForComplete(int expected_streams = 1) {
     ASSERT_TRUE_WAIT(p1_->ready_ct() == expected_streams &&
                      p2_->ready_ct() == expected_streams, 5000);
     ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(), 5000);
   }
 
-  void WaitForGather() {
-    ASSERT_TRUE_WAIT(p1_->gathering_complete(), 10000);
-    ASSERT_TRUE_WAIT(p2_->gathering_complete(), 10000);
+  void ConnectTrickle() {
+    p1_->Connect(p2_, TRICKLE_DEFERRED);
+    p2_->Connect(p1_, TRICKLE_DEFERRED);
   }
 
-  void ConnectTrickle(TrickleMode trickle = TRICKLE_SIMULATE) {
-    p1_->Connect(p2_, trickle);
-    p2_->Connect(p1_, trickle);
-  }
-
-  void SimulateTrickle(size_t stream) {
-    p1_->SimulateTrickle(stream);
-    p2_->SimulateTrickle(stream);
+  void DoTrickle(size_t stream) {
+    p1_->DoTrickle(stream);
+    p2_->DoTrickle(stream);
     ASSERT_TRUE_WAIT(p1_->is_ready(stream), 5000);
     ASSERT_TRUE_WAIT(p2_->is_ready(stream), 5000);
   }
 
-  void SimulateTrickleP1(size_t stream) {
-    p1_->SimulateTrickle(stream);
+  void DoTrickleP1(size_t stream) {
+    p1_->DoTrickle(stream);
   }
 
-  void SimulateTrickleP2(size_t stream) {
-    p2_->SimulateTrickle(stream);
+  void DoTrickleP2(size_t stream) {
+    p2_->DoTrickle(stream);
   }
 
   void VerifyConnected() {
   }
 
   void CloseP1() {
     p1_->Close();
   }
@@ -892,47 +823,47 @@ class PrioritizerTest : public ::testing
 
  private:
   nr_interface_prioritizer *prioritizer_;
 };
 
 }  // end namespace
 
 TEST_F(IceGatherTest, TestGatherFakeStunServerHostnameNoResolver) {
-  peer_->SetStunServer(g_stun_server_hostname, kDefaultStunServerPort);
+  peer_->SetStunServer(kDefaultStunServerHostname, kDefaultStunServerPort);
   Gather();
 }
 
 TEST_F(IceGatherTest, TestGatherFakeStunServerIpAddress) {
-  peer_->SetStunServer(g_stun_server_address, kDefaultStunServerPort);
+  peer_->SetStunServer(kDefaultStunServerAddress, kDefaultStunServerPort);
   peer_->SetFakeResolver();
   Gather();
 }
 
 TEST_F(IceGatherTest, TestGatherFakeStunServerHostname) {
-  peer_->SetStunServer(g_stun_server_hostname, kDefaultStunServerPort);
+  peer_->SetStunServer(kDefaultStunServerHostname, kDefaultStunServerPort);
   peer_->SetFakeResolver();
   Gather();
 }
 
 TEST_F(IceGatherTest, TestGatherFakeStunBogusHostname) {
   peer_->SetStunServer(kBogusStunServerHostname, kDefaultStunServerPort);
   peer_->SetFakeResolver();
   Gather();
 }
 
 TEST_F(IceGatherTest, TestGatherDNSStunServerIpAddress) {
-  peer_->SetStunServer(g_stun_server_address, kDefaultStunServerPort);
+  peer_->SetStunServer(kDefaultStunServerAddress, kDefaultStunServerPort);
   peer_->SetDNSResolver();
   Gather();
   // TODO(jib@mozilla.com): ensure we get server reflexive candidates Bug 848094
 }
 
 TEST_F(IceGatherTest, TestGatherDNSStunServerHostname) {
-  peer_->SetStunServer(g_stun_server_hostname, kDefaultStunServerPort);
+  peer_->SetStunServer(kDefaultStunServerHostname, kDefaultStunServerPort);
   peer_->SetDNSResolver();
   Gather();
 }
 
 TEST_F(IceGatherTest, TestGatherDNSStunBogusHostname) {
   peer_->SetStunServer(kBogusStunServerHostname, kDefaultStunServerPort);
   peer_->SetDNSResolver();
   Gather();
@@ -987,26 +918,16 @@ TEST_F(IceGatherTest, TestStunServerRetu
 }
 
 TEST_F(IceGatherTest, TestStunServerReturnsLoopbackAddr) {
   UseFakeStunServerWithResponse("127.0.0.133", 3333);
   Gather();
   ASSERT_FALSE(StreamHasMatchingCandidate(0, " 127.0.0.133 "));
 }
 
-TEST_F(IceGatherTest, TestStunServerTrickle) {
-  UseFakeStunServerWithResponse("192.0.2.1", 3333);
-  TestStunServer::GetInstance()->SetActive(false);
-  Gather(false);
-  ASSERT_FALSE(StreamHasMatchingCandidate(0, "192.0.2.1"));
-  TestStunServer::GetInstance()->SetActive(true);
-  WaitForGather();
-  ASSERT_TRUE(StreamHasMatchingCandidate(0, "192.0.2.1"));
-}
-
 TEST_F(IceConnectTest, TestGather) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather(true));
 }
 
 TEST_F(IceConnectTest, TestGatherAutoPrioritize) {
   Init(false);
   AddStream("first", 1);
@@ -1044,72 +965,63 @@ TEST_F(IceConnectTest, TestConnectP2Then
   WaitForComplete();
 }
 
 TEST_F(IceConnectTest, TestConnectP2ThenP1Trickle) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather(true));
   ConnectP2();
   PR_Sleep(1000);
-  ConnectP1(TRICKLE_SIMULATE);
-  SimulateTrickleP1(0);
+  ConnectP1(TRICKLE_DEFERRED);
+  DoTrickleP1(0);
   WaitForComplete();
 }
 
 TEST_F(IceConnectTest, TestConnectP2ThenP1TrickleTwoComponents) {
   AddStream("first", 1);
   AddStream("second", 2);
   ASSERT_TRUE(Gather(true));
   ConnectP2();
   PR_Sleep(1000);
-  ConnectP1(TRICKLE_SIMULATE);
-  SimulateTrickleP1(0);
+  ConnectP1(TRICKLE_DEFERRED);
+  DoTrickleP1(0);
   std::cerr << "Sleeping between trickle streams" << std::endl;
   PR_Sleep(1000);  // Give this some time to settle but not complete
                    // all of ICE.
-  SimulateTrickleP1(1);
+  DoTrickleP1(1);
   WaitForComplete(2);
 }
 
 TEST_F(IceConnectTest, TestConnectAutoPrioritize) {
   Init(false);
   AddStream("first", 1);
   ASSERT_TRUE(Gather(true));
   Connect();
 }
 
 TEST_F(IceConnectTest, TestConnectTrickleOneStreamOneComponent) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather(true));
   ConnectTrickle();
-  SimulateTrickle(0);
+  DoTrickle(0);
   ASSERT_TRUE_WAIT(p1_->ice_complete(), 1000);
   ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000);
 }
 
 TEST_F(IceConnectTest, TestConnectTrickleTwoStreamsOneComponent) {
   AddStream("first", 1);
   AddStream("second", 1);
   ASSERT_TRUE(Gather(true));
   ConnectTrickle();
-  SimulateTrickle(0);
-  SimulateTrickle(1);
+  DoTrickle(0);
+  DoTrickle(1);
   ASSERT_TRUE_WAIT(p1_->ice_complete(), 1000);
   ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000);
 }
 
-TEST_F(IceConnectTest, TestConnectRealTrickleOneStreamOneComponent) {
-  AddStream("first", 1);
-  AddStream("second", 1);
-  ASSERT_TRUE(Gather(false));
-  ConnectTrickle(TRICKLE_REAL);
-  ASSERT_TRUE_WAIT(p1_->ice_complete(), 5000);
-  ASSERT_TRUE_WAIT(p2_->ice_complete(), 5000);
-  WaitForGather();  // ICE can complete before we finish gathering.
-}
 
 TEST_F(IceConnectTest, TestSendReceive) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather(true));
   Connect();
   SendReceive();
 }
 
@@ -1278,25 +1190,16 @@ int main(int argc, char **argv)
       g_turn_user.empty(),
       g_turn_password.empty()) {
     printf(
         "Set TURN_SERVER_ADDRESS, TURN_SERVER_USER, and TURN_SERVER_PASSWORD\n"
         "environment variables to run this test\n");
     g_turn_server="";
   }
 
-  std::string tmp = get_environment("STUN_SERVER_ADDRESS");
-  if (tmp != "")
-    g_stun_server_address = tmp;
-
-
-  tmp = get_environment("STUN_SERVER_HOSTNAME");
-  if (tmp != "")
-    g_stun_server_hostname = tmp;
-
   test_utils = new MtransportTestUtils();
   NSS_NoDB_Init(nullptr);
   NSS_SetDomesticPolicy();
 
   // Start the tests
   ::testing::InitGoogleTest(&argc, argv);
 
   test_utils->sts_target()->Dispatch(
--- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c
@@ -411,18 +411,18 @@ int nr_ice_candidate_compute_priority(nr
   abort:
     return(_status);
   }
 
 static void nr_ice_candidate_fire_ready_cb(NR_SOCKET s, int how, void *cb_arg)
   {
     nr_ice_candidate *cand = cb_arg;
 
+    cand->ready_cb(0, 0, cand->ready_cb_arg);
     cand->ready_cb_timer = 0;
-    cand->ready_cb(0, 0, cand->ready_cb_arg);
   }
 
 int nr_ice_candidate_initialize(nr_ice_candidate *cand, NR_async_cb ready_cb, void *cb_arg)
   {
     int r,_status;
     int protocol=NR_RESOLVE_PROTOCOL_STUN;
     cand->done_cb=ready_cb;
     cand->cb_arg=cb_arg;
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -244,17 +244,17 @@ int nr_ice_component_initialize(struct n
 
         /* srvrflx */
         if(r=nr_ice_candidate_create(ctx,component,
           isock,sock,SERVER_REFLEXIVE,
           &ctx->turn_servers[j].turn_server,component->component_id,&cand))
           ABORT(r);
         cand->state=NR_ICE_CAND_STATE_INITIALIZING; /* Don't start */
         cand->done_cb=nr_ice_initialize_finished_cb;
-        cand->cb_arg=cand;
+        cand->cb_arg=ctx;
 
         TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
         component->candidate_ct++;
         srvflx_cand=cand;
 
         /* relayed*/
         if(r=nr_socket_turn_create(sock, &turn_sock))
           ABORT(r);
@@ -310,89 +310,99 @@ int nr_ice_component_initialize(struct n
       ctx->uninitialized_candidates++;
       cand=TAILQ_NEXT(cand,entry_comp);
     }
 
     /* Now initialize all the candidates */
     cand=TAILQ_FIRST(&component->candidates);
     while(cand){
       if(cand->state!=NR_ICE_CAND_STATE_INITIALIZING){
-        if(r=nr_ice_candidate_initialize(cand,nr_ice_initialize_finished_cb,cand)){
+        if(r=nr_ice_candidate_initialize(cand,nr_ice_initialize_finished_cb,ctx)){
           if(r!=R_WOULDBLOCK){
             ctx->uninitialized_candidates--;
             cand->state=NR_ICE_CAND_STATE_FAILED;
           }
         }
       }
       cand=TAILQ_NEXT(cand,entry_comp);
     }
 
     _status=0;
   abort:
     return(_status);
   }
 
-/*
-  Compare this newly initialized candidate against the other initialized
-  candidates and discard the lower-priority one if they are redundant.
+/* Prune redundant candidates. We use an n^2 algorithm for now.
 
    This algorithm combined with the other algorithms, favors
    host > srflx > relay
 
    This actually won't prune relayed in the very rare
    case that relayed is the same. Not relevant in practice.
- */
-int nr_ice_component_maybe_prune_candidate(nr_ice_ctx *ctx, nr_ice_component *comp, nr_ice_candidate *c1, int *was_pruned)
+*/
+
+int nr_ice_component_prune_candidates(nr_ice_ctx *ctx, nr_ice_component *comp)
   {
-    nr_ice_candidate *c2, *tmp = NULL;
+    nr_ice_candidate *c1,*c1n,*c2;
 
-    *was_pruned = 0;
-    c2 = TAILQ_FIRST(&comp->candidates);
-    while(c2){
-      if((c1 != c2) &&
-         (c2->state == NR_ICE_CAND_STATE_INITIALIZED) &&
-         !nr_transport_addr_cmp(&c1->base,&c2->base,NR_TRANSPORT_ADDR_CMP_MODE_ALL) &&
-         !nr_transport_addr_cmp(&c1->addr,&c2->addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)){
+    c1=TAILQ_FIRST(&comp->candidates);
+    while(c1){
+      c1n=TAILQ_NEXT(c1,entry_comp);
+      if(c1->state!=NR_ICE_CAND_STATE_INITIALIZED){
+        r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): Removing non-initialized candidate %s",
+          ctx->label,c1->label);
+        if (c1->state == NR_ICE_CAND_STATE_INITIALIZING) {
+          r_log(LOG_ICE,LOG_NOTICE, "ICE(%s): Removing candidate %s which is in INITIALIZING state",
+            ctx->label, c1->label);
+        }
+        TAILQ_REMOVE(&comp->candidates,c1,entry_comp);
+        comp->candidate_ct--;
+        TAILQ_REMOVE(&c1->isock->candidates,c1,entry_sock);
+        /* schedule this delete for later as we don't want to delete the underlying
+         * objects while in the middle of a callback on one of those objects */
+        NR_ASYNC_SCHEDULE(nr_ice_candidate_destroy_cb,c1);
+        goto next_c1;
+      }
+
+      c2=TAILQ_NEXT(c1,entry_comp);
 
-        if((c1->type == c2->type) ||
-           (c1->type==HOST && c2->type == SERVER_REFLEXIVE) ||
-           (c2->type==HOST && c1->type == SERVER_REFLEXIVE)){
+      while(c2){
+        nr_ice_candidate *tmp;
 
-          /*
-             These are redundant. Remove the lower pri one.
+        if(!nr_transport_addr_cmp(&c1->base,&c2->base,NR_TRANSPORT_ADDR_CMP_MODE_ALL) && !nr_transport_addr_cmp(&c1->addr,&c2->addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)){
+
+          if((c1->type == c2->type) ||
+            (c1->type==HOST && c2->type == SERVER_REFLEXIVE) ||
+            (c2->type==HOST && c1->type == SERVER_REFLEXIVE)){
 
-             Since this algorithmis run whenever a new candidate
-             is initialized, there should at most one duplicate.
-           */
-          if (c1->priority < c2->priority) {
-            tmp = c1;
-            *was_pruned = 1;
+            /* OK these are redundant. Remove the lower pri one */
+            tmp=c2;
+            c2=TAILQ_NEXT(c2,entry_comp);
+            if(c1n==tmp)
+              c1n=c2;
+
+            r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): Removing redundant candidate %s",
+              ctx->label,tmp->label);
+
+            TAILQ_REMOVE(&comp->candidates,tmp,entry_comp);
+            comp->candidate_ct--;
+            TAILQ_REMOVE(&tmp->isock->candidates,tmp,entry_sock);
+
+            nr_ice_candidate_destroy(&tmp);
           }
-          else {
-            tmp = c2;
-          }
-          break;
+        }
+        else{
+          c2=TAILQ_NEXT(c2,entry_comp);
         }
       }
-
-      c2=TAILQ_NEXT(c2,entry_comp);
+    next_c1:
+      c1=c1n;
     }
 
-    if (tmp) {
-      r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): Removing redundant candidate %s",
-            ctx->label,tmp->label);
-
-      TAILQ_REMOVE(&comp->candidates,tmp,entry_comp);
-      comp->candidate_ct--;
-      TAILQ_REMOVE(&tmp->isock->candidates,tmp,entry_sock);
-
-      nr_ice_candidate_destroy(&tmp);
-    }
-
-    return 0;
+    return(0);
   }
 
 /* Section 7.2.1 */
 static int nr_ice_component_process_incoming_check(nr_ice_component *comp, nr_transport_addr *local_addr, nr_stun_server_request *req, int *error)
   {
     nr_ice_cand_pair *pair;
     nr_ice_candidate *pcand=0;
     nr_stun_message *sreq=req->request;
@@ -637,95 +647,84 @@ int nr_ice_component_service_pre_answer_
       }
     }
 
     _status=0;
  abort:
     return(_status);
   }
 
-int nr_ice_component_pair_candidate(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, nr_ice_candidate *lcand, int pair_all_remote)
+int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp,nr_ice_component *pcomp)
   {
-    int r, _status;
-    nr_ice_candidate *pcand;
+    nr_ice_candidate *lcand,*pcand;
     nr_ice_cand_pair *pair=0;
+    nr_ice_socket *isock;
+    int r,_status;
     char codeword[5];
 
-    nr_ice_compute_codeword(lcand->label,strlen(lcand->label),codeword);
-    r_log(LOG_ICE,LOG_DEBUG,"Pairing local candidate %s:%s",codeword,lcand->label);
-
-    switch(lcand->type){
-      case HOST:
-        break;
-      case SERVER_REFLEXIVE:
-      case PEER_REFLEXIVE:
-        /* Don't actually pair these candidates */
-        goto done;
-        break;
-      case RELAYED:
-        break;
-      default:
-        assert(0);
-        ABORT(R_INTERNAL);
-        break;
-    }
-
-    pcand=TAILQ_FIRST(&pcomp->candidates);
-    while(pcand){
-      /*
-        Two modes, depending on |pair_all_remote|
-
-        1. Pair remote candidates which have not been paired
-           (used in initial pairing or in processing the other side's
-           trickle candidates).
-        2. Pair any remote candidate (used when processing our own
-           trickle candidates).
-      */
-      if (pair_all_remote || (pcand->state == NR_ICE_CAND_PEER_CANDIDATE_UNPAIRED)) {
-        /* If we are pairing our own trickle candidates, the remote candidate should
-           all be paired */
-        if (pair_all_remote)
-          assert (pcand->state == NR_ICE_CAND_PEER_CANDIDATE_PAIRED);
-
-        nr_ice_compute_codeword(pcand->label,strlen(pcand->label),codeword);
-        r_log(LOG_ICE,LOG_DEBUG,"Pairing with peer candidate %s:%s",codeword,pcand->label);
-
-        if(r=nr_ice_candidate_pair_create(pctx,lcand,pcand,&pair))
-          ABORT(r);
-
-        if(r=nr_ice_candidate_pair_insert(&pcomp->stream->check_list,
-                                          pair))
-          ABORT(r);
-      }
-
-      pcand=TAILQ_NEXT(pcand,entry_comp);
-    }
-
-   done:
-    _status = 0;
-   abort:
-    return(_status);
-  }
-
-int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp,nr_ice_component *pcomp)
-  {
-    nr_ice_candidate *lcand, *pcand;
-    nr_ice_socket *isock;
-    int r,_status;
-
     r_log(LOG_ICE,LOG_DEBUG,"Pairing candidates======");
-
     /* Create the candidate pairs */
     lcand=TAILQ_FIRST(&lcomp->candidates);
     while(lcand){
-      if (lcand->state == NR_ICE_CAND_STATE_INITIALIZED) {
-        if ((r = nr_ice_component_pair_candidate(pctx, pcomp, lcand, 0)))
-          ABORT(r);
+      int was_paired = 0;
+
+      nr_ice_compute_codeword(lcand->label,strlen(lcand->label),codeword);
+      r_log(LOG_ICE,LOG_DEBUG,"Examining local candidate %s:%s",codeword,lcand->label);
+
+      switch(lcand->type){
+        case HOST:
+          break;
+        case SERVER_REFLEXIVE:
+        case PEER_REFLEXIVE:
+          /* Don't actually pair these candidates */
+          goto next_cand;
+          break;
+        case RELAYED:
+          break;
+        default:
+          assert(0);
+          ABORT(R_INTERNAL);
+          break;
       }
 
+      /* PAIR with each peer*/
+      if(TAILQ_EMPTY(&pcomp->candidates)) {
+          /* can happen if our peer proposes no (or all bogus) candidates */
+          goto next_cand;
+      }
+      pcand=TAILQ_FIRST(&pcomp->candidates);
+      while(pcand){
+        /* Only pair peer candidates which have not yet been paired.
+           This allows "trickle ICE". (Not yet standardized, but
+           part of WebRTC).
+
+           TODO(ekr@rtfm.com): Add refernece to the spec when there
+           is one.
+         */
+        if (pcand->state == NR_ICE_CAND_PEER_CANDIDATE_UNPAIRED) {
+          nr_ice_compute_codeword(pcand->label,strlen(pcand->label),codeword);
+          r_log(LOG_ICE,LOG_DEBUG,"Examining peer candidate %s:%s",codeword,pcand->label);
+
+          if(r=nr_ice_candidate_pair_create(pctx,lcand,pcand,&pair))
+            ABORT(r);
+
+          if(r=nr_ice_candidate_pair_insert(&pcomp->stream->check_list,
+              pair))
+            ABORT(r);
+        }
+        else {
+          was_paired = 1;
+        }
+        pcand=TAILQ_NEXT(pcand,entry_comp);
+      }
+
+      if(!pair)
+        goto next_cand;
+
+    next_cand:
       lcand=TAILQ_NEXT(lcand,entry_comp);
     }
 
     /* Mark all peer candidates as paired */
     pcand=TAILQ_FIRST(&pcomp->candidates);
     while(pcand){
       pcand->state = NR_ICE_CAND_PEER_CANDIDATE_PAIRED;
 
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.h
@@ -77,19 +77,18 @@ struct nr_ice_component_ {
   STAILQ_ENTRY(nr_ice_component_)entry;
 };
 
 typedef STAILQ_HEAD(nr_ice_component_head_,nr_ice_component_) nr_ice_component_head;
 
 int nr_ice_component_create(struct nr_ice_media_stream_ *stream, int component_id, nr_ice_component **componentp);
 int nr_ice_component_destroy(nr_ice_component **componentp);
 int nr_ice_component_initialize(struct nr_ice_ctx_ *ctx,nr_ice_component *component);
-int nr_ice_component_maybe_prune_candidate(nr_ice_ctx *ctx, nr_ice_component *comp, nr_ice_candidate *c1, int *was_pruned);
-int nr_ice_component_pair_candidate(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, nr_ice_candidate *lcand, int pair_all_remote);
-int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp, nr_ice_component *pcomp);
+int nr_ice_component_prune_candidates(nr_ice_ctx *ctx, nr_ice_component *comp);
+int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lcomp,nr_ice_component *pcomp);
 int nr_ice_component_service_pre_answer_requests(nr_ice_peer_ctx *pctx, nr_ice_component *pcomp, char *username, int *serviced);
 int nr_ice_component_nominated_pair(nr_ice_component *comp, nr_ice_cand_pair *pair);
 int nr_ice_component_failed_pair(nr_ice_component *comp, nr_ice_cand_pair *pair);
 int nr_ice_component_select_pair(nr_ice_peer_ctx *pctx, nr_ice_component *comp);
 int nr_ice_component_set_failed(nr_ice_component *comp);
 int nr_ice_component_finalize(nr_ice_component *lcomp, nr_ice_component *rcomp);
 
 #ifdef __cplusplus
--- a/media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_ctx.c
@@ -59,17 +59,16 @@ static char *RCSSTRING __UNUSED__="$Id: 
 int LOG_ICE = 0;
 
 static int nr_ice_random_string(char *str, int len);
 static int nr_ice_fetch_stun_servers(int ct, nr_ice_stun_server **out);
 #ifdef USE_TURN
 static int nr_ice_fetch_turn_servers(int ct, nr_ice_turn_server **out);
 #endif /* USE_TURN */
 static void nr_ice_ctx_destroy_cb(NR_SOCKET s, int how, void *cb_arg);
-static int nr_ice_ctx_pair_new_trickle_candidates(nr_ice_ctx *ctx, nr_ice_candidate *cand);
 
 int nr_ice_fetch_stun_servers(int ct, nr_ice_stun_server **out)
   {
     int r,_status;
     nr_ice_stun_server *servers = 0;
     int i;
     NR_registry child;
     char *addr=0;
@@ -427,96 +426,48 @@ static void nr_ice_ctx_destroy_cb(NR_SOC
   }
 
 int nr_ice_ctx_destroy(nr_ice_ctx **ctxp)
   {
     if(!ctxp || !*ctxp)
       return(0);
 
     (*ctxp)->done_cb=0;
-    (*ctxp)->trickle_cb=0;
 
     NR_ASYNC_SCHEDULE(nr_ice_ctx_destroy_cb,*ctxp);
 
     *ctxp=0;
 
     return(0);
   }
 
 void nr_ice_initialize_finished_cb(NR_SOCKET s, int h, void *cb_arg)
   {
-    int r,_status;
-    nr_ice_candidate *cand=cb_arg;
-    nr_ice_ctx *ctx;
-
-
-    assert(cb_arg);
-    if (!cb_arg)
-      return;
-    ctx = cand->ctx;
-
-    ctx->uninitialized_candidates--;
-
-    if (cand->state == NR_ICE_CAND_STATE_INITIALIZED) {
-      int was_pruned = 0;
+    nr_ice_ctx *ctx=cb_arg;
 
-      if (r=nr_ice_component_maybe_prune_candidate(ctx, cand->component,
-                                                   cand, &was_pruned)) {
-          r_log(LOG_ICE, LOG_NOTICE, "ICE(%s): Problem pruning candidates",ctx->label);
-      }
-
-      /* If we are initialized, the candidate wasn't pruned,
-         and we have a trickle ICE callback fire the callback */
-      if (ctx->trickle_cb && !was_pruned) {
-        ctx->trickle_cb(ctx->trickle_cb_arg, ctx, cand->stream, cand->component_id, cand);
-
-        if (r==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 */
-        }
-      }
-    }
+/*    r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): Candidate %s %s",ctx->label,
+      cand->label, cand->state==NR_ICE_CAND_STATE_INITIALIZED?"INITIALIZED":"FAILED");
+*/
+    ctx->uninitialized_candidates--;
 
     if(ctx->uninitialized_candidates==0){
       r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): All candidates initialized",ctx->label);
       ctx->state=NR_ICE_STATE_INITIALIZED;
       if (ctx->done_cb) {
         ctx->done_cb(0,0,ctx->cb_arg);
       }
       else {
         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)
-  {
-    int r,_status;
-    nr_ice_peer_ctx *pctx;
-
-    pctx=STAILQ_FIRST(&ctx->peers);
-    while(pctx){
-      if (pctx->state == NR_ICE_PEER_STATE_PAIRED) {
-        r = nr_ice_peer_ctx_pair_new_trickle_candidate(ctx, pctx, cand);
-        if (r)
-          ABORT(r);
-      }
-
-      pctx=STAILQ_NEXT(pctx,entry);
-    }
-
-    _status=0;
- abort:
-    return(_status);
-  }
-
-
 #define MAXADDRS 100 // Ridiculously high
 int nr_ice_initialize(nr_ice_ctx *ctx, NR_async_cb done_cb, void *cb_arg)
   {
     int r,_status;
     nr_ice_media_stream *stream;
     nr_local_addr addrs[MAXADDRS];
     int i,addr_ct;
 
@@ -733,16 +684,8 @@ int nr_ice_ctx_finalize(nr_ice_ctx *ctx,
       nr_ice_media_stream_finalize(lstr,rstr);
 
       lstr=STAILQ_NEXT(lstr,entry);
     }
 
     return(0);
   }
 
-
-int nr_ice_ctx_set_trickle_cb(nr_ice_ctx *ctx, nr_ice_trickle_candidate_cb cb, void *cb_arg)
-{
-  ctx->trickle_cb = cb;
-  ctx->trickle_cb_arg = cb_arg;
-
-  return 0;
-}
--- a/media/mtransport/third_party/nICEr/src/ice/ice_ctx.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_ctx.h
@@ -84,19 +84,16 @@ typedef STAILQ_HEAD(nr_ice_foundation_he
 typedef TAILQ_HEAD(nr_ice_candidate_head_,nr_ice_candidate_) nr_ice_candidate_head;
 typedef TAILQ_HEAD(nr_ice_cand_pair_head_,nr_ice_cand_pair_) nr_ice_cand_pair_head;
 typedef struct nr_ice_component_ nr_ice_component;
 typedef struct nr_ice_media_stream_ nr_ice_media_stream;
 typedef struct nr_ice_ctx_ nr_ice_ctx;
 typedef struct nr_ice_peer_ctx_ nr_ice_peer_ctx;
 typedef struct nr_ice_candidate_ nr_ice_candidate;
 typedef struct nr_ice_cand_pair_ nr_ice_cand_pair;
-typedef void (*nr_ice_trickle_candidate_cb) (void *cb_arg,
-  nr_ice_ctx *ctx, nr_ice_media_stream *stream, int component_id,
-  nr_ice_candidate *candidate);
 
 #include "ice_socket.h"
 #include "ice_component.h"
 #include "ice_media_stream.h"
 #include "ice_candidate.h"
 #include "ice_candidate_pair.h"
 #include "ice_handler.h"
 #include "ice_peer_ctx.h"
@@ -142,19 +139,16 @@ struct nr_ice_ctx_ {
   UINT4 gather_rto;
   UINT4 stun_delay;
 
   nr_ice_peer_ctx_head peers;
   nr_ice_stun_id_head ids;
 
   NR_async_cb done_cb;
   void *cb_arg;
-
-  nr_ice_trickle_candidate_cb trickle_cb;
-  void *trickle_cb_arg;
 };
 
 int nr_ice_ctx_create(char *label, UINT4 flags, nr_ice_ctx **ctxp);
 #define NR_ICE_CTX_FLAGS_OFFERER                           1
 #define NR_ICE_CTX_FLAGS_ANSWERER                          (1<<1)
 #define NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION             (1<<2)
 #define NR_ICE_CTX_FLAGS_LITE                              (1<<3)
 
@@ -167,19 +161,16 @@ int nr_ice_get_global_attributes(nr_ice_
 int nr_ice_ctx_deliver_packet(nr_ice_ctx *ctx, nr_ice_component *comp, nr_transport_addr *source_addr, UCHAR *data, int len);
 int nr_ice_ctx_is_known_id(nr_ice_ctx *ctx, UCHAR id[12]);
 int nr_ice_ctx_remember_id(nr_ice_ctx *ctx, nr_stun_message *msg);
 int nr_ice_ctx_finalize(nr_ice_ctx *ctx, nr_ice_peer_ctx *pctx);
 int nr_ice_ctx_set_stun_servers(nr_ice_ctx *ctx,nr_ice_stun_server *servers, int ct);
 int nr_ice_ctx_set_turn_servers(nr_ice_ctx *ctx,nr_ice_turn_server *servers, int ct);
 int nr_ice_ctx_set_resolver(nr_ice_ctx *ctx, nr_resolver *resolver);
 int nr_ice_ctx_set_interface_prioritizer(nr_ice_ctx *ctx, nr_interface_prioritizer *prioritizer);
-int nr_ice_ctx_set_trickle_cb(nr_ice_ctx *ctx, nr_ice_trickle_candidate_cb cb, void *cb_arg);
-
-#define NR_ICE_MAX_ATTRIBUTE_SIZE 256
 
 extern int LOG_ICE;
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 #endif
 
--- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
@@ -135,74 +135,69 @@ int nr_ice_media_stream_initialize(nr_ic
       comp=STAILQ_NEXT(comp,entry);
     }
 
     _status=0;
   abort:
     return(_status);
   }
 
+#define MAX_ATTRIBUTE_SIZE 256
+
 int nr_ice_media_stream_get_attributes(nr_ice_media_stream *stream, char ***attrsp, int *attrctp)
   {
     int attrct=0;
     nr_ice_component *comp;
     char **attrs=0;
     int index=0;
-    nr_ice_candidate *cand;
     int r,_status;
 
     *attrctp=0;
 
     /* First find out how many attributes we need */
     comp=STAILQ_FIRST(&stream->components);
     while(comp){
       if (comp->state != NR_ICE_COMPONENT_DISABLED) {
-        cand = TAILQ_FIRST(&comp->candidates);
-        while(cand){
-          if (cand->state == NR_ICE_CAND_STATE_INITIALIZED) {
-            ++attrct;
-          }
+        if(r=nr_ice_component_prune_candidates(stream->ctx,comp))
+          ABORT(r);
 
-          cand = TAILQ_NEXT(cand, entry_comp);
-        }
+        attrct+=comp->candidate_ct;
       }
+
       comp=STAILQ_NEXT(comp,entry);
     }
 
     if(attrct < 1){
       r_log(LOG_ICE,LOG_WARNING,"ICE-STREAM(%s): Failed to find any components for stream",stream->label);
       ABORT(R_FAILED);
     }
 
     /* Make the array we'll need */
     if(!(attrs=RCALLOC(sizeof(char *)*attrct)))
       ABORT(R_NO_MEMORY);
     for(index=0;index<attrct;index++){
-      if(!(attrs[index]=RMALLOC(NR_ICE_MAX_ATTRIBUTE_SIZE)))
+      if(!(attrs[index]=RMALLOC(MAX_ATTRIBUTE_SIZE)))
         ABORT(R_NO_MEMORY);
     }
 
     index=0;
     /* Now format the attributes */
     comp=STAILQ_FIRST(&stream->components);
     while(comp){
       if (comp->state != NR_ICE_COMPONENT_DISABLED) {
         nr_ice_candidate *cand;
 
         cand=TAILQ_FIRST(&comp->candidates);
         while(cand){
-          if (cand->state == NR_ICE_CAND_STATE_INITIALIZED) {
-            assert(index < attrct);
-
+          assert(index < attrct);
 
-            if(r=nr_ice_format_candidate_attribute(cand, attrs[index],NR_ICE_MAX_ATTRIBUTE_SIZE))
-              ABORT(r);
+          if(r=nr_ice_format_candidate_attribute(cand, attrs[index],MAX_ATTRIBUTE_SIZE))
+            ABORT(r);
 
-            index++;
-          }
+          index++;
 
           cand=TAILQ_NEXT(cand,entry_comp);
         }
       }
       comp=STAILQ_NEXT(comp,entry);
     }
 
     *attrsp=attrs;
@@ -243,27 +238,25 @@ int nr_ice_media_stream_get_default_cand
 
     /* We have the component. Now find the "best" candidate, making
        use of the fact that more "reliable" candidate types have
        higher numbers. So, we sort by type and then priority within
        type
     */
     cand=TAILQ_FIRST(&comp->candidates);
     while(cand){
-      if (cand->state == NR_ICE_CAND_STATE_INITIALIZED) {
-        if (!best_cand) {
+      if (!best_cand) {
+        best_cand = cand;
+      }
+      else {
+        if (best_cand->type < cand->type) {
           best_cand = cand;
-        }
-        else {
-          if (best_cand->type < cand->type) {
+        } else if (best_cand->type == cand->type) {
+          if (best_cand->priority < cand->priority)
             best_cand = cand;
-          } else if (best_cand->type == cand->type) {
-            if (best_cand->priority < cand->priority)
-              best_cand = cand;
-          }
         }
       }
 
       cand=TAILQ_NEXT(cand,entry_comp);
     }
 
     /* No candidates */
     if (!best_cand)
@@ -813,31 +806,16 @@ int nr_ice_media_stream_finalize(nr_ice_
       if(rcomp){
         rcomp=STAILQ_NEXT(rcomp,entry);
       }
     }
 
     return(0);
   }
 
-int nr_ice_media_stream_pair_new_trickle_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_stream *pstream, nr_ice_candidate *cand)
-  {
-    int r,_status;
-    nr_ice_component *comp;
-
-    if ((r=nr_ice_media_stream_find_component(pstream, cand->component_id, &comp)))
-      ABORT(R_NOT_FOUND);
-
-    if (r=nr_ice_component_pair_candidate(pctx, comp, cand, 1))
-      ABORT(r);
-
-    _status=0;
- abort:
-    return(_status);
-  }
 
 int nr_ice_media_stream_disable_component(nr_ice_media_stream *stream, int component_id)
   {
     int r,_status;
     nr_ice_component *comp;
 
     if (stream->ice_state != NR_ICE_MEDIA_STREAM_UNPAIRED)
       ABORT(R_FAILED);
--- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.h
@@ -90,15 +90,15 @@ int nr_ice_media_stream_set_state(nr_ice
 int nr_ice_media_stream_get_best_candidate(nr_ice_media_stream *str, int component, nr_ice_candidate **candp);
 int nr_ice_media_stream_send(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, int component, UCHAR *data, int len);
 int nr_ice_media_stream_get_active(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, int component, nr_ice_candidate **local, nr_ice_candidate **remote);
 int nr_ice_media_stream_find_component(nr_ice_media_stream *str, int comp_id, nr_ice_component **compp);
 int nr_ice_media_stream_addrs(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, int component, nr_transport_addr *local, nr_transport_addr *remote);
 int
 nr_ice_peer_ctx_parse_media_stream_attribute(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream, char *attr);
 int nr_ice_media_stream_disable_component(nr_ice_media_stream *stream, int component_id);
-int nr_ice_media_stream_pair_new_trickle_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_stream *pstream, nr_ice_candidate *cand);
+
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 #endif
 
--- a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
@@ -51,18 +51,16 @@ static int nr_ice_ctx_parse_candidate(nr
 int nr_ice_peer_ctx_create(nr_ice_ctx *ctx, nr_ice_handler *handler,char *label, nr_ice_peer_ctx **pctxp)
   {
     int r,_status;
     nr_ice_peer_ctx *pctx=0;
 
     if(!(pctx=RCALLOC(sizeof(nr_ice_peer_ctx))))
       ABORT(R_NO_MEMORY);
 
-    pctx->state = NR_ICE_PEER_STATE_UNPAIRED;
-
     if(!(pctx->label=r_strdup(label)))
       ABORT(R_NO_MEMORY);
 
     pctx->ctx=ctx;
     pctx->handler=handler;
 
     /* Decide controlling vs. controlled */
     if(ctx->flags & NR_ICE_CTX_FLAGS_LITE){
@@ -254,24 +252,35 @@ int nr_ice_peer_ctx_find_pstream(nr_ice_
 
     _status=0;
  abort:
     return(_status);
   }
 
 int nr_ice_peer_ctx_parse_trickle_candidate(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream, char *candidate)
   {
+    /* First need to find the stream. Because we don't have forward pointers,
+       iterate through all the peer streams to find one that matches us */
     nr_ice_media_stream *pstream;
     int r,_status;
     int needs_pairing = 0;
 
     r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) parsing trickle ICE candidate %s",pctx->ctx->label,pctx->label,candidate);
-    r = nr_ice_peer_ctx_find_pstream(pctx, stream, &pstream);
-    if (r)
-      ABORT(r);
+
+    pstream=STAILQ_FIRST(&pctx->peer_streams);
+    while(pstream) {
+      if (pstream->local_stream == stream)
+        break;
+
+      pstream = STAILQ_NEXT(pstream, entry);
+    }
+    if (!pstream) {
+      r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) has no stream matching stream %s",pctx->ctx->label,pctx->label,stream->label);
+      ABORT(R_NOT_FOUND);
+    }
 
     switch(pstream->ice_state) {
       case NR_ICE_MEDIA_STREAM_UNPAIRED:
         break;
       case NR_ICE_MEDIA_STREAM_CHECKS_FROZEN:
       case NR_ICE_MEDIA_STREAM_CHECKS_ACTIVE:
         needs_pairing = 1;
         break;
@@ -340,46 +349,27 @@ int nr_ice_peer_ctx_pair_candidates(nr_i
     while(stream){
       if(r=nr_ice_media_stream_pair_candidates(pctx, stream->local_stream,
         stream))
         ABORT(r);
 
       stream=STAILQ_NEXT(stream,entry);
     }
 
-    pctx->state = NR_ICE_PEER_STATE_PAIRED;
-
     _status=0;
   abort:
     return(_status);
   }
 
-
-int nr_ice_peer_ctx_pair_new_trickle_candidate(nr_ice_ctx *ctx, nr_ice_peer_ctx *pctx, nr_ice_candidate *cand)
-  {
-    int r, _status;
-    nr_ice_media_stream *pstream;
-
-    r_log(LOG_ICE,LOG_ERR,"ICE(%s): peer (%s) pairing local trickle ICE candidate %s",pctx->ctx->label,pctx->label,cand->label);
-    if ((r = nr_ice_peer_ctx_find_pstream(pctx, cand->stream, &pstream)))
-      ABORT(r);
-
-    if ((r = nr_ice_media_stream_pair_new_trickle_candidate(pctx, pstream, cand)))
-      ABORT(r);
-
-    _status=0;
- abort:
-    return _status;
-  }
-
 int nr_ice_peer_ctx_disable_component(nr_ice_peer_ctx *pctx, nr_ice_media_stream *lstream, int component_id)
   {
     int r, _status;
     nr_ice_media_stream *pstream;
     nr_ice_component *component;
+    int j;
 
     if ((r=nr_ice_peer_ctx_find_pstream(pctx, lstream, &pstream)))
       ABORT(r);
 
     /* We shouldn't be calling this after we have started pairing */
     if (pstream->ice_state != NR_ICE_MEDIA_STREAM_UNPAIRED)
       ABORT(R_FAILED);
 
@@ -548,16 +538,17 @@ static void nr_ice_peer_ctx_fire_done(NR
     pctx->done_cb_timer=0;
 
     /* Fire the handler callback to say we're done */
     if (pctx->handler) {
       pctx->handler->vtbl->ice_completed(pctx->handler->obj, pctx);
     }
   }
 
+
 /* OK, a stream just went ready. Examine all the streams to see if we're
    maybe miraculously done */
 int nr_ice_peer_ctx_stream_done(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream)
   {
     int _status;
     nr_ice_media_stream *str;
     int failed=0;
     int succeeded=0;
--- a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.h
@@ -35,20 +35,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 #ifndef _ice_peer_ctx_h
 #define _ice_peer_ctx_h
 #ifdef __cplusplus
 using namespace std;
 extern "C" {
 #endif /* __cplusplus */
 
 struct nr_ice_peer_ctx_ {
-  int state;
-#define NR_ICE_PEER_STATE_UNPAIRED 1
-#define NR_ICE_PEER_STATE_PAIRED   2
-
   char *label;
   nr_ice_ctx *ctx;
   nr_ice_handler *handler;
 
   UCHAR controlling; /* 1 for controlling, 0 for controlled */
   UINT8 tiebreaker;
 
   char *peer_ufrag;
@@ -79,15 +75,14 @@ int nr_ice_peer_ctx_parse_global_attribu
 int nr_ice_peer_ctx_start_checks(nr_ice_peer_ctx *pctx);
 int nr_ice_peer_ctx_start_checks2(nr_ice_peer_ctx *pctx, int allow_non_first);
 int nr_ice_peer_ctx_dump_state(nr_ice_peer_ctx *pctx,FILE *out);
 int nr_ice_peer_ctx_log_state(nr_ice_peer_ctx *pctx);
 int nr_ice_peer_ctx_stream_done(nr_ice_peer_ctx *pctx, nr_ice_media_stream *stream);
 int nr_ice_peer_ctx_find_component(nr_ice_peer_ctx *pctx, nr_ice_media_stream *str, int component_id, nr_ice_component **compp);
 int nr_ice_peer_ctx_deliver_packet_maybe(nr_ice_peer_ctx *pctx, nr_ice_component *comp, nr_transport_addr *source_addr, UCHAR *data, int len);
 int nr_ice_peer_ctx_disable_component(nr_ice_peer_ctx *pctx, nr_ice_media_stream *lstream, int component_id);
-int nr_ice_peer_ctx_pair_new_trickle_candidate(nr_ice_ctx *ctx, nr_ice_peer_ctx *pctx, nr_ice_candidate *cand);
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 #endif
 
--- a/media/webrtc/signaling/include/CC_CallInfo.h
+++ b/media/webrtc/signaling/include/CC_CallInfo.h
@@ -357,15 +357,10 @@ namespace CSF
          */
         virtual MediaStreamTable* getMediaStreams() const = 0;
 
         /**
           Get the current operation's timecard (if any), and assume ownership
           of its memory.
          */
         virtual Timecard *takeTimecard() = 0;
-
-	/**
-          Get the latest candidate.
-	*/
-	virtual std::string getCandidate() = 0;
     };
 };
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -29,17 +29,16 @@
 #include <stdio.h>
 #include <ssl.h>
 #include <sslproto.h>
 #include <algorithm>
 
 extern "C" {
 #include "ccsdp.h"
 #include "vcm.h"
-#include "cc_call_feature.h"
 #include "cip_mmgr_mediadefinitions.h"
 #include "cip_Sipcc_CodecMask.h"
 
 extern void lsm_start_multipart_tone_timer (vcm_tones_t tone,
                                             uint32_t delay,
                                             cc_call_handle_t callId);
 extern void lsm_start_continuous_tone_timer (vcm_tones_t tone,
                                              uint32_t delay,
@@ -64,17 +63,16 @@ typedef enum {
 /* static */
 
 using namespace CSF;
 
 VcmSIPCCBinding * VcmSIPCCBinding::gSelf = NULL;
 int VcmSIPCCBinding::gAudioCodecMask = 0;
 int VcmSIPCCBinding::gVideoCodecMask = 0;
 nsIThread *VcmSIPCCBinding::gMainThread = NULL;
-nsIEventTarget *VcmSIPCCBinding::gSTSThread = NULL;
 
 static mozilla::RefPtr<TransportFlow> vcmCreateTransportFlow(
     sipcc::PeerConnectionImpl *pc,
     int level,
     bool rtcp,
     sdp_setup_type_e setup_type,
     const char *fingerprint_alg,
     const char *fingerprint);
@@ -99,64 +97,20 @@ static mozilla::RefPtr<TransportFlow> vc
 
 VcmSIPCCBinding::VcmSIPCCBinding ()
   : streamObserver(NULL)
 {
     delete gSelf;//delete is NULL safe, so I don't need to check if it's NULL
     gSelf = this;
 }
 
-class VcmIceOpaque : public NrIceOpaque {
- public:
-  VcmIceOpaque(cc_streamid_t stream_id,
-               cc_call_handle_t call_handle,
-               uint16_t level) :
-      stream_id_(stream_id),
-      call_handle_(call_handle),
-      level_(level) {}
-
-  virtual ~VcmIceOpaque() {}
-
-  cc_streamid_t stream_id_;
-  cc_call_handle_t call_handle_;
-  uint16_t level_;
-};
-
-
 VcmSIPCCBinding::~VcmSIPCCBinding ()
 {
     assert(gSelf);
     gSelf = NULL;
-    SyncRunnable::DispatchToThread(gSTSThread,
-                                   WrapRunnable(this,
-                                                &VcmSIPCCBinding::disconnect_all));
-    disconnect_all();
-}
-
-void VcmSIPCCBinding::CandidateReady(NrIceMediaStream* stream,
-                                     const std::string& candidate)
-{
-    // This is called on the STS thread
-    NrIceOpaque *opaque = stream->opaque();
-    MOZ_ASSERT(opaque);
-
-    VcmIceOpaque *vcm_opaque = static_cast<VcmIceOpaque *>(opaque);
-    CSFLogDebug(logTag, "Candidate ready on call %u, level %u",
-                vcm_opaque->call_handle_, vcm_opaque->level_);
-
-    char *candidate_tmp = (char *)malloc(candidate.size() + 1);
-    if (!candidate_tmp)
-	return;
-    sstrncpy(candidate_tmp, candidate.c_str(), candidate.size() + 1);
-    // Send a message to the GSM thread.
-    CC_CallFeature_FoundICECandidate(vcm_opaque->call_handle_,
-				     candidate_tmp,
-				     NULL,
-				     vcm_opaque->level_,
-				     NULL);
 }
 
 void VcmSIPCCBinding::setStreamObserver(StreamObserver* obs)
 {
 	streamObserver = obs;
 }
 
 /* static */
@@ -204,33 +158,21 @@ int VcmSIPCCBinding::getVideoCodecs()
   return VcmSIPCCBinding::gVideoCodecMask;
 }
 
 void VcmSIPCCBinding::setMainThread(nsIThread *thread)
 {
   gMainThread = thread;
 }
 
-void VcmSIPCCBinding::setSTSThread(nsIEventTarget *thread)
-{
-  gSTSThread = thread;
-}
-
 nsIThread* VcmSIPCCBinding::getMainThread()
 {
   return gMainThread;
 }
 
-void VcmSIPCCBinding::connectCandidateSignal(
-    NrIceMediaStream *stream)
-{
-  stream->SignalCandidate.connect(gSelf,
-                                  &VcmSIPCCBinding::CandidateReady);
-}
-
 /* static */
 AudioTermination * VcmSIPCCBinding::getAudioTermination()
 {
     // commenting as part of media provider removal
     return NULL;
 }
 
 /* static */
@@ -515,22 +457,16 @@ static short vcmRxAllocICE_m(cc_mcapid_t
   CSFLogDebug( logTag, "%s: Getting stream %d", __FUNCTION__, level);
   mozilla::RefPtr<NrIceMediaStream> stream = pc.impl()->media()->
     ice_media_stream(level-1);
   MOZ_ASSERT(stream);
   if (!stream) {
     return VCM_ERROR;
   }
 
-  // Set the opaque so we can correlate events.
-  stream->SetOpaque(new VcmIceOpaque(stream_id, call_handle, level));
-
-  // Attach ourself to the candidate signal.
-  VcmSIPCCBinding::connectCandidateSignal(stream);
-
   std::vector<std::string> candidates = stream->GetCandidates();
   CSFLogDebug( logTag, "%s: Got %lu candidates", __FUNCTION__, candidates.size());
 
   std::string default_addr;
   int default_port;
 
   nsresult res = stream->GetDefaultCandidate(1, &default_addr, &default_port);
   MOZ_ASSERT(NS_SUCCEEDED(res));
@@ -792,17 +728,16 @@ static short vcmSetIceCandidate_m(const 
   }
 
   // TODO(ekr@rtfm.com): generate an error if the parse
   // fails. Bug 847449.
 
   return 0;
 }
 
-
 /* Set ice candidate for trickle ICE.
  *
  * This is a thunk to vcmSetIceCandidate_m
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[in]  icecandidate - the icecandidate
  *  @param[in]  level - the m line level
  *
@@ -852,16 +787,17 @@ static short vcmStartIceChecks_m(const c
   if (!NS_SUCCEEDED(rv)) {
     CSFLogError( logTag, "%s(): Could not dispatch to ICE thread", __FUNCTION__);
     return VCM_ERROR;
   }
 
   return 0;
 }
 
+
 /* Start ICE checks
  *
  * This is a thunk to vcmStartIceChecks_m
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @return 0 success, error failure
  */
 short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling)
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.h
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.h
@@ -5,24 +5,17 @@
 #ifndef _CSF_VCM_SIPCC_BINDING_H_
 #define _CSF_VCM_SIPCC_BINDING_H_
 
 extern "C"
 {
 #include "ccapi_types.h"
 }
 
-#include "sigslot.h"
-
 class nsIThread;
-class nsIEventTarget;
-
-namespace mozilla {
-    class NrIceMediaStream;
-};
 
 namespace CSF
 {
     class AudioTermination;
     class VideoTermination;
     class AudioControl;
     class VideoControl;
     class MediaProvider;
@@ -31,22 +24,23 @@ namespace CSF
     class StreamObserver
     {
     public:
     	virtual void registerStream(cc_call_handle_t call, int streamId, bool isVideo) = 0;
     	virtual void deregisterStream(cc_call_handle_t call, int streamId) = 0;
     	virtual void dtmfBurst(int digit, int direction, int duration) = 0;
     	virtual void sendIFrame(cc_call_handle_t call) = 0;
     };
-    class VcmSIPCCBinding : public sigslot::has_slots<>
+    class VcmSIPCCBinding
     {
     public:
         VcmSIPCCBinding ();
         virtual ~VcmSIPCCBinding();
 
+
         // The getter is only for use by the vcm_* impl functions.
         void setStreamObserver(StreamObserver*);
         static StreamObserver* getStreamObserver();
 
         static AudioTermination * getAudioTermination();
         static VideoTermination * getVideoTermination();
 
         static AudioControl * getAudioControl();
@@ -59,29 +53,21 @@ namespace CSF
         static void setVideoCodecs(int codecMask);
 
         static int getAudioCodecs();
         static int getVideoCodecs();
 
 	static void setMainThread(nsIThread *thread);
 	static nsIThread *getMainThread();
 
-	static void setSTSThread(nsIEventTarget *thread);
-
-	static void connectCandidateSignal(mozilla::NrIceMediaStream* stream);
-
     private:
-	void CandidateReady(mozilla::NrIceMediaStream* stream,
-			    const std::string& candidate);
-
         static VcmSIPCCBinding * gSelf;
         StreamObserver* streamObserver;
         MediaProviderObserver *mediaProviderObserver;
         static int gAudioCodecMask;
         static int gVideoCodecMask;
 	static nsIThread *gMainThread;
-	static nsIEventTarget *gSTSThread;
     };
 }
 
 #endif
 
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -117,30 +117,27 @@ static void thread_ended_dispatcher(thre
     CSFLogError( logTag, "%s(): Could not dispatch to main thread", __FUNCTION__);
   }
 }
 
 static void join_waiter() {
   NS_ProcessPendingEvents(PeerConnectionCtx::gMainThread);
 }
 
-nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread,
-  nsIEventTarget* stsThread) {
+nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread) {
   if (!gMainThread) {
     gMainThread = mainThread;
     CSF::VcmSIPCCBinding::setMainThread(gMainThread);
     init_thread_monitor(&thread_ended_dispatcher, &join_waiter);
   } else {
 #ifdef MOZILLA_INTERNAL_API
     MOZ_ASSERT(gMainThread == mainThread);
 #endif
   }
 
-  CSF::VcmSIPCCBinding::setSTSThread(stsThread);
-
   nsresult res;
 
 #ifdef MOZILLA_INTERNAL_API
   // This check fails on the unit tests because they do not
   // have the right thread behavior.
   bool on;
   res = gMainThread->IsOnCurrentThread(&on);
   NS_ENSURE_SUCCESS(res, res);
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h
@@ -29,17 +29,17 @@ namespace sipcc {
 
 // A class to hold some of the singleton objects we need:
 // * The global PeerConnectionImpl table and its associated lock.
 // * Currently SIPCC only allows a single stack instance to exist in a process
 //   at once. This class implements a singleton object that wraps that.
 // * The observer class that demuxes events onto individual PCs.
 class PeerConnectionCtx : public CSF::CC_Observer {
  public:
-  static nsresult InitializeGlobal(nsIThread *mainThread, nsIEventTarget *stsThread);
+  static nsresult InitializeGlobal(nsIThread *mainThread);
   static PeerConnectionCtx* GetInstance();
   static bool isActive();
   static void Destroy();
 
   // Implementations of CC_Observer methods
   virtual void onDeviceEvent(ccapi_device_event_e deviceEvent, CSF::CC_DevicePtr device, CSF::CC_DeviceInfoPtr info);
   virtual void onFeatureEvent(ccapi_device_event_e deviceEvent, CSF::CC_DevicePtr device, CSF::CC_FeatureInfoPtr feature_info) {}
   virtual void onLineEvent(ccapi_line_event_e lineEvent, CSF::CC_LinePtr line, CSF::CC_LineInfoPtr info) {}
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -1,15 +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 <string>
-#include <cstdlib>
-#include <cerrno>
 
 #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"
@@ -136,30 +134,27 @@ public:
   PeerConnectionObserverDispatch(CSF::CC_CallInfoPtr aInfo,
                                  nsRefPtr<PeerConnectionImpl> aPC,
                                  IPeerConnectionObserver* aObserver)
       : mPC(aPC),
         mObserver(aObserver),
         mCode(static_cast<PeerConnectionImpl::Error>(aInfo->getStatusCode())),
         mReason(aInfo->getStatus()),
         mSdpStr(),
-	mCandidateStr(),
         mCallState(aInfo->getCallState()),
         mFsmState(aInfo->getFsmState()),
         mStateStr(aInfo->callStateToString(mCallState)),
         mFsmStateStr(aInfo->fsmStateToString(mFsmState)) {
     if (mCallState == REMOTESTREAMADD) {
       MediaStreamTable *streams = NULL;
       streams = aInfo->getMediaStreams();
       mRemoteStream = mPC->media()->GetRemoteStream(streams->media_stream_id);
       MOZ_ASSERT(mRemoteStream);
-    } else if (mCallState == FOUNDICECANDIDATE) {
-	mCandidateStr = aInfo->getCandidate();
-    } else if ((mCallState == CREATEOFFERSUCCESS) ||
-	       (mCallState == CREATEANSWERSUCCESS)) {
+    }
+    if ((mCallState == CREATEOFFERSUCCESS) || (mCallState == CREATEANSWERSUCCESS)) {
         mSdpStr = aInfo->getSDP();
     }
   }
 
   ~PeerConnectionObserverDispatch(){}
 
 #ifdef MOZILLA_INTERNAL_API
   class TracksAvailableCallback : public DOMMediaStream::OnTracksAvailableCallback
@@ -279,55 +274,16 @@ public:
       case ADDICECANDIDATE:
         mObserver->OnAddIceCandidateSuccess();
         break;
 
       case ADDICECANDIDATEERROR:
         mObserver->OnAddIceCandidateError(mCode, mReason.c_str());
         break;
 
-      case FOUNDICECANDIDATE:
-        {
-            size_t end_of_level = mCandidateStr.find('\t');
-            if (end_of_level == std::string::npos) {
-                MOZ_ASSERT(false);
-                return NS_OK;
-            }
-            std::string level = mCandidateStr.substr(0, end_of_level);
-            if (!level.size()) {
-                MOZ_ASSERT(false);
-                return NS_OK;
-            }
-            char *endptr;
-            errno = 0;
-            unsigned long level_long =
-                strtoul(level.c_str(), &endptr, 10);
-            if (errno || *endptr != 0 || level_long > 65535) {
-                /* Conversion failure */
-                MOZ_ASSERT(false);
-                return NS_OK;
-            }
-            size_t end_of_mid = mCandidateStr.find('\t', end_of_level + 1);
-            if (end_of_mid == std::string::npos) {
-                MOZ_ASSERT(false);
-                return NS_OK;
-            }
-
-            std::string mid = mCandidateStr.substr(end_of_level + 1,
-                                                   end_of_mid - (end_of_level + 1));
-
-            std::string candidate = mCandidateStr.substr(end_of_mid + 1);
-
-
-            mObserver->OnIceCandidate(
-                level_long & 0xffff,
-                mid.c_str(),
-                candidate.c_str());
-        }
-        break;
       case REMOTESTREAMADD:
         {
           DOMMediaStream* stream = nullptr;
 
           if (!mRemoteStream) {
             CSFLogError(logTag, "%s: GetRemoteStream returned NULL", __FUNCTION__);
           } else {
             stream = mRemoteStream->GetMediaStream();
@@ -362,17 +318,16 @@ public:
   }
 
 private:
   nsRefPtr<PeerConnectionImpl> mPC;
   nsCOMPtr<IPeerConnectionObserver> mObserver;
   PeerConnectionImpl::Error mCode;
   std::string mReason;
   std::string mSdpStr;
-  std::string mCandidateStr;
   cc_call_state_t mCallState;
   fsmdef_states_t mFsmState;
   std::string mStateStr;
   std::string mFsmStateStr;
   nsRefPtr<RemoteSourceStreamInfo> mRemoteStream;
 };
 
 NS_IMPL_ISUPPORTS1(PeerConnectionImpl, IPeerConnection)
@@ -386,19 +341,17 @@ PeerConnectionImpl::PeerConnectionImpl()
   , mIceState(kIceGathering)
   , mPCObserver(NULL)
   , mWindow(NULL)
   , mIdentity(NULL)
   , mSTSThread(NULL)
   , mMedia(NULL)
   , mNumAudioStreams(0)
   , mNumVideoStreams(0)
-  , mHaveDataStream(false)
-  , mTrickle(true) // TODO(ekr@rtfm.com): Use pref
-{
+  , mHaveDataStream(false) {
 #ifdef MOZILLA_INTERNAL_API
   MOZ_ASSERT(NS_IsMainThread());
 #endif
   CSFLogInfo(logTag, "%s: PeerConnectionImpl constructor for %s",
              __FUNCTION__, mHandle.c_str());
   STAMP_TIMECARD(mTimeCard, "Constructor Completed");
 }
 
@@ -648,17 +601,17 @@ PeerConnectionImpl::Initialize(IPeerConn
     handle_bin[4],
     handle_bin[5],
     handle_bin[6],
     handle_bin[7]);
 
   mHandle = hex;
 
   STAMP_TIMECARD(mTimeCard, "Initializing PC Ctx");
-  res = PeerConnectionCtx::InitializeGlobal(mThread, mSTSThread);
+  res = PeerConnectionCtx::InitializeGlobal(mThread);
   NS_ENSURE_SUCCESS(res, res);
 
   PeerConnectionCtx *pcctx = PeerConnectionCtx::GetInstance();
   MOZ_ASSERT(pcctx);
   STAMP_TIMECARD(mTimeCard, "Done Initializing PC Ctx");
 
   mCall = pcctx->createCall();
   if(!mCall.get()) {
@@ -1353,17 +1306,17 @@ PeerConnectionImpl::GetIceState(uint32_t
   *aState = mIceState;
   return NS_OK;
 }
 
 nsresult
 PeerConnectionImpl::CheckApiState(bool assert_ice_ready) const
 {
   PC_AUTO_ENTER_API_CALL_NO_CHECK();
-  MOZ_ASSERT(mTrickle || !assert_ice_ready || (mIceState != kIceGathering));
+  PR_ASSERT(!assert_ice_ready || (mIceState != kIceGathering));
 
   if (mReadyState == kClosed)
     return NS_ERROR_FAILURE;
   if (!mMedia)
     return NS_ERROR_FAILURE;
   return NS_OK;
 }
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -381,18 +381,16 @@ private:
   int mNumAudioStreams;
   int mNumVideoStreams;
 
   bool mHaveDataStream;
 
   // Holder for error messages from parsing SDP
   std::vector<std::string> mSDPParseErrorMessages;
 
-  bool mTrickle;
-
 public:
   //these are temporary until the DataChannel Listen/Connect API is removed
   unsigned short listenPort;
   unsigned short connectPort;
   char *connectStr; // XXX ownership/free
 };
 
 // This is what is returned when you acquire on a handle
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
@@ -102,17 +102,16 @@ typedef struct cc_call_info_t_{
     cc_call_log_t call_log;
     cc_boolean    audio_mute;
     cc_boolean    video_mute;
     cc_call_conference_Info_t call_conference;
     cc_string_t   sdp;
     unsigned int  media_stream_track_id;
     unsigned int  media_stream_id;
     cc_media_constraints_t* cc_constraints;
-    string_t      candidate;
     Timecard *    timecard;
 } session_data_t;
 
 typedef enum {
     NO_ACTION=0,
     RESET_ACTION,
     RESTART_ACTION,
     RE_REGISTER_ACTION,
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
@@ -144,20 +144,16 @@ cc_return_t cc_invokeFeatureSDPMode(cc_c
     case CC_FEATURE_SETPEERCONNECTION:
     	callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
         callFeature.featData.ccData.info1 = NULL;
     	break;
     case CC_FEATURE_ADDICECANDIDATE:
     	callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
         callFeature.featData.ccData.info1 = strlib_malloc(data1, strlen(data1));
     	break;
-    case CC_FEATURE_FOUNDICECANDIDATE:
-    	callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
-        callFeature.featData.ccData.info1 = NULL;
-    	break;
 
     default:
         callFeature.featData.ccData.info = NULL;
         callFeature.featData.ccData.info1 = NULL;
     	break;
     }
 
     if (ccappTaskPostMsg(CCAPP_INVOKE_FEATURE, &callFeature, sizeof(session_feature_t), CCAPP_CCPROVIER) == CPR_FAILURE) {
@@ -373,29 +369,16 @@ cc_return_t CC_CallFeature_AddICECandida
     cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
             GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_ADDICECANDIDATE, JSEP_NO_ACTION,
                                    0, 0, NO_STREAM, (uint16_t)level, constraints, candidate, mid, tc);
 }
 
-cc_return_t CC_CallFeature_FoundICECandidate(cc_call_handle_t call_handle,
-					     const char* candidate,
-					     const char *mid,
-					     cc_level_t level,
-					     Timecard *tc) {
-    cc_media_constraints_t *constraints = NULL;
-    CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
-            GET_LINE_ID(call_handle), __FUNCTION__));
-
-    return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_FOUNDICECANDIDATE, JSEP_NO_ACTION,
-                                   0, 0, NO_STREAM, (uint16_t)level, constraints, candidate, mid, tc);
-}
-
 /**
  * Initiate a speed dial.
  * @param call handle
  * @param callid call id
  * @param speed dial numbers.
  * @return SUCCESS or FAILURE
  */
 cc_return_t CC_CallFeature_speedDial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const string_t speed_dial_number) {
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call_info.c
@@ -743,34 +743,16 @@ cc_string_t CCAPI_CallInfo_getSDP(cc_cal
      CCAPP_DEBUG(DEB_F_PREFIX"returned %s", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->sdp);
      return data->sdp;
   }
 
   return strlib_empty();
 }
 
 /**
- * get candidate for trickle ICE
- * @param handle - call handle
- * @return sdp
- */
-cc_string_t CCAPI_CallInfo_getCandidate(cc_callinfo_ref_t handle){
-  static const char *fname="CCAPI_CallInfo_getCandiate";
-  session_data_t *data = (session_data_t *)handle;
-  CCAPP_DEBUG(DEB_F_PREFIX"Entering", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
-
-  if (data){
-     CCAPP_DEBUG(DEB_F_PREFIX"returned %s", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), data->candidate);
-     return data->candidate;
-  }
-
-  return strlib_empty();
-}
-
-/**
  * get status code from internal JSEP functions
  * @param handle - call handle
  * @return status code
  */
 cc_int32_t  CCAPI_CallInfo_getStatusCode(cc_callinfo_ref_t handle){
   static const char *fname="CCAPI_CallInfo_getStatusCode";
   session_data_t *data = (session_data_t *)handle;
   CCAPP_DEBUG(DEB_F_PREFIX"Entering", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
@@ -705,23 +705,16 @@ processSessionEvent (line_t line_id, cal
            break;
          case CC_FEATURE_ADDICECANDIDATE:
            STAMP_TIMECARD(timecard, "Processing add candidate event");
            featdata.candidate.level = ccData.level;
            sstrncpy(featdata.candidate.candidate, data, sizeof(featdata.candidate.candidate)-1);
            sstrncpy(featdata.candidate.mid, data1, sizeof(featdata.candidate.mid)-1);
            cc_int_feature2(CC_MSG_ADDCANDIDATE, CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_ADDICECANDIDATE, &featdata, timecard);
            break;
-         case CC_FEATURE_FOUNDICECANDIDATE:
-           STAMP_TIMECARD(timecard, "Processing found candidate event");
-           featdata.candidate.level = ccData.level;
-           sstrncpy(featdata.candidate.candidate, data, sizeof(featdata.candidate.candidate)-1);
-           sstrncpy(featdata.candidate.mid, data1, sizeof(featdata.candidate.mid)-1);
-           cc_int_feature2(CC_MSG_FOUNDCANDIDATE, CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_FOUNDICECANDIDATE, &featdata, timecard);
-           break;
          case CC_FEATURE_DIALSTR:
              if (CheckAndGetAvailableLine(&line_id, &call_id) == TRUE) {
                  getDigits(data, digits, sizeof(digits));
                  if (strlen(digits) == 0) {
                     //if dial string is empty then go offhook
                     cc_offhook(CC_SRC_UI, call_id, line_id);
                  } else {
                  dp_int_init_dialing_data(line_id, call_id);
@@ -1063,18 +1056,17 @@ session_data_t * getDeepCopyOfSessionDat
            newData->orig_called_name =  strlib_copy(data->orig_called_name);
            newData->orig_called_number =  strlib_copy(data->orig_called_number);
            newData->last_redir_name =  strlib_copy(data->last_redir_name);
            newData->last_redir_number =  strlib_copy(data->last_redir_number);
            newData->plcd_name =  strlib_copy(data->plcd_name);
            newData->plcd_number =  strlib_copy(data->plcd_number);
            newData->status =  strlib_copy(data->status);
            newData->sdp = strlib_copy(data->sdp);
-	   newData->candidate = data->candidate ?
-	       strlib_copy(data->candidate) : strlib_empty();
+
            /* The timecard can have only one owner */
            newData->timecard = data->timecard;
            data->timecard = NULL;
 
            calllogger_copy_call_log(&newData->call_log, &data->call_log);
        } else {
            newData->ref_count = 1;
            newData->state = ONHOOK;
@@ -1088,17 +1080,16 @@ session_data_t * getDeepCopyOfSessionDat
            newData->orig_called_name = strlib_empty();
            newData->orig_called_number = strlib_empty();
            newData->last_redir_name = strlib_empty();
            newData->last_redir_number = strlib_empty();
            newData->plcd_name =  strlib_empty();
            newData->plcd_number =  strlib_empty();
            newData->status = strlib_empty();
            newData->sdp = strlib_empty();
-	   newData->candidate = strlib_empty();
            newData->timecard = NULL;
            calllogger_init_call_log(&newData->call_log);
        }
 
    }
    return newData;
 }
 
@@ -1136,19 +1127,16 @@ void cleanSessionData(session_data_t *da
         strlib_free(data->plcd_name);
         data->plcd_name = strlib_empty();
         strlib_free(data->plcd_number);
         data->plcd_number = strlib_empty();
         strlib_free(data->status);
         data->status = strlib_empty();
         strlib_free(data->sdp);
         data->sdp = strlib_empty();
-	if (data->candidate)
-	    strlib_free(data->candidate);
-	data->candidate = strlib_empty();
         data->timecard = NULL;
         calllogger_free_call_log(&data->call_log);
     }
 }
 
 /**
  *
  * CCApp Provider check for CONNECTED calls for preservation
@@ -1457,17 +1445,16 @@ static void ccappUpdateSessionData (sess
         if (sessUpd->eventID == CALL_NEWCALL ||
             sessUpd->eventID == CREATE_OFFER ||
             sessUpd->eventID == CREATE_ANSWER ||
             sessUpd->eventID == SET_LOCAL_DESC ||
             sessUpd->eventID == SET_REMOTE_DESC ||
             sessUpd->eventID == UPDATE_LOCAL_DESC ||
             sessUpd->eventID == UPDATE_REMOTE_DESC ||
             sessUpd->eventID == ICE_CANDIDATE_ADD ||
-            sessUpd->eventID == ICE_CANDIDATE_FOUND ||
             sessUpd->eventID == REMOTE_STREAM_ADD ) {
             data->attr = sessUpd->update.ccSessionUpd.data.state_data.attr;
             data->inst = sessUpd->update.ccSessionUpd.data.state_data.inst;
         }
         data->cause = sessUpd->update.ccSessionUpd.data.state_data.cause;
         data->clg_name = strlib_empty();
         data->clg_number =  strlib_empty();
         data->alt_number = strlib_empty();
@@ -1840,22 +1827,16 @@ static void ccappUpdateSessionData (sess
         break;
     case CREATE_OFFER:
     case CREATE_ANSWER:
     case SET_LOCAL_DESC:
     case SET_REMOTE_DESC:
     case UPDATE_LOCAL_DESC:
     case UPDATE_REMOTE_DESC:
     case ICE_CANDIDATE_ADD:
-    case ICE_CANDIDATE_FOUND:
-	if (sessUpd->update.ccSessionUpd.data.state_data.extra) {
-	    if (sessUpd->eventID == ICE_CANDIDATE_FOUND) {
-		data->candidate = sessUpd->update.ccSessionUpd.data.state_data.extra;
-	    }
-	}
         data->sdp = sessUpd->update.ccSessionUpd.data.state_data.sdp;
         /* Fall through to the next case... */
     case REMOTE_STREAM_ADD:
         data->timecard = sessUpd->update.ccSessionUpd.data.state_data.timecard;
         data->cause = sessUpd->update.ccSessionUpd.data.state_data.cause;
         data->state = sessUpd->update.ccSessionUpd.data.state_data.state;
         data->fsm_state =
             sessUpd->update.ccSessionUpd.data.state_data.fsm_state;
--- a/media/webrtc/signaling/src/sipcc/core/common/ui.c
+++ b/media/webrtc/signaling/src/sipcc/core/common/ui.c
@@ -1551,17 +1551,16 @@ ui_control_feature (line_t line_id, call
  */
 static void post_message_helper(group_call_event_t eventId,
                                 call_events event,
                                 fsmdef_states_t new_state,
                                 line_t nLine,
                                 callid_t nCallId,
                                 uint16_t call_instance_id,
                                 string_t sdp,
-				string_t extra,
                                 Timecard *timecard,
                                 pc_error error,
                                 const char *format,
                                 va_list args)
 {
     flex_string fs;
     session_update_t msg;
     memset( &msg, 0, sizeof(session_update_t));
@@ -1576,17 +1575,16 @@ static void post_message_helper(group_ca
     msg.sessionID = createSessionId(nLine, nCallId);
 
     msg.eventID = eventId;
     msg.update.ccSessionUpd.data.state_data.state = event;
     msg.update.ccSessionUpd.data.state_data.fsm_state = new_state;
     msg.update.ccSessionUpd.data.state_data.inst = call_instance_id;
     msg.update.ccSessionUpd.data.state_data.line_id = nLine;
     msg.update.ccSessionUpd.data.state_data.sdp = sdp;
-    msg.update.ccSessionUpd.data.state_data.extra = extra;
     msg.update.ccSessionUpd.data.state_data.cause = error;
     msg.update.ccSessionUpd.data.state_data.timecard = timecard;
 
     if (format) {
       flex_string_init(&fs);
       flex_string_vsprintf(&fs, format, args);
       msg.update.ccSessionUpd.data.state_data.reason_text =
         strlib_malloc(fs.buffer, -1);
@@ -1624,17 +1622,17 @@ void ui_create_offer(call_events event,
 
     TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
               DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__),
               event, call_instance_id);
 
 
     va_start(ap, format);
     post_message_helper(CREATE_OFFER, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, NULL, timecard, error, format, ap);
+                        call_instance_id, sdp, timecard, error, format, ap);
     va_end(ap);
 
     return;
 }
 
 /**
  *  Send data from createAnswer to the UI, can send success with SDP string
  *  or can send error
@@ -1652,17 +1650,17 @@ void ui_create_answer(call_events event,
                       const char *format, ...)
 {
     va_list ap;
     TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
               DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id);
 
     va_start(ap, format);
     post_message_helper(CREATE_ANSWER, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, NULL, timecard, error, format, ap);
+                        call_instance_id, sdp, timecard, error, format, ap);
     va_end(ap);
 
     return;
 }
 
 /**
  *  Send data from setLocalDescription to the UI
  *
@@ -1680,17 +1678,17 @@ void ui_set_local_description(call_event
                               const char *format, ...)
 {
     va_list ap;
     TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
               DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id);
 
     va_start(ap, format);
     post_message_helper(SET_LOCAL_DESC, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, NULL, timecard, error, format, ap);
+                        call_instance_id, sdp, timecard, error, format, ap);
     va_end(ap);
 
     return;
 }
 
 /**
  *  Send data from setRemoteDescription to the UI
  *
@@ -1708,17 +1706,17 @@ void ui_set_remote_description(call_even
                                const char *format, ...)
 {
     va_list ap;
     TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
               DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id);
 
     va_start(ap, format);
     post_message_helper(SET_REMOTE_DESC, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, NULL, timecard, error, format, ap);
+                        call_instance_id, sdp, timecard, error, format, ap);
     va_end(ap);
 
     return;
 }
 
 /**
  *  Let PeerConnection know about an updated local session description
  *
@@ -1737,17 +1735,17 @@ void ui_update_local_description(call_ev
 {
     va_list ap;
     TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
               DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__),
               event, call_instance_id);
 
     va_start(ap, format);
     post_message_helper(UPDATE_LOCAL_DESC, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, NULL, timecard, error, format, ap);
+                        call_instance_id, sdp, timecard, error, format, ap);
     va_end(ap);
 
     return;
 }
 
 /**
  * Send data from addIceCandidate to the UI
  *
@@ -1765,45 +1763,17 @@ void ui_ice_candidate_add(call_events ev
                           const char *format, ...)
 {
     va_list ap;
     TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
               DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id);
 
     va_start(ap, format);
     post_message_helper(ICE_CANDIDATE_ADD, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, NULL, timecard, error, format, ap);
-    va_end(ap);
-}
-
-
-/**
- * Send data from foundIceCandidate to the UI
- *
- * @return none
- */
-
-void ui_ice_candidate_found(call_events event,
-			    fsmdef_states_t new_state,
-			    line_t nLine,
-			    callid_t nCallID,
-			    uint16_t call_instance_id,
-			    string_t sdp,
-			    string_t candidate,
-			    Timecard *timecard,
-			    pc_error error,
-			    const char *format, ...)
-{
-    va_list ap;
-    TNP_DEBUG(DEB_L_C_F_PREFIX"state=%d call_instance=%d",
-              DEB_L_C_F_PREFIX_ARGS(UI_API, nLine, nCallID, __FUNCTION__), event, call_instance_id);
-
-    va_start(ap, format);
-    post_message_helper(ICE_CANDIDATE_FOUND, event, new_state, nLine, nCallID,
-                        call_instance_id, sdp, candidate, timecard, error, format, ap);
+                        call_instance_id, sdp, timecard, error, format, ap);
     va_end(ap);
 }
 
 /**
  *  Send Remote Stream data to the UI
  *
  *  @return none
  */
--- a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
@@ -32,17 +32,16 @@
 #include "prot_configmgr.h"
 #include "sip_interface_regmgr.h"
 #include "dialplanint.h"
 #include "subapi.h"
 #include "text_strings.h"
 #include "platform_api.h"
 #include "peer_connection_types.h"
 #include "prlog.h"
-#include "prprf.h"
 #include "sessionHash.h"
 
 extern void update_kpmlconfig(int kpmlVal);
 extern boolean g_disable_mass_reg_debug_print;
 void escalateDeescalate();
 
 #define FSMDEF_NO_NUMBER    (NULL)
 #define DIGIT_POUND         ('#')
@@ -89,17 +88,16 @@ static const char *fsmdef_state_names[] 
 static sm_rcs_t fsmdef_ev_createoffer(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_createanswer(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_setlocaldesc(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_setremotedesc(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_setpeerconnection(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_addstream(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_removestream(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_addcandidate(sm_event_t *event);
-static sm_rcs_t fsmdef_ev_foundcandidate(sm_event_t *event);
 
 static sm_rcs_t fsmdef_ev_default(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_default_feature_ack(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_idle_setup(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_idle_feature(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_idle_offhook(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_idle_dialstring(sm_event_t *event);
 static sm_rcs_t fsmdef_ev_onhook(sm_event_t *event);
@@ -199,18 +197,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_setpeerconnection,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_COLLECT_INFO ---------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -230,18 +227,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_CALL_SENT ------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_proceeding,
     /* CC_MSG_ALERTING         */ fsmdef_ev_out_alerting,
@@ -261,18 +257,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_OUTGOING_PROCEEDING --------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_out_alerting,
@@ -292,18 +287,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_KPML_COLLECT_INFO ----------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_out_alerting,
@@ -323,18 +317,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_OUTGOING_ALERTING ----------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_out_alerting,
@@ -354,18 +347,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_INCOMING_ALERTING ----------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -385,18 +377,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_CONNECTING ------------------------------------------------------ */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -416,18 +407,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_JOINING --------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -447,18 +437,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_CONNECTED ------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -478,18 +467,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_CONNECTED_MEDIA_PEND  ------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -509,18 +497,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_RELEASING ------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -540,18 +527,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_HOLD_PENDING ---------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -571,18 +557,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_HOLDING --------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -602,18 +587,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_RESUME_PENDING -------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -633,18 +617,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 /* FSMDEF_S_PRESERVED  ------------------------------------------------------ */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -664,18 +647,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_session_audit,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     },
 
 
 /* FSMDEF_S_STABLE  --------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
@@ -696,18 +678,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_default,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_createoffer,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_createanswer,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_setlocaldesc,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_setremotedesc,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_addstream,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_removestream,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_foundcandidate
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate
     },
 
 /* FSMDEF_S_HAVE_LOCAL_OFFER  ----------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -727,19 +708,18 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_default,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_createoffer,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_createanswer,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_setlocaldesc,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_setremotedesc,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default, /* Reject lame-duck
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default /* Reject lame-duck
                                                        candidates */
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_foundcandidate
     },
 
 /* FSMDEF_S_HAVE_REMOTE_OFFER  ---------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -759,18 +739,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_default,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_createoffer,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_createanswer,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_setlocaldesc,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_setremotedesc,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_addstream,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_removestream,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate
     },
 
 /* FSMDEF_S_HAVE_LOCAL_PRANSWER  -------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -790,18 +769,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_default,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_createoffer,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_createanswer,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_setlocaldesc,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default, /* Should not happen */
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_foundcandidate
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate
     },
 
 /* FSMDEF_S_HAVE_REMOTE_PRANSWER  ------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -821,18 +799,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_default,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_createoffer,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_createanswer,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default, /* Should not happen */
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_setremotedesc,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_foundcandidate
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_addcandidate
     },
 
 /* FSMDEF_S_CLOSED  --------------------------------------------------------- */
     {
     /* CC_MSG_SETUP            */ fsmdef_ev_default,
     /* CC_MSG_SETUP_ACK        */ fsmdef_ev_default,
     /* CC_MSG_PROCEEDING       */ fsmdef_ev_default,
     /* CC_MSG_ALERTING         */ fsmdef_ev_default,
@@ -852,18 +829,17 @@ static sm_function_t fsmdef_function_tab
     /* CC_MSG_SESSION_AUDIT    */ fsmdef_ev_default,
     /* CC_MSG_CREATEOFFER      */ fsmdef_ev_default,
     /* CC_MSG_CREATEANSWER     */ fsmdef_ev_default,
     /* CC_MSG_SETLOCALDESC     */ fsmdef_ev_default,
     /* CC_MSG_SETREMOTEDESC    */ fsmdef_ev_default,
     /* CC_MSG_SETPEERCONNECTION */fsmdef_ev_default,
     /* CC_MSG_ADDSTREAM        */ fsmdef_ev_default,
     /* CC_MSG_REMOVESTREAM     */ fsmdef_ev_default,
-    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default,
-    /* CC_MSG_FOUNDCANDIDATE   */ fsmdef_ev_default
+    /* CC_MSG_ADDCANDIDATE     */ fsmdef_ev_default
     }
 };
 
 static sm_table_t fsmdef_sm_table;
 sm_table_t *pfsmdef_sm_table = &fsmdef_sm_table;
 
 /*--------------------------------------------------------------------------
  * Global data
@@ -1321,18 +1297,16 @@ fsmdef_init_dcb (fsmdef_dcb_t *dcb, call
     dcb->callref = 0;
 
     dcb->ice_ufrag = NULL;
     dcb->ice_pwd = NULL;
     dcb->ice_default_candidate_addr[0] = '\0';
 
     dcb->digest_alg[0] = '\0';
     dcb->digest[0] = '\0';
-
-    sll_lite_init(&dcb->candidate_list);
 }
 
 
 static void
 fsmdef_free_dcb (fsmdef_dcb_t *dcb)
 {
     if (dcb == NULL) {
         return;
@@ -1372,19 +1346,16 @@ fsmdef_free_dcb (fsmdef_dcb_t *dcb)
     // Free the call instance id
     if (dcb->caller_id.call_instance_id != 0) {
         fsmutil_free_ci_id(dcb->caller_id.call_instance_id, dcb->line);
     }
 
     /* clean media list */
     gsmsdp_clean_media_list(dcb);
 
-    /* clean candidate list */
-    gsmsdp_clean_candidate_list(dcb);
-
     gsmsdp_free(dcb);
 
     fsmdef_init_dcb(dcb, CC_NO_CALL_ID, FSMDEF_CALL_TYPE_NONE, NULL,
                     LSM_NO_LINE, NULL);
 
     /*
      * Cache random numbers for SRTP keys
      */
@@ -2479,24 +2450,16 @@ fsmdef_ev_default (sm_event_t *event)
       case CC_MSG_ADDCANDIDATE:
           ui_ice_candidate_add(evAddIceCandidateError, fcb->state, msg->line,
               msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(),
               msg->timecard,
               PC_INVALID_STATE, "Cannot add ICE candidate in state %s",
               fsmdef_state_name(fcb->state));
         break;
 
-      case CC_MSG_FOUNDCANDIDATE:
-          ui_ice_candidate_found(evFoundIceCandidateError, fcb->state, msg->line,
-              msg->call_id, dcb->caller_id.call_instance_id, strlib_empty(),
-              NULL, msg->timecard,
-              PC_INVALID_STATE, "Cannot add found ICE candidate in state %s",
-              fsmdef_state_name(fcb->state));
-        break;
-
       case CC_MSG_ADDSTREAM:
       case CC_MSG_REMOVESTREAM:
           /* This shouldn't happen, since PeerConnection should check
            * the state before sending these events to us. The debug message
            * here is to catch the unexpected situation of such an event
            * getting through anyway. */
           FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Cannot add or remove streams "
               "in state %s", DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line,
@@ -3202,19 +3165,16 @@ fsmdef_ev_createoffer (sm_event_t *event
 
         ui_create_offer(evCreateOfferSuccess, fcb->state, line, call_id,
             dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
             msg->timecard, PC_NO_ERROR, NULL);
         free(local_sdp);
         return (SM_RC_END);
     }
 
-    /* clean candidate list, since we are about to return the candidates */
-    gsmsdp_clean_candidate_list(dcb);
-
     dcb->inbound = FALSE;
 
     if (msg->data.session.constraints) {
        gsmsdp_process_cap_constraints(dcb, msg->data.session.constraints);
        fsmdef_free_constraints(msg->data.session.constraints);
        msg->data.session.constraints = 0;
     }
 
@@ -3366,19 +3326,16 @@ fsmdef_ev_createanswer (sm_event_t *even
 
         ui_create_answer(evCreateAnswerSuccess, fcb->state, line, call_id,
             dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
             msg->timecard, PC_NO_ERROR, NULL);
         free(local_sdp);
         return (SM_RC_END);
     }
 
-    /* clean candidate list, since we are about to return the candidates */
-    gsmsdp_clean_candidate_list(dcb);
-
     dcb->inbound = TRUE;
 
     if (msg->data.session.constraints) {
        gsmsdp_process_cap_constraints(dcb, msg->data.session.constraints);
        fsmdef_free_constraints(msg->data.session.constraints);
        msg->data.session.constraints = 0;
     }
 
@@ -3497,17 +3454,16 @@ fsmdef_ev_setlocaldesc(sm_event_t *event
     int                 action = msg->action;
     string_t            sdp = msg->sdp;
     int                 sdpmode = 0;
     callid_t            call_id = msg->call_id;
     line_t              line = msg->line;
     cc_causes_t         lsm_rc;
     char                *local_sdp = NULL;
     uint32_t            local_sdp_len = 0;
-    fsmdef_candidate_t *candidate = NULL;
 
     FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
 
     if (dcb == NULL) {
         FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.",
           DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
         fsm_change_state(fcb, __LINE__, FSMDEF_S_CLOSED);
         ui_set_local_description(evSetLocalDescError, fcb->state, line, call_id,
@@ -3642,31 +3598,16 @@ fsmdef_ev_setlocaldesc(sm_event_t *event
             "description");
         return (SM_RC_END);
     }
 
     ui_set_local_description(evSetLocalDescSuccess, fcb->state, msg->line,
         msg->call_id, dcb->caller_id.call_instance_id,
         strlib_malloc(local_sdp,-1), msg->timecard, PC_NO_ERROR, NULL);
 
-    /* If we have pending candidates flush them too */
-    while (TRUE) {
-        /* unlink head and free the media */
-        candidate = (fsmdef_candidate_t *)sll_lite_unlink_head(&dcb->candidate_list);
-        if (candidate) {
-            ui_ice_candidate_found(evFoundIceCandidate, fcb->state, line, call_id,
-                                   dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
-                                   candidate->candidate, /* Transfer ownership */
-                                   NULL, PC_NO_ERROR, NULL);
-            free(candidate);
-        } else {
-            break;
-        }
-    }
-
     free(local_sdp);
     return (SM_RC_END);
 }
 
 /**
  * SetRemoteDescription
  *
  * Because the PeerConnection relies on receiving either a success or
@@ -4176,127 +4117,16 @@ fsmdef_ev_addcandidate(sm_event_t *event
     ui_ice_candidate_add(evAddIceCandidate, fcb->state, line, call_id,
         dcb->caller_id.call_instance_id, strlib_malloc(remote_sdp,-1),
         msg->timecard, PC_NO_ERROR, NULL);
 
     free(remote_sdp);
     return (SM_RC_END);
 }
 
-
-static sm_rcs_t
-fsmdef_ev_foundcandidate(sm_event_t *event) {
-    fsm_fcb_t           *fcb = (fsm_fcb_t *) event->data;
-    fsmdef_dcb_t        *dcb = fcb->dcb;
-    cc_causes_t         cause = CC_CAUSE_NORMAL;
-    cc_feature_t        *msg = (cc_feature_t *) event->msg;
-    int                 sdpmode = 0;
-    short               vcm_res;
-    uint16_t            level;
-    line_t              line = msg->line;
-    callid_t            call_id = msg->call_id;
-    char                *local_sdp = 0;
-    uint32_t            local_sdp_len = 0;
-    string_t            candidate = 0;
-    char                candidate_tmp[CANDIDATE_SIZE + 32]; /* Sort of arbitrary */
-
-    FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
-
-    if (!dcb) {
-        FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
-        ui_ice_candidate_add(evAddIceCandidateError, fcb->state, line, call_id,
-            0, strlib_empty(), msg->timecard, PC_INTERNAL_ERROR,
-            "DCB has not been created.");
-        return SM_RC_CLEANUP;
-    }
-
-    config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
-    if (!sdpmode) {
-        MOZ_CRASH();
-    }
-
-    MOZ_ASSERT(dcb->sdp && dcb->sdp->src_sdp);
-    if (!dcb->sdp || !dcb->sdp->src_sdp) {
-        FSM_DEBUG_SM(DEB_F_PREFIX"Has the "
-            "local description been set yet?\n",
-            DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
-
-        ui_ice_candidate_found(evFoundIceCandidateError, fcb->state, line, call_id,
-                               dcb->caller_id.call_instance_id, strlib_empty(),
-                               NULL, msg->timecard,
-            PC_INVALID_STATE, "Cannot add found ICE candidates without"
-                              "local SDP.");
-
-        return SM_RC_END;
-    }
-
-    /* Store the candidate in the SDP for future reference */
-    level = msg->data.candidate.level;
-    gsmsdp_set_ice_attribute (SDP_ATTR_ICE_CANDIDATE, level,
-                              dcb->sdp->src_sdp,
-                              (char *)msg->data.candidate.candidate);
-
-    local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len);
-
-    if (!local_sdp) {
-        ui_ice_candidate_found(evFoundIceCandidateError, fcb->state, line, call_id,
-            dcb->caller_id.call_instance_id, strlib_empty(), NULL,
-            msg->timecard,
-            PC_INTERNAL_ERROR, "Could not serialize new SDP after adding ICE "
-            "candidate.");
-        return (SM_RC_END);
-    }
-
-    /* Distinguish between the following two cases:
-
-       1. CreateOffer() has been called but SetLocalDesc() has not.
-       2. We are mid-call.
-
-       Both of these are in state STABLE but only in one do we
-       pass up trickle candidates. In the other we buffer them
-       and send them later.
-    */
-    /* Smuggle the entire candidate structure in a string */
-    PR_snprintf(candidate_tmp, sizeof(candidate_tmp), "%d\t%s\t%s",
-                msg->data.candidate.level,
-                (char *)msg->data.candidate.mid,
-                (char *)msg->data.candidate.candidate);
-
-    if (fcb->state == FSMDEF_S_STABLE) {
-        if (!dcb->sdp->dest_sdp) {
-            fsmdef_candidate_t *buffered_cand = NULL;
-
-            FSM_DEBUG_SM(DEB_F_PREFIX"dcb->sdp->dest_sdp is null."
-                         "assuming CreateOffer called but not SetLocal...\n",
-                         DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
-
-            buffered_cand = (fsmdef_candidate_t *)cpr_malloc(sizeof(fsmdef_candidate_t));
-            if (!buffered_cand)
-                return SM_RC_END;
-
-            buffered_cand->candidate = strlib_malloc(candidate_tmp, -1);
-
-            if (sll_lite_link_head(&dcb->candidate_list,
-                                   (sll_lite_node_t *)buffered_cand) != SLL_LITE_RET_SUCCESS)
-                return SM_RC_END;
-
-            /* Don't notify upward */
-            return SM_RC_END;
-        }
-    }
-
-    ui_ice_candidate_found(evFoundIceCandidate, fcb->state, line, call_id,
-        dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
-        strlib_malloc(candidate_tmp, -1),
-        msg->timecard, PC_NO_ERROR, NULL);
-
-    return SM_RC_END;
-}
-
-
 static void
 fsmdef_check_active_feature (fsmdef_dcb_t *dcb, cc_features_t ftr_id)
 {
     if ((dcb) && (dcb->active_feature != ftr_id)) {
         FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_FTR_REQ_ACT),
                      dcb->call_id, dcb->line,
                      cc_feature_name(ftr_id),
                      cc_feature_name(dcb->active_feature));
--- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
@@ -7362,36 +7362,8 @@ gsmsdp_find_level_from_mid(fsmdef_dcb_t 
         snprintf(buf, sizeof(buf), "%u", mid_id);
         if (strcmp(mid, buf) == 0) {
         	*level = media->level;
         	return CC_CAUSE_OK;
         }
     }
     return CC_CAUSE_VALUE_NOT_FOUND;
 }
-
-/**
- * The function performs cleaning candidate list of a given call. It walks
- * through the list and deallocates each candidate entry.
- *
- * @param[in]dcb   - pointer to fsmdef_def_t for the dcb whose
- *                   media list to be cleaned.
- *
- * @return  none
- *
- * @pre     (dcb not_eq NULL)
- */
-void gsmsdp_clean_candidate_list (fsmdef_dcb_t *dcb_p)
-{
-    fsmdef_candidate_t *candidate = NULL;
-
-    while (TRUE) {
-        /* unlink head and free the media */
-        candidate = (fsmdef_candidate_t *)sll_lite_unlink_head(&dcb_p->candidate_list);
-        if (candidate) {
-            strlib_free(candidate->candidate);
-            free(candidate);
-        } else {
-            break;
-        }
-    }
-}
-
--- a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
@@ -424,17 +424,16 @@ typedef struct {
 
     char *ice_ufrag;
     char *ice_pwd;
     char ice_default_candidate_addr[MAX_IPADDR_STR_LEN];
 
     char digest_alg[FSMDEF_MAX_DIGEST_ALG_LEN];
     char digest[FSMDEF_MAX_DIGEST_LEN];
 
-    sll_lite_list_t candidate_list;
 } fsmdef_dcb_t;
 
 typedef enum fsm_types_t_ {
     FSM_TYPE_MIN = -1,
     FSM_TYPE_NONE = FSM_TYPE_MIN,
     FSM_TYPE_HEAD,
     FSM_TYPE_CNF,
     FSM_TYPE_B2BCNF,
@@ -494,21 +493,16 @@ typedef enum fsmxfr_types_t_ {
 
 typedef enum fsmxfr_modes_t_ {
     FSMXFR_MODE_MIN = -1,
     FSMXFR_MODE_TRANSFEROR,
     FSMXFR_MODE_TRANSFEREE,
     FSMXFR_MODE_TARGET
 } fsmxfr_modes_t;
 
-typedef struct fsmdef_candidate_t_ {
-    sll_lite_node_t node;     /* link node, must be first member of struct */
-    string_t candidate;       /* the candidate value */
-} fsmdef_candidate_t;
-
 struct fsmxfr_xcb_t_;
 typedef struct fsmxfr_xcb_t_ {
     cc_srcs_t         xfr_orig;
     int               xfr_id;
     callid_t          xfr_call_id;
     callid_t          cns_call_id;
     line_t            xfr_line;
     line_t            cns_line;
--- a/media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
@@ -136,12 +136,11 @@ cc_causes_t gsmsdp_find_level_from_mid(f
 void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb,
                                     cc_media_constraints_t* constraints);
 cc_causes_t
 gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_audio, boolean *has_video, boolean *has_data);
 fsmdef_media_t* gsmsdp_find_media_by_media_type(fsmdef_dcb_t *dcb, sdp_media_e 	media_type);
 
 extern void gsmsdp_set_ice_attribute (sdp_attr_e sdp_attr, uint16_t level,
                                       void *sdp_p, char *ice_attrib);
-extern void gsmsdp_clean_candidate_list(fsmdef_dcb_t *dcb);
 
 #endif
 
--- a/media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
+++ b/media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
@@ -98,17 +98,16 @@ typedef enum {
     CC_FEATURE_CREATEOFFER,
     CC_FEATURE_CREATEANSWER,
     CC_FEATURE_SETLOCALDESC,
     CC_FEATURE_SETREMOTEDESC,
     CC_FEATURE_SETPEERCONNECTION,
     CC_FEATURE_ADDSTREAM,
     CC_FEATURE_REMOVESTREAM,
     CC_FEATURE_ADDICECANDIDATE,
-    CC_FEATURE_FOUNDICECANDIDATE,
     CC_FEATURE_MAX
 } group_cc_feature_t;
 
 #define skNewCall CC_FEATURE_NEW_CALL
 #define skConfrn CC_FEATURE_CONF
 
 /* please update the following cc_feature_names whenever this feature list is changed */
 
@@ -164,17 +163,16 @@ static const char *const cc_feature_name
     "CREATEOFFER",
     "CREATEANSWER",
     "SETLOCALDESC",
     "SETREMOTEDESC",
     "SETPEERCONNECTION",
     "ADDSTREAM",
     "REMOVESTREAM",
     "ADDICECANDIDATE",
-    "FOUNDICECANDIDATE",
     "MAX"
 };
 
 /* This checks at compile-time that the cc_feature_names list
  * is the same size as the cc_group_feature_t enum
  */
 MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(cc_feature_names) == CC_FEATURE_MAX + 1,
                   "cc_feature_names size == cc_group_feature_t size?");
@@ -238,17 +236,16 @@ typedef enum cc_msgs_t_ {
     CC_MSG_CREATEOFFER,
     CC_MSG_CREATEANSWER,
     CC_MSG_SETLOCALDESC,
     CC_MSG_SETREMOTEDESC,
     CC_MSG_SETPEERCONNECTION,
     CC_MSG_ADDSTREAM,
     CC_MSG_REMOVESTREAM,
     CC_MSG_ADDCANDIDATE,
-    CC_MSG_FOUNDCANDIDATE,
     CC_MSG_AUDIT_ACK,
     CC_MSG_OPTIONS,
     CC_MSG_OPTIONS_ACK,
     CC_MSG_SUBSCRIBE,
     CC_MSG_NOTIFY,
     CC_MSG_FAILOVER_FALLBACK,
     CC_MSG_INFO,
     /* update the following strings table if this is changed */
@@ -278,17 +275,16 @@ static const char *const cc_msg_names[] 
     "CREATEOFFER",
     "CREATEANSWER",
     "SETLOCALDESC",
     "SETREMOTEDESC",
     "SETPEERCONNECTION",
     "ADDSTREAM",
     "REMOVESTREAM",
     "ADDCANDIDATE",
-    "FOUNDCANDIDATE",
     "AUDIT_ACK",
     "OPTIONS",
     "OPTIONS_ACK",
     "SUBSCRIBE",
     "NOTIFY",
     "FAILOVER_FALLBACK",
     "INFO",
     "INVALID",
--- a/media/webrtc/signaling/src/sipcc/core/includes/sessionConstants.h
+++ b/media/webrtc/signaling/src/sipcc/core/includes/sessionConstants.h
@@ -218,18 +218,17 @@ typedef enum {
     MEDIA_INTERFACE_UPDATE_FAIL,
     CREATE_OFFER,
     CREATE_ANSWER,
     SET_LOCAL_DESC,
     SET_REMOTE_DESC,
     UPDATE_LOCAL_DESC,
     UPDATE_REMOTE_DESC,
     REMOTE_STREAM_ADD,
-    ICE_CANDIDATE_ADD,
-    ICE_CANDIDATE_FOUND
+    ICE_CANDIDATE_ADD
 } group_call_event_t;
 
 /* File Player Session Events */
 typedef enum {
     FILEPLAYER_PLAYED = 300L,
     FILEPLAYER_ALLOCATED
 } group_fileplayer_t;
 
--- a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
+++ b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
@@ -61,17 +61,16 @@ typedef struct {
   int          state;
   int          fsm_state;
   int          attr;
   int          inst;
   line_t       line_id;
   int          cause;
   string_t     reason_text;
   string_t     sdp;
-  string_t     extra;
   unsigned int media_stream_id;
   unsigned int media_stream_track_id;
   Timecard *   timecard;
 } cc_call_state_data_t;
 /* CALL_SESSION_CREATED shall use the call_state as data*/
 
 typedef struct
 {
--- a/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h
+++ b/media/webrtc/signaling/src/sipcc/core/includes/uiapi.h
@@ -39,18 +39,16 @@ typedef enum {
     evSetLocalDescSuccess = SETLOCALDESCSUCCESS,
     evSetRemoteDescSuccess = SETREMOTEDESCSUCCESS,
     evUpdateLocalDesc = UPDATELOCALDESC,
     evSetLocalDescError = SETLOCALDESCERROR,
     evSetRemoteDescError = SETREMOTEDESCERROR,
     evOnRemoteStreamAdd = REMOTESTREAMADD,
     evAddIceCandidate = ADDICECANDIDATE,
     evAddIceCandidateError = ADDICECANDIDATEERROR,
-    evFoundIceCandidate = FOUNDICECANDIDATE,
-    evFoundIceCandidateError = FOUNDICECANDIDATEERROR,
     evMaxEvent
 } call_events;
 
 /* These values must be kept in sync with the equivalent values in:
  *
  *   PeerConnectionImpl.h
  *   Peerconnection.js
  *   nsIDOMPeerConnection.idl
@@ -237,27 +235,16 @@ void ui_ice_candidate_add(call_events ev
                           line_t nLine,
                           callid_t nCallID,
                           uint16_t call_instance_id,
                           string_t sdp,
                           Timecard *timecard,
                           pc_error error,
                           const char *format, ...);
 
-void ui_ice_candidate_found(call_events event,
-                            fsmdef_states_t new_state,
-                            line_t nLine,
-                            callid_t nCallID,
-                            uint16_t call_instance_id,
-                            string_t sdp,
-                            string_t candidate,
-                            Timecard *timecard,
-                            pc_error error,
-                            const char *format, ...);
-
 void ui_on_remote_stream_added(call_events event,
                                fsmdef_states_t new_state,
                                line_t nLine,
                                callid_t nCallID,
                                uint16_t call_instance_id,
                                cc_media_remote_track_table_t media_tracks);
 
 
--- a/media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
+++ b/media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
@@ -181,21 +181,16 @@ cc_return_t CC_CallFeature_AddStream(cc_
 
 cc_return_t CC_CallFeature_RemoveStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id, cc_media_track_id_t id, cc_media_type_t media_type);
 
 cc_return_t CC_CallFeature_AddICECandidate(cc_call_handle_t call_handle,
                                            const char* candidate,
                                            const char *mid,
                                            cc_level_t level,
                                            Timecard *tc);
-cc_return_t CC_CallFeature_FoundICECandidate(cc_call_handle_t call_handle,
-					     const char* candidate,
-					     const char *mid,
-					     cc_level_t level,
-					     Timecard *tc);
 
 /**
  * Initiate a speed dial.
  * @param call_handle call handle
  * @param speed_dial_number speed dial number to be dialed.
  * @param video_pref the sdp direction
  * @return SUCCESS or FAILURE
  */
--- a/media/webrtc/signaling/src/sipcc/include/cc_constants.h
+++ b/media/webrtc/signaling/src/sipcc/include/cc_constants.h
@@ -284,18 +284,16 @@ typedef enum {
 	SETREMOTEDESCSUCCESS,
 	UPDATELOCALDESC,
 	UPDATEREMOTEDESC,
 	SETLOCALDESCERROR,
 	SETREMOTEDESCERROR,
 	REMOTESTREAMADD,
 	ADDICECANDIDATE,
 	ADDICECANDIDATEERROR,
-	FOUNDICECANDIDATE,
-	FOUNDICECANDIDATEERROR,
     MAX_CALL_STATES
 } cc_call_state_t;
 
 /**
  * Defines call attribute
  */
 typedef enum {
 	CC_ATTR_NOT_DEFINED = -1,
--- a/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h
+++ b/media/webrtc/signaling/src/sipcc/include/ccapi_call_info.h
@@ -298,23 +298,16 @@ cc_boolean CCAPI_CallInfo_isVideoMuted(c
 /**
  * get SDP string CreateOffer and CreateAnswer callback
  * @param [in] handle - call info handle
  * @return sdp
  */
 cc_string_t CCAPI_CallInfo_getSDP(cc_callinfo_ref_t handle);
 
 /**
- * get trickle candidate
- * @param [in] handle - call info handle
- * @return sdp
- */
-cc_string_t CCAPI_CallInfo_getCandidate(cc_callinfo_ref_t handle);
-
-/**
  * get status code from internal JSEP functions
  * @param [in] handle - call info handle
  * @return status code
  */
 cc_int32_t  CCAPI_CallInfo_getStatusCode(cc_callinfo_ref_t handle);
 
 /**
  * get media stream table
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp
@@ -449,21 +449,16 @@ MediaStreamTable* CC_SIPCCCallInfo::getM
 	return CCAPI_CallInfo_getMediaStreams(callinfo_ref);
 }
 
 Timecard *CC_SIPCCCallInfo::takeTimecard()
 {
     return CCAPI_CallInfo_takeTimecard(callinfo_ref);
 }
 
-std::string CC_SIPCCCallInfo::getCandidate()
-{
-    return CCAPI_CallInfo_getCandidate(callinfo_ref);
-}
-
 bool CC_SIPCCCallInfo::isMediaStateAvailable()
 {
     // for softphone it will always be possible to query the mute state and video direction
     return true;
 }
 
 
 #define PRINT_IF_CC_CAP_TRUE(cap) ((hasFeature(cap)) ? string(#cap) + ",": "")
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.h
@@ -75,17 +75,16 @@ namespace CSF
         virtual std::string getINFOBody();
         virtual cc_calllog_ref_t getCallLogRef();
         virtual cc_sdp_direction_t getVideoDirection();
         virtual int getVolume();
         virtual bool isMediaStateAvailable();
         virtual bool isAudioMuted();
         virtual bool isVideoMuted();
         virtual std::string getSDP();
-        virtual std::string getCandidate();
         virtual cc_int32_t getStatusCode();
         virtual MediaStreamTable* getMediaStreams() const;
         virtual Timecard *takeTimecard();
 
         virtual void setMediaData(CC_SIPCCCallMediaDataPtr  pMediaData);
 
     private:
         // Helper to generate the caps once - then we serve then from this cache.
--- a/media/webrtc/signaling/test/Makefile.in
+++ b/media/webrtc/signaling/test/Makefile.in
@@ -109,18 +109,16 @@ endif
 ifeq ($(OS_TARGET),WINNT)
 LIBS += \
   $(DEPTH)/staticlib/components/$(LIB_PREFIX)windowsproxy.$(LIB_SUFFIX) \
   $(NULL)
 endif
 
 DEFINES += \
   -DUSE_FAKE_MEDIA_STREAMS \
-  -DNR_SOCKET_IS_VOID_PTR \
-  -DHAVE_STRDUP \
   $(NULL)
 
 ifeq ($(OS_TARGET),Darwin)
 DEFINES += \
   -DGTEST_USE_OWN_TR1_TUPLE=1 \
   $(NULL)
 endif
 
@@ -138,45 +136,19 @@ LOCAL_INCLUDES += \
  -I$(topsrcdir)/media/webrtc/signaling/src/common/time_profiling \
  -I$(topsrcdir)/media/webrtc/signaling/src/media \
  -I$(topsrcdir)/media/webrtc/signaling/src/media-conduit \
  -I$(topsrcdir)/media/webrtc/signaling/src/mediapipeline \
  -I$(topsrcdir)/media/webrtc/signaling/src/sipcc/include \
  -I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \
  -I$(topsrcdir)/media/webrtc/signaling/media-conduit\
  -I$(topsrcdir)/media/webrtc/trunk/third_party/libjingle/source/ \
- -I$(topsrcdir)/media/mtransport/third_party/nICEr/src/ice \
- -I$(topsrcdir)/media/mtransport/third_party/nICEr/src/net \
- -I$(topsrcdir)/media/mtransport/third_party/nICEr/src/stun \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/share \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/util/libekr \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/log \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/registry \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/stats \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/plugin \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \
  -I$(topsrcdir)/xpcom/base/ \
  $(NULL)
 
-ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
-LOCAL_INCLUDES +=  -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include
-ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
-LOCAL_INCLUDES +=  -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include
-endif
-endif
-
-ifeq ($(OS_TARGET), Linux)
-LOCAL_INCLUDES +=  -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include
-endif
-
-ifeq ($(OS_TARGET), Android)
-LOCAL_INCLUDES +=  -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/android/include
-endif
-
-
 ifneq ($(OS_TARGET),WINNT)
 ifneq (gonk,$(MOZ_WIDGET_TOOLKIT))
 ifdef JS_SHARED_LIBRARY
 LIBS += $(MOZ_ZLIB_LIBS)
 endif
 endif
 endif
 
--- a/media/webrtc/signaling/test/sdp_unittests.cpp
+++ b/media/webrtc/signaling/test/sdp_unittests.cpp
@@ -35,18 +35,17 @@ static bool SetupGlobalThread() {
   if (!gThread) {
     nsIThread *thread;
 
     nsresult rv = NS_NewNamedThread("pseudo-main",&thread);
     if (NS_FAILED(rv))
       return false;
 
     gThread = thread;
-    sipcc::PeerConnectionCtx::InitializeGlobal(gThread,
-                                               test_utils->sts_target());
+    sipcc::PeerConnectionCtx::InitializeGlobal(gThread);
   }
   return true;
 }
 
 class SdpTest : public ::testing::Test {
   public:
     SdpTest() : sdp_ptr_(nullptr) {
       sdp_media_e supported_media[] = {
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -4,17 +4,16 @@
 
 #include <iostream>
 #include <map>
 #include <algorithm>
 #include <string>
 #include <unistd.h>
 
 #include "base/basictypes.h"
-#include "logging.h"
 
 #define GTEST_HAS_RTTI 0
 #include "gtest/gtest.h"
 #include "gtest_utils.h"
 
 #include "nspr.h"
 #include "nss.h"
 #include "ssl.h"
@@ -27,40 +26,32 @@
 #include "runnable_utils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsNetUtil.h"
 #include "nsIIOService.h"
 #include "nsIDNSService.h"
 #include "nsWeakReference.h"
 #include "nricectx.h"
 #include "mozilla/SyncRunnable.h"
-#include "logging.h"
-#include "stunserver.h"
-#include "stunserver.cpp"
 
 #include "mtransport_test_utils.h"
 MtransportTestUtils *test_utils;
 nsCOMPtr<nsIThread> gThread;
 
 static int kDefaultTimeout = 5000;
 static bool fRtcpMux = true;
 
 static std::string callerName = "caller";
 static std::string calleeName = "callee";
 
 #define ARRAY_TO_STL(container, type, array) \
         (container<type>((array), (array) + PR_ARRAY_SIZE(array)))
 
 #define ARRAY_TO_SET(type, array) ARRAY_TO_STL(std::set, type, array)
 
-std::string g_stun_server_address((char *)"23.21.150.121");
-uint16_t g_stun_server_port(3478);
-std::string kBogusSrflxAddress((char *)"192.0.2.1");
-uint16_t kBogusSrflxPort(1001);
-
 namespace test {
 
 std::string indent(const std::string &s, int width = 4) {
   std::string prefix;
   std::string out;
   char previous = '\n';
   prefix.assign(width, ' ');
   for (std::string::const_iterator i = s.begin(); i != s.end(); i++) {
@@ -190,46 +181,33 @@ public:
     stateError
   };
 
   TestObserver(sipcc::PeerConnectionImpl *peerConnection,
                const std::string &aName) :
     state(stateNoResponse), addIceSuccessCount(0),
     onAddStreamCalled(false),
     name(aName),
-    candidates(),
     pc(peerConnection) {
   }
 
   virtual ~TestObserver() {}
 
   std::vector<DOMMediaStream *> GetStreams() { return streams; }
 
-  size_t MatchingCandidates(const std::string& cand) {
-    size_t count = 0;
-
-    for (size_t i=0; i<candidates.size(); ++i) {
-      if (candidates[i].find(cand) != std::string::npos)
-        ++count;
-    }
-
-    return count;
-  }
-
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_IPEERCONNECTIONOBSERVER
 
   ResponseState state;
   char *lastString;
   sipcc::PeerConnectionImpl::Error lastStatusCode;
   uint32_t lastStateType;
   int addIceSuccessCount;
   bool onAddStreamCalled;
   std::string name;
-  std::vector<std::string> candidates;
 
 private:
   sipcc::PeerConnectionImpl *pc;
   std::vector<DOMMediaStream *> streams;
 };
 
 NS_IMPL_ISUPPORTS2(TestObserver,
                    IPeerConnectionObserver,
@@ -446,23 +424,18 @@ TestObserver::OnAddTrack()
 NS_IMETHODIMP
 TestObserver::OnRemoveTrack()
 {
   state = stateSuccess;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TestObserver::OnIceCandidate(uint16_t level,
-                             const char * mid,
-                             const char * candidate)
+TestObserver::FoundIceCandidate(const char* strCandidate)
 {
-  std::cout << name << ": onIceCandidate [" << level << "/"
-            << mid << "] " << candidate << std::endl;
-  candidates.push_back(candidate);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TestObserver::OnAddIceCandidateSuccess()
 {
   lastStatusCode = sipcc::PeerConnectionImpl::kNoError;
   state = stateSuccess;
@@ -654,31 +627,22 @@ class ParsedSDP {
   std::multimap<std::string, SdpLine> sdp_map_;
   int levels_;
   int num_lines;
 };
 
 class SignalingAgent {
  public:
   SignalingAgent(const std::string &aName) : pc(nullptr), name(aName) {
-    cfg_.addStunServer(g_stun_server_address, g_stun_server_port);
+    cfg_.addStunServer("23.21.150.121", 3478);
 
     pc = sipcc::PeerConnectionImpl::CreatePeerConnection();
     EXPECT_TRUE(pc);
   }
 
-  SignalingAgent(const std::string &aName, const std::string stun_addr,
-                 uint16_t stun_port) : pc(nullptr), name(aName) {
-    cfg_.addStunServer(stun_addr, stun_port);
-
-    pc = sipcc::PeerConnectionImpl::CreatePeerConnection();
-    EXPECT_TRUE(pc);
-  }
-
-
   ~SignalingAgent() {
     mozilla::SyncRunnable::DispatchToThread(gThread,
       WrapRunnable(this, &SignalingAgent::Close));
   }
 
   void Init_m(nsCOMPtr<nsIThread> thread)
   {
     pObserver = new TestObserver(pc, name);
@@ -689,25 +653,28 @@ class SignalingAgent {
 
   void Init(nsCOMPtr<nsIThread> thread)
   {
     mozilla::SyncRunnable::DispatchToThread(thread,
       WrapRunnable(this, &SignalingAgent::Init_m, thread));
 
     ASSERT_TRUE_WAIT(sipcc_state() == sipcc::PeerConnectionImpl::kStarted,
                      kDefaultTimeout);
-  }
-
-  void WaitForGather() {
     ASSERT_TRUE_WAIT(ice_state() == sipcc::PeerConnectionImpl::kIceWaiting, 5000);
-
+    ASSERT_EQ(signaling_state(), sipcc::PeerConnectionImpl::kSignalingStable);
     std::cout << name << ": Init Complete" << std::endl;
   }
 
-  bool WaitForGatherAllowFail() {
+  bool InitAllowFail(nsCOMPtr<nsIThread> thread)
+  {
+    mozilla::SyncRunnable::DispatchToThread(thread,
+        WrapRunnable(this, &SignalingAgent::Init_m, thread));
+
+    EXPECT_TRUE_WAIT(sipcc_state() == sipcc::PeerConnectionImpl::kStarted,
+                     kDefaultTimeout);
     EXPECT_TRUE_WAIT(ice_state() == sipcc::PeerConnectionImpl::kIceWaiting ||
                      ice_state() == sipcc::PeerConnectionImpl::kIceFailed, 5000);
 
     if (ice_state() == sipcc::PeerConnectionImpl::kIceFailed) {
       std::cout << name << ": Init Failed" << std::endl;
       return false;
     }
 
@@ -730,17 +697,17 @@ class SignalingAgent {
     pc->GetIceState(&res);
     return res;
   }
 
   sipcc::PeerConnectionImpl::SignalingState signaling_state()
   {
     uint32_t res;
 
-   pc->GetSignalingState(&res);
+    pc->GetSignalingState(&res);
     return static_cast<sipcc::PeerConnectionImpl::SignalingState>(res);
   }
 
   void Close()
   {
     if (pc) {
       std::cout << name << ": Close" << std::endl;
 
@@ -748,32 +715,16 @@ class SignalingAgent {
       pc = nullptr;
     }
 
     // Shutdown is synchronous evidently.
     // ASSERT_TRUE(pObserver->WaitForObserverCall());
     // ASSERT_EQ(pc->sipcc_state(), sipcc::PeerConnectionInterface::kIdle);
   }
 
-  bool OfferContains(const std::string& str) {
-    std::string o(offer());
-
-    return o.find(str) != std::string::npos;
-  }
-
-  bool AnswerContains(const std::string& str) {
-    std::string o(answer());
-
-    return o.find(str) != std::string::npos;
-  }
-
-  size_t MatchingCandidates(const std::string& cand) {
-    return pObserver->MatchingCandidates(cand);
-  }
-
   char* offer() const { return offer_; }
   char* answer() const { return answer_; }
 
   std::string getLocalDescription() const {
     char *sdp = nullptr;
     pc->GetLocalDescription(&sdp);
     if (!sdp) {
       return "";
@@ -1245,217 +1196,173 @@ class SignalingAgentTest : public ::test
   void TearDown() {
     // Delete all the agents.
     for (size_t i=0; i < agents_.size(); i++) {
       delete agents_[i];
     }
   }
 
   bool CreateAgent() {
-    return CreateAgent(g_stun_server_address, g_stun_server_port);
-  }
-
-  bool CreateAgent(const std::string stun_addr, uint16_t stun_port,
-                   bool wait_for_gather = true) {
-    ScopedDeletePtr<SignalingAgent> agent(
-        new SignalingAgent("agent", stun_addr, stun_port));
-
-    agent->Init(gThread);
-
-    if (wait_for_gather) {
-      if (!agent->WaitForGatherAllowFail())
-        return false;
-    }
+    ScopedDeletePtr<SignalingAgent> agent(new SignalingAgent("agent"));
+
+    if (!agent->InitAllowFail(gThread))
+      return false;
 
     agents_.push_back(agent.forget());
 
     return true;
   }
 
   void CreateAgentNoInit() {
     ScopedDeletePtr<SignalingAgent> agent(new SignalingAgent("agent"));
     agents_.push_back(agent.forget());
   }
 
+  bool InitAgent(size_t i) {
+    return agents_[i]->InitAllowFail(gThread);
+  }
+
   SignalingAgent *agent(size_t i) {
     return agents_[i];
   }
 
  private:
   std::vector<SignalingAgent *> agents_;
 };
 
 
 class SignalingTest : public ::testing::Test {
 public:
-  SignalingTest()
-      : init_(false),
-        a1_(nullptr),
-        a2_(nullptr),
-        wait_for_gather_(true),
-        stun_addr_(g_stun_server_address),
-        stun_port_(g_stun_server_port) {}
-
-  SignalingTest(const std::string& stun_addr, uint16_t stun_port)
-      : a1_(nullptr),
-        a2_(nullptr),
-        wait_for_gather_(true),
-        stun_addr_(stun_addr),
-        stun_port_(stun_port) {}
+  SignalingTest() : a1_(callerName),
+                    a2_(calleeName) {}
 
   static void SetUpTestCase() {
     ASSERT_TRUE(SetupGlobalThread());
   }
 
-  void EnsureInit() {
-
-    if (init_)
-      return;
-
-    a1_ = new SignalingAgent(callerName, stun_addr_, stun_port_);
-    a2_ = new SignalingAgent(calleeName, stun_addr_, stun_port_);
-
-    a1_->Init(gThread);
-    a2_->Init(gThread);
-
-    if (wait_for_gather_) {
-      WaitForGather();
-    }
-  }
-
-  void WaitForGather() {
-    a1_->WaitForGather();
-    a2_->WaitForGather();
+  void SetUp() {
+    a1_.Init(gThread);
+    a2_.Init(gThread);
   }
 
   static void TearDownTestCase() {
     gThread = nullptr;
   }
 
   void CreateOffer(sipcc::MediaConstraints& constraints,
                    uint32_t offerFlags, uint32_t sdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(constraints, offerFlags, sdpCheck);
+    a1_.CreateOffer(constraints, offerFlags, sdpCheck);
   }
 
   void CreateSetOffer(sipcc::MediaConstraints& constraints, uint32_t sdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(constraints, OFFER_AV, sdpCheck);
-    a1_->SetLocal(TestObserver::OFFER, a1_->offer());
+    a1_.CreateOffer(constraints, OFFER_AV, sdpCheck);
+    a1_.SetLocal(TestObserver::OFFER, a1_.offer());
   }
 
   void OfferAnswer(sipcc::MediaConstraints& aconstraints,
                    sipcc::MediaConstraints& bconstraints,
                    uint32_t offerAnswerFlags,
                    bool finishAfterAnswer, uint32_t offerSdpCheck,
                    uint32_t answerSdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(aconstraints, offerAnswerFlags, offerSdpCheck);
-    a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-    a2_->SetRemote(TestObserver::OFFER, a1_->offer());
-    a2_->CreateAnswer(bconstraints, a1_->offer(),
+    a1_.CreateOffer(aconstraints, offerAnswerFlags, offerSdpCheck);
+    a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+    a2_.SetRemote(TestObserver::OFFER, a1_.offer());
+    a2_.CreateAnswer(bconstraints, a1_.offer(),
                      offerAnswerFlags, answerSdpCheck);
     if(true == finishAfterAnswer) {
-        a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-        a1_->SetRemote(TestObserver::ANSWER, a2_->answer());
-
-        ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-        ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+        a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
+        a1_.SetRemote(TestObserver::ANSWER, a2_.answer());
+
+        ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+        ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
     }
   }
 
   void OfferModifiedAnswer(sipcc::MediaConstraints& aconstraints,
                            sipcc::MediaConstraints& bconstraints,
                            uint32_t offerSdpCheck, uint32_t answerSdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(aconstraints, OFFER_AUDIO, offerSdpCheck);
-    a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-    a2_->SetRemote(TestObserver::OFFER, a1_->offer());
-    a2_->CreateAnswer(bconstraints, a1_->offer(), OFFER_AUDIO | ANSWER_AUDIO,
+    a1_.CreateOffer(aconstraints, OFFER_AUDIO, offerSdpCheck);
+    a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+    a2_.SetRemote(TestObserver::OFFER, a1_.offer());
+    a2_.CreateAnswer(bconstraints, a1_.offer(), OFFER_AUDIO | ANSWER_AUDIO,
                      answerSdpCheck);
-    a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-    ParsedSDP sdpWrapper(a2_->answer());
+    a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
+    ParsedSDP sdpWrapper(a2_.answer());
     sdpWrapper.ReplaceLine("m=audio", "m=audio 65375 RTP/SAVPF 109 8 101\r\n");
     sdpWrapper.AddLine("a=rtpmap:8 PCMA/8000\r\n");
     std::cout << "Modified SDP " << std::endl
               << indent(sdpWrapper.getSdp()) << std::endl;
-    a1_->SetRemote(TestObserver::ANSWER, sdpWrapper.getSdp());
-    ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-    ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+    a1_.SetRemote(TestObserver::ANSWER, sdpWrapper.getSdp());
+    ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+    ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
   }
 
   void OfferAnswerTrickle(sipcc::MediaConstraints& aconstraints,
                           sipcc::MediaConstraints& bconstraints,
                           uint32_t offerSdpCheck, uint32_t answerSdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(aconstraints, OFFER_AV, offerSdpCheck);
-    a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-    ParsedSDP a1_offer(a1_->offer());
-    a2_->SetRemote(TestObserver::OFFER, a1_offer.sdp_without_ice_);
-    a2_->CreateAnswer(bconstraints, a1_offer.sdp_without_ice_,
+    a1_.CreateOffer(aconstraints, OFFER_AV, offerSdpCheck);
+    a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+    ParsedSDP a1_offer(a1_.offer());
+    a2_.SetRemote(TestObserver::OFFER, a1_offer.sdp_without_ice_);
+    a2_.CreateAnswer(bconstraints, a1_offer.sdp_without_ice_,
                      OFFER_AV|ANSWER_AV, answerSdpCheck);
-    a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-    ParsedSDP a2_answer(a2_->answer());
-    a1_->SetRemote(TestObserver::ANSWER, a2_answer.sdp_without_ice_);
+    a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
+    ParsedSDP a2_answer(a2_.answer());
+    a1_.SetRemote(TestObserver::ANSWER, a2_answer.sdp_without_ice_);
     // Now set the trickle ICE candidates
-    a1_->DoTrickleIce(a2_answer);
-    a2_->DoTrickleIce(a1_offer);
-    ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-    ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+    a1_.DoTrickleIce(a2_answer);
+    a2_.DoTrickleIce(a1_offer);
+    ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+    ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
   }
 
 
   void OfferAnswerTrickleChrome(sipcc::MediaConstraints& aconstraints,
                           sipcc::MediaConstraints& bconstraints,
                           uint32_t offerSdpCheck, uint32_t answerSdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(aconstraints, OFFER_AV, offerSdpCheck);
-    a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-    ParsedSDP a1_offer(a1_->offer());
-    a2_->SetRemote(TestObserver::OFFER, a1_offer.sdp_without_ice_);
-    a2_->CreateAnswer(bconstraints, a1_offer.sdp_without_ice_,
+    a1_.CreateOffer(aconstraints, OFFER_AV, offerSdpCheck);
+    a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+    ParsedSDP a1_offer(a1_.offer());
+    a2_.SetRemote(TestObserver::OFFER, a1_offer.sdp_without_ice_);
+    a2_.CreateAnswer(bconstraints, a1_offer.sdp_without_ice_,
                      OFFER_AV|ANSWER_AV, answerSdpCheck);
-    a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-    ParsedSDP a2_answer(a2_->answer());
-    a1_->SetRemote(TestObserver::ANSWER, a2_answer.sdp_without_ice_);
+    a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
+    ParsedSDP a2_answer(a2_.answer());
+    a1_.SetRemote(TestObserver::ANSWER, a2_answer.sdp_without_ice_);
     // Now set the trickle ICE candidates
-    a1_->DoTrickleIceChrome(a2_answer);
-    a2_->DoTrickleIceChrome(a1_offer);
-    ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-    ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+    a1_.DoTrickleIceChrome(a2_answer);
+    a2_.DoTrickleIceChrome(a1_offer);
+    ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+    ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
   }
 
   void CreateOfferRemoveStream(sipcc::MediaConstraints& constraints,
                                uint32_t hints, uint32_t sdpCheck) {
-    EnsureInit();
     sipcc::MediaConstraints aconstraints;
     aconstraints.setBooleanConstraint("OfferToReceiveAudio", true, false);
     aconstraints.setBooleanConstraint("OfferToReceiveVideo", true, false);
-    a1_->CreateOffer(aconstraints, OFFER_AV, SHOULD_SENDRECV_AV );
-    a1_->CreateOfferRemoveStream(constraints, hints, sdpCheck);
+    a1_.CreateOffer(aconstraints, OFFER_AV, SHOULD_SENDRECV_AV );
+    a1_.CreateOfferRemoveStream(constraints, hints, sdpCheck);
   }
 
   void CreateOfferAudioOnly(sipcc::MediaConstraints& constraints,
                             uint32_t sdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(constraints, OFFER_AUDIO, sdpCheck);
+    a1_.CreateOffer(constraints, OFFER_AUDIO, sdpCheck);
   }
 
   void CreateOfferAddCandidate(sipcc::MediaConstraints& constraints,
                                const char * candidate, const char * mid,
                                unsigned short level, uint32_t sdpCheck) {
-    EnsureInit();
-    a1_->CreateOffer(constraints, OFFER_AV, sdpCheck);
-    a1_->AddIceCandidate(candidate, mid, level, true);
+    a1_.CreateOffer(constraints, OFFER_AV, sdpCheck);
+    a1_.AddIceCandidate(candidate, mid, level, true);
   }
 
   void AddIceCandidateEarly(const char * candidate, const char * mid,
                             unsigned short level) {
-    EnsureInit();
-    a1_->AddIceCandidate(candidate, mid, level, false);
+    a1_.AddIceCandidate(candidate, mid, level, false);
   }
 
   void CheckRtcpFbSdp(const std::string &sdp,
                       const std::set<std::string>& expected) {
 
     std::set<std::string>::const_iterator it;
 
     // Iterate through the list of expected feedback types and ensure
@@ -1476,23 +1383,22 @@ public:
                 << "'" << std::endl;
       ASSERT_NE(0U, expected.count(*it2));
     }
   }
 
   void TestRtcpFb(const std::set<std::string>& feedback,
                   uint32_t rtcpFbFlags,
                   VideoSessionConduit::FrameRequestType frameRequestMethod) {
-    EnsureInit();
     sipcc::MediaConstraints constraints;
 
-    a1_->CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
-    a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-
-    ParsedSDP sdpWrapper(a1_->offer());
+    a1_.CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
+    a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+
+    ParsedSDP sdpWrapper(a1_.offer());
 
     // Strip out any existing rtcp-fb lines
     sdpWrapper.DeleteAllLines("a=rtcp-fb:120");
 
     // Add rtcp-fb lines for the desired feedback types
     // We know that the video section is generated second (last),
     // so appending these to the end of the SDP has the desired effect.
     std::set<std::string>::const_iterator it;
@@ -1501,57 +1407,44 @@ public:
     }
 
     std::cout << "Modified SDP " << std::endl
               << indent(sdpWrapper.getSdp()) << std::endl;
 
     // Double-check that the offered SDP matches what we expect
     CheckRtcpFbSdp(sdpWrapper.getSdp(), feedback);
 
-    a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp());
-    a2_->CreateAnswer(constraints, sdpWrapper.getSdp(), OFFER_AV | ANSWER_AV);
-
-    CheckRtcpFbSdp(a2_->answer(), feedback);
-
-    a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-    a1_->SetRemote(TestObserver::ANSWER, a2_->answer());
-
-    ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-    ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
-
-    a1_->CloseSendStreams();
-    a1_->CloseReceiveStreams();
-    a2_->CloseSendStreams();
-    a2_->CloseReceiveStreams();
+    a2_.SetRemote(TestObserver::OFFER, sdpWrapper.getSdp());
+    a2_.CreateAnswer(constraints, sdpWrapper.getSdp(), OFFER_AV | ANSWER_AV);
+
+    CheckRtcpFbSdp(a2_.answer(), feedback);
+
+    a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
+    a1_.SetRemote(TestObserver::ANSWER, a2_.answer());
+
+    ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+    ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
+
+    a1_.CloseSendStreams();
+    a1_.CloseReceiveStreams();
+    a2_.CloseSendStreams();
+    a2_.CloseReceiveStreams();
 
     // Check caller video settings for remote pipeline
-    a1_->CheckMediaPipeline(0, 2, (fRtcpMux ? PIPELINE_RTCP_MUX : 0) |
+    a1_.CheckMediaPipeline(0, 2, (fRtcpMux ? PIPELINE_RTCP_MUX : 0) |
       PIPELINE_SEND | PIPELINE_VIDEO | rtcpFbFlags, frameRequestMethod);
 
     // Check callee video settings for remote pipeline
-    a2_->CheckMediaPipeline(0, 2, (fRtcpMux ? PIPELINE_RTCP_MUX : 0) |
+    a2_.CheckMediaPipeline(0, 2, (fRtcpMux ? PIPELINE_RTCP_MUX : 0) |
       PIPELINE_VIDEO | rtcpFbFlags, frameRequestMethod);
   }
 
-  void SetTestStunServer() {
-    stun_addr_ = TestStunServer::GetInstance()->addr();
-    stun_port_ = TestStunServer::GetInstance()->port();
-
-    TestStunServer::GetInstance()->SetActive(false);
-    TestStunServer::GetInstance()->SetResponseAddr(
-        kBogusSrflxAddress, kBogusSrflxPort);
-  }
-
  protected:
-  bool init_;
-  ScopedDeletePtr<SignalingAgent> a1_;  // Canonically "caller"
-  ScopedDeletePtr<SignalingAgent> a2_;  // Canonically "callee"
-  bool wait_for_gather_;
-  std::string stun_addr_;
-  uint16_t stun_port_;
+  SignalingAgent a1_;  // Canonically "caller"
+  SignalingAgent a2_;  // Canonically "callee"
 };
 
 TEST_F(SignalingTest, JustInit)
 {
 }
 
 TEST_F(SignalingTest, CreateSetOffer)
 {
@@ -1918,133 +1811,131 @@ TEST_F(SignalingTest, OfferAnswerDontAdd
 
 TEST_F(SignalingTest, FullCall)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswer(constraints, constraints, OFFER_AV | ANSWER_AV,
               true, SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
   // Check that we wrote a bunch of data
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  //ASSERT_GE(a2_->GetPacketsSent(0), 40);
-  //ASSERT_GE(a1_->GetPacketsReceived(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  //ASSERT_GE(a2_.GetPacketsSent(0), 40);
+  //ASSERT_GE(a1_.GetPacketsReceived(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 
   // Check the low-level media pipeline
   // for RTP and RTCP flows
   // The first Local pipeline gets stored at 0
-  a1_->CheckMediaPipeline(0, 0, fRtcpMux ?
+  a1_.CheckMediaPipeline(0, 0, fRtcpMux ?
     PIPELINE_LOCAL | PIPELINE_RTCP_MUX | PIPELINE_SEND :
     PIPELINE_LOCAL | PIPELINE_SEND);
 
   // The first Remote pipeline gets stored at 1
-  a2_->CheckMediaPipeline(0, 1, (fRtcpMux ?  PIPELINE_RTCP_MUX : 0));
+  a2_.CheckMediaPipeline(0, 1, (fRtcpMux ?  PIPELINE_RTCP_MUX : 0));
 }
 
 TEST_F(SignalingTest, FullCallAudioOnly)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswer(constraints, constraints, OFFER_AUDIO | ANSWER_AUDIO,
               true, SHOULD_SENDRECV_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
   // Check that we wrote a bunch of data
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  //ASSERT_GE(a2_->GetPacketsSent(0), 40);
-  //ASSERT_GE(a1_->GetPacketsReceived(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  //ASSERT_GE(a2_.GetPacketsSent(0), 40);
+  //ASSERT_GE(a1_.GetPacketsReceived(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 TEST_F(SignalingTest, FullCallVideoOnly)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswer(constraints, constraints, OFFER_VIDEO | ANSWER_VIDEO,
               true, SHOULD_SENDRECV_VIDEO, SHOULD_SENDRECV_VIDEO);
 
   // If we could check for video packets, we would wait for some to be written
   // here. Since we can't, we don't.
-  // ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-  //                 a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
+  // ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+  //                 a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
 
   // FIXME -- Ideally we would check that packets were sent
   // and received; however, the test driver setup does not
   // currently support sending/receiving with Fake_VideoStreamSource.
   //
   // Check that we wrote a bunch of data
-  // ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  //ASSERT_GE(a2_->GetPacketsSent(0), 40);
-  //ASSERT_GE(a1_->GetPacketsReceived(0), 40);
-  // ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  // ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  //ASSERT_GE(a2_.GetPacketsSent(0), 40);
+  //ASSERT_GE(a1_.GetPacketsReceived(0), 40);
+  // ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 TEST_F(SignalingTest, OfferModifiedAnswer)
 {
   sipcc::MediaConstraints constraints;
   OfferModifiedAnswer(constraints, constraints, SHOULD_SENDRECV_AUDIO,
                       SHOULD_SENDRECV_AUDIO);
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
 }
 
 TEST_F(SignalingTest, FullCallTrickle)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswerTrickle(constraints, constraints,
                      SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
 
   std::cerr << "ICE handshake completed" << std::endl;
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 // Offer answer with trickle but with chrome-style candidates
 TEST_F(SignalingTest, FullCallTrickleChrome)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswerTrickleChrome(constraints, constraints,
                            SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
 
   std::cerr << "ICE handshake completed" << std::endl;
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 // This test comes from Bug 810220
 TEST_F(SignalingTest, AudioOnlyG711Call)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   std::string offer =
     "v=0\r\n"
     "o=- 1 1 IN IP4 148.147.200.251\r\n"
     "s=-\r\n"
     "b=AS:64\r\n"
     "t=0 0\r\n"
     "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
@@ -2057,23 +1948,23 @@ TEST_F(SignalingTest, AudioOnlyG711Call)
     "a=rtpmap:126 telephone-event/8000\r\n"
     "a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
     "a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
     "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
     "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
     "a=sendrecv\r\n";
 
   std::cout << "Setting offer to:" << std::endl << indent(offer) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, offer);
+  a2_.SetRemote(TestObserver::OFFER, offer);
 
   std::cout << "Creating answer:" << std::endl;
-  a2_->CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO,
+  a2_.CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO,
                    DONT_CHECK_AUDIO | DONT_CHECK_VIDEO | DONT_CHECK_DATA);
 
-  std::string answer = a2_->answer();
+  std::string answer = a2_.answer();
 
   // They didn't offer opus, so our answer shouldn't include it.
   ASSERT_EQ(answer.find(" opus/"), std::string::npos);
 
   // They also didn't offer video or application
   ASSERT_EQ(answer.find("video"), std::string::npos);
   ASSERT_EQ(answer.find("application"), std::string::npos);
 
@@ -2084,18 +1975,16 @@ TEST_F(SignalingTest, AudioOnlyG711Call)
   // Double-check the directionality
   ASSERT_NE(answer.find("\r\na=sendrecv"), std::string::npos);
 
 }
 
 // This test comes from Bug814038
 TEST_F(SignalingTest, ChromeOfferAnswer)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
 
   // This is captured SDP from an early interop attempt with Chrome.
   std::string offer =
     "v=0\r\n"
     "o=- 1713781661 2 IN IP4 127.0.0.1\r\n"
     "s=-\r\n"
     "t=0 0\r\n"
@@ -2154,29 +2043,27 @@ TEST_F(SignalingTest, ChromeOfferAnswer)
     "a=rtcp-fb:100 ccm fir\r\n"
     "a=ssrc:3012607008 cname:KIXaNxUlU5DP3fVS\r\n"
     "a=ssrc:3012607008 msid:A5UL339RyGxT7zwgyF12BFqesxkmbUsaycp5 v0\r\n"
     "a=ssrc:3012607008 mslabel:A5UL339RyGxT7zwgyF12BFqesxkmbUsaycp5\r\n"
     "a=ssrc:3012607008 label:A5UL339RyGxT7zwgyF12BFqesxkmbUsaycp5v0\r\n";
 
 
   std::cout << "Setting offer to:" << std::endl << indent(offer) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, offer);
+  a2_.SetRemote(TestObserver::OFFER, offer);
 
   std::cout << "Creating answer:" << std::endl;
-  a2_->CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
-
-  std::string answer = a2_->answer();
+  a2_.CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
+
+  std::string answer = a2_.answer();
 }
 
 
 TEST_F(SignalingTest, FullChromeHandshake)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   constraints.setBooleanConstraint("OfferToReceiveAudio", true, false);
   constraints.setBooleanConstraint("OfferToReceiveVideo", true, false);
 
   std::string offer = "v=0\r\n"
       "o=- 3835809413 2 IN IP4 127.0.0.1\r\n"
       "s=-\r\n"
       "t=0 0\r\n"
@@ -2226,33 +2113,31 @@ TEST_F(SignalingTest, FullChromeHandshak
       "a=rtpmap:116 red/90000\r\n"
       "a=rtpmap:117 ulpfec/90000\r\n"
       "a=ssrc:3613537198 cname:G5I+Jxz4rcaq8IIK\r\n"
       "a=ssrc:3613537198 msid:ahheYQXHFU52slYMrWNtKUyHCtWZsOJgjlOH v0\r\n"
       "a=ssrc:3613537198 mslabel:ahheYQXHFU52slYMrWNtKUyHCtWZsOJgjlOH\r\n"
       "a=ssrc:3613537198 label:ahheYQXHFU52slYMrWNtKUyHCtWZsOJgjlOHv0\r\n";
 
   std::cout << "Setting offer to:" << std::endl << indent(offer) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, offer);
+  a2_.SetRemote(TestObserver::OFFER, offer);
 
   std::cout << "Creating answer:" << std::endl;
-  a2_->CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
+  a2_.CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
 
   std::cout << "Setting answer" << std::endl;
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer());
-
-  std::string answer = a2_->answer();
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
+
+  std::string answer = a2_.answer();
   ASSERT_NE(answer.find("111 opus/"), std::string::npos);
 }
 
 // Disabled pending resolution of bug 818640.
 TEST_F(SignalingTest, DISABLED_OfferAllDynamicTypes)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   std::string offer;
   for (int i = 96; i < 128; i++)
   {
     std::stringstream ss;
     ss << i;
     std::cout << "Trying dynamic pt = " << i << std::endl;
     offer =
@@ -2272,117 +2157,115 @@ TEST_F(SignalingTest, DISABLED_OfferAllD
       "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
       "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
       "a=sendrecv\r\n";
 
       /*
       std::cout << "Setting offer to:" << std::endl
                 << indent(offer) << std::endl;
       */
-      a2_->SetRemote(TestObserver::OFFER, offer);
+      a2_.SetRemote(TestObserver::OFFER, offer);
 
       //std::cout << "Creating answer:" << std::endl;
-      a2_->CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
-
-      std::string answer = a2_->answer();
+      a2_.CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
+
+      std::string answer = a2_.answer();
 
       ASSERT_NE(answer.find(ss.str() + " opus/"), std::string::npos);
   }
 
 }
 
 TEST_F(SignalingTest, OfferAnswerCheckDescriptions)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswer(constraints, constraints, OFFER_AV | ANSWER_AV, true,
               SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
 
   std::cout << "Caller's Local Description: " << std::endl
-            << indent(a1_->getLocalDescription()) << std::endl << std::endl;
+            << indent(a1_.getLocalDescription()) << std::endl << std::endl;
 
   std::cout << "Caller's Remote Description: " << std::endl
-            << indent(a1_->getRemoteDescription()) << std::endl << std::endl;
+            << indent(a1_.getRemoteDescription()) << std::endl << std::endl;
 
   std::cout << "Callee's Local Description: " << std::endl
-            << indent(a2_->getLocalDescription()) << std::endl << std::endl;
+            << indent(a2_.getLocalDescription()) << std::endl << std::endl;
 
   std::cout << "Callee's Remote Description: " << std::endl
-            << indent(a2_->getRemoteDescription()) << std::endl << std::endl;
-
-  ASSERT_EQ(a1_->getLocalDescription(),a2_->getRemoteDescription());
-  ASSERT_EQ(a2_->getLocalDescription(),a1_->getRemoteDescription());
+            << indent(a2_.getRemoteDescription()) << std::endl << std::endl;
+
+  ASSERT_EQ(a1_.getLocalDescription(),a2_.getRemoteDescription());
+  ASSERT_EQ(a2_.getLocalDescription(),a1_.getRemoteDescription());
 }
 
 TEST_F(SignalingTest, CheckTrickleSdpChange)
 {
   sipcc::MediaConstraints constraints;
   OfferAnswerTrickle(constraints, constraints,
                      SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
   std::cerr << "ICE handshake completed" << std::endl;
 
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
 
   std::cout << "Caller's Local Description: " << std::endl
-            << indent(a1_->getLocalDescription()) << std::endl << std::endl;
+            << indent(a1_.getLocalDescription()) << std::endl << std::endl;
 
   std::cout << "Caller's Remote Description: " << std::endl
-            << indent(a1_->getRemoteDescription()) << std::endl << std::endl;
+            << indent(a1_.getRemoteDescription()) << std::endl << std::endl;
 
   std::cout << "Callee's Local Description: " << std::endl
-            << indent(a2_->getLocalDescription()) << std::endl << std::endl;
+            << indent(a2_.getLocalDescription()) << std::endl << std::endl;
 
   std::cout << "Callee's Remote Description: " << std::endl
-            << indent(a2_->getRemoteDescription()) << std::endl << std::endl;
-
-  ASSERT_NE(a1_->getLocalDescription().find("\r\na=candidate"),
+            << indent(a2_.getRemoteDescription()) << std::endl << std::endl;
+
+  ASSERT_NE(a1_.getLocalDescription().find("\r\na=candidate"),
             std::string::npos);
-  ASSERT_NE(a1_->getRemoteDescription().find("\r\na=candidate"),
+  ASSERT_NE(a1_.getRemoteDescription().find("\r\na=candidate"),
             std::string::npos);
-  ASSERT_NE(a2_->getLocalDescription().find("\r\na=candidate"),
+  ASSERT_NE(a2_.getLocalDescription().find("\r\na=candidate"),
             std::string::npos);
-  ASSERT_NE(a2_->getRemoteDescription().find("\r\na=candidate"),
+  ASSERT_NE(a2_.getRemoteDescription().find("\r\na=candidate"),
             std::string::npos);
   /* TODO (abr): These checks aren't quite right, since trickle ICE
    * can easily result in SDP that is semantically identical but
    * varies syntactically (in particularly, the ordering of attributes
    * withing an m-line section can be different). This needs to be updated
    * to be a semantic comparision between the SDP. Currently, these checks
    * will fail whenever we add any other attributes to the SDP, such as
    * RTCP MUX or RTCP feedback.
-  ASSERT_EQ(a1_->getLocalDescription(),a2_->getRemoteDescription());
-  ASSERT_EQ(a2_->getLocalDescription(),a1_->getRemoteDescription());
+  ASSERT_EQ(a1_.getLocalDescription(),a2_.getRemoteDescription());
+  ASSERT_EQ(a2_.getLocalDescription(),a1_.getRemoteDescription());
   */
 }
 
 TEST_F(SignalingTest, ipAddrAnyOffer)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   std::string offer =
     "v=0\r\n"
     "o=- 1 1 IN IP4 127.0.0.1\r\n"
     "s=-\r\n"
     "b=AS:64\r\n"
     "t=0 0\r\n"
     "a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
       "7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
     "m=audio 9000 RTP/AVP 99\r\n"
     "c=IN IP4 0.0.0.0\r\n"
     "a=rtpmap:99 opus/48000/2\r\n"
     "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
     "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
     "a=sendrecv\r\n";
 
-    a2_->SetRemote(TestObserver::OFFER, offer);
-    ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateSuccess);
-    a2_->CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
-    ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateSuccess);
-    std::string answer = a2_->answer();
+    a2_.SetRemote(TestObserver::OFFER, offer);
+    ASSERT_TRUE(a2_.pObserver->state == TestObserver::stateSuccess);
+    a2_.CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO);
+    ASSERT_TRUE(a2_.pObserver->state == TestObserver::stateSuccess);
+    std::string answer = a2_.answer();
     ASSERT_NE(answer.find("a=sendrecv"), std::string::npos);
 }
 
 static void CreateSDPForBigOTests(std::string& offer, const char *number) {
   offer =
     "v=0\r\n"
     "o=- ";
   offer += number;
@@ -2399,250 +2282,168 @@ static void CreateSDPForBigOTests(std::s
     "a=rtpmap:99 opus/48000/2\r\n"
     "a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
     "a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
     "a=sendrecv\r\n";
 }
 
 TEST_F(SignalingTest, BigOValues)
 {
-  EnsureInit();
-
   std::string offer;
 
   CreateSDPForBigOTests(offer, "12345678901234567");
 
-  a2_->SetRemote(TestObserver::OFFER, offer);
-  ASSERT_EQ(a2_->pObserver->state, TestObserver::stateSuccess);
+  a2_.SetRemote(TestObserver::OFFER, offer);
+  ASSERT_EQ(a2_.pObserver->state, TestObserver::stateSuccess);
 }
 
 TEST_F(SignalingTest, BigOValuesExtraChars)
 {
-  EnsureInit();
-
   std::string offer;
 
   CreateSDPForBigOTests(offer, "12345678901234567FOOBAR");
 
   // The signaling state will remain "stable" because the unparsable
   // SDP leads to a failure in SetRemoteDescription.
-  a2_->SetRemote(TestObserver::OFFER, offer, true,
+  a2_.SetRemote(TestObserver::OFFER, offer, true,
                 sipcc::PeerConnectionImpl::kSignalingStable);
-  ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateError);
+  ASSERT_TRUE(a2_.pObserver->state == TestObserver::stateError);
 }
 
 TEST_F(SignalingTest, BigOValuesTooBig)
 {
-  EnsureInit();
-
   std::string offer;
 
   CreateSDPForBigOTests(offer, "18446744073709551615");
 
   // The signaling state will remain "stable" because the unparsable
   // SDP leads to a failure in SetRemoteDescription.
-  a2_->SetRemote(TestObserver::OFFER, offer, true,
+  a2_.SetRemote(TestObserver::OFFER, offer, true,
                 sipcc::PeerConnectionImpl::kSignalingStable);
-  ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateError);
+  ASSERT_TRUE(a2_.pObserver->state == TestObserver::stateError);
 }
 
 TEST_F(SignalingTest, SetLocalAnswerInStable)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // The signaling state will remain "stable" because the
   // SetLocalDescription call fails.
-  a1_->SetLocal(TestObserver::ANSWER, a1_->offer(), true,
+  a1_.SetLocal(TestObserver::ANSWER, a1_.offer(), true,
                sipcc::PeerConnectionImpl::kSignalingStable);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 TEST_F(SignalingTest, SetRemoteAnswerInStable) {
-  EnsureInit();
-
   // The signaling state will remain "stable" because the
   // SetRemoteDescription call fails.
-  a1_->SetRemote(TestObserver::ANSWER, strSampleSdpAudioVideoNoIce, true,
+  a1_.SetRemote(TestObserver::ANSWER, strSampleSdpAudioVideoNoIce, true,
                 sipcc::PeerConnectionImpl::kSignalingStable);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 TEST_F(SignalingTest, SetLocalAnswerInHaveLocalOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
 
   // The signaling state will remain "have-local-offer" because the
   // SetLocalDescription call fails.
-  a1_->SetLocal(TestObserver::ANSWER, a1_->offer(), true,
+  a1_.SetLocal(TestObserver::ANSWER, a1_.offer(), true,
                sipcc::PeerConnectionImpl::kSignalingHaveLocalOffer);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 TEST_F(SignalingTest, SetRemoteOfferInHaveLocalOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
 
   // The signaling state will remain "have-local-offer" because the
   // SetRemoteDescription call fails.
-  a1_->SetRemote(TestObserver::OFFER, a1_->offer(), true,
+  a1_.SetRemote(TestObserver::OFFER, a1_.offer(), true,
                 sipcc::PeerConnectionImpl::kSignalingHaveLocalOffer);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 TEST_F(SignalingTest, SetLocalOfferInHaveRemoteOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a2_->SetRemote(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
+  a2_.SetRemote(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a2_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
 
   // The signaling state will remain "have-remote-offer" because the
   // SetLocalDescription call fails.
-  a2_->SetLocal(TestObserver::OFFER, a1_->offer(), true,
+  a2_.SetLocal(TestObserver::OFFER, a1_.offer(), true,
                sipcc::PeerConnectionImpl::kSignalingHaveRemoteOffer);
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
+  ASSERT_EQ(a2_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 TEST_F(SignalingTest, SetRemoteAnswerInHaveRemoteOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a2_->SetRemote(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
+  a2_.SetRemote(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a2_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
 
   // The signaling state will remain "have-remote-offer" because the
   // SetRemoteDescription call fails.
-  a2_->SetRemote(TestObserver::ANSWER, a1_->offer(), true,
+  a2_.SetRemote(TestObserver::ANSWER, a1_.offer(), true,
                sipcc::PeerConnectionImpl::kSignalingHaveRemoteOffer);
-  ASSERT_EQ(a2_->pObserver->lastStatusCode,
+  ASSERT_EQ(a2_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 // Disabled until the spec adds a failure callback to addStream
 TEST_F(SignalingTest, DISABLED_AddStreamInHaveLocalOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
-  a1_->AddStream();
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.AddStream();
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 // Disabled until the spec adds a failure callback to removeStream
 TEST_F(SignalingTest, DISABLED_RemoveStreamInHaveLocalOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
-  a1_->RemoveLastStreamAdded();
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.RemoveLastStreamAdded();
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
 TEST_F(SignalingTest, AddCandidateInHaveLocalOffer) {
   sipcc::MediaConstraints constraints;
   CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer());
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer());
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kNoError);
-  a1_->AddIceCandidate(strSampleCandidate.c_str(),
+  a1_.AddIceCandidate(strSampleCandidate.c_str(),
                       strSampleMid.c_str(), nSamplelevel, false);
-  ASSERT_EQ(a1_->pObserver->lastStatusCode,
+  ASSERT_EQ(a1_.pObserver->lastStatusCode,
             sipcc::PeerConnectionImpl::kInvalidState);
 }
 
-TEST_F(SignalingAgentTest, CreateOffer) {
-  CreateAgent();
-  sipcc::MediaConstraints constraints;
-  agent(0)->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  PR_Sleep(20000);
-}
-
-TEST_F(SignalingAgentTest, CreateOfferTrickleTestServer) {
-  TestStunServer::GetInstance()->SetActive(false);
-  TestStunServer::GetInstance()->SetResponseAddr(
-      kBogusSrflxAddress, kBogusSrflxPort);
-
-  CreateAgent(
-      TestStunServer::GetInstance()->addr(),
-      TestStunServer::GetInstance()->port(),
-      false);
-
-  sipcc::MediaConstraints constraints;
-  agent(0)->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-
-  // Verify that the bogus addr is not there.
-  ASSERT_FALSE(agent(0)->OfferContains(kBogusSrflxAddress));
-
-  // Now enable the STUN server.
-  TestStunServer::GetInstance()->SetActive(true);
-  agent(0)->WaitForGather();
-
-  // There shouldn't be any candidates until SetLocal.
-  ASSERT_EQ(0U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
-
-  // Verify that the candidates appear in the offer.
-  size_t match;
-  match = agent(0)->getLocalDescription().find(kBogusSrflxAddress);
-  ASSERT_LT(0U, match);
-}
-
-TEST_F(SignalingAgentTest, CreateOfferSetLocalTrickleTestServer) {
-  TestStunServer::GetInstance()->SetActive(false);
-  TestStunServer::GetInstance()->SetResponseAddr(
-      kBogusSrflxAddress, kBogusSrflxPort);
-
-  CreateAgent(
-      TestStunServer::GetInstance()->addr(),
-      TestStunServer::GetInstance()->port(),
-      false);
-
-  sipcc::MediaConstraints constraints;
-  agent(0)->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-
-  // Verify that the bogus addr is not there.
-  ASSERT_FALSE(agent(0)->OfferContains(kBogusSrflxAddress));
-
-  // Now enable the STUN server.
-  TestStunServer::GetInstance()->SetActive(true);
-  agent(0)->WaitForGather();
-
-  // There shouldn't be any candidates until SetLocal.
-  ASSERT_EQ(0U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
-
-  agent(0)->SetLocal(TestObserver::OFFER, agent(0)->offer());
-  PR_Sleep(1000); // Give time for the message queues.
-
-  // Verify that we got our candidates.
-  ASSERT_EQ(2U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
-
-  // Verify that the candidates appear in the offer.
-  size_t match;
-  match = agent(0)->getLocalDescription().find(kBogusSrflxAddress);
-  ASSERT_LT(0U, match);
-}
-
-
 
 TEST_F(SignalingAgentTest, CreateUntilFailThenWait) {
   int i;
 
   for (i=0; ; i++) {
     if (!CreateAgent())
       break;
     std::cerr << "Created agent " << i << std::endl;
@@ -2651,24 +2452,21 @@ TEST_F(SignalingAgentTest, CreateUntilFa
   PR_Sleep(10000);  // Wait to see if we crash
 }
 
 // Test for bug 856433.
 TEST_F(SignalingAgentTest, CreateNoInit) {
   CreateAgentNoInit();
 }
 
-
 /*
  * Test for Bug 843595
  */
 TEST_F(SignalingTest, missingUfrag)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   std::string offer =
     "v=0\r\n"
     "o=Mozilla-SIPUA 2208 0 IN IP4 0.0.0.0\r\n"
     "s=SIP Call\r\n"
     "t=0 0\r\n"
     "a=ice-pwd:4450d5a4a5f097855c16fa079893be18\r\n"
     "a=fingerprint:sha-256 23:9A:2E:43:94:42:CF:46:68:FC:62:F9:F4:48:61:DB:"
@@ -2701,131 +2499,126 @@ TEST_F(SignalingTest, missingUfrag)
     "m=application 54054 DTLS/SCTP 5000 \r\n"
     "c=IN IP4 77.9.79.167\r\n"
     "a=fmtp:HuRUu]Dtcl\\zM,7(OmEU%O$gU]x/z\tD protocol=webrtc-datachannel;"
       "streams=16\r\n"
     "a=sendrecv\r\n";
 
   // Need to create an offer, since that's currently required by our
   // FSM. This may change in the future.
-  a1_->CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
-  a1_->SetLocal(TestObserver::OFFER, offer, true);
+  a1_.CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
+  a1_.SetLocal(TestObserver::OFFER, offer, true);
   // We now detect the missing ICE parameters at SetRemoteDescription
-  a2_->SetRemote(TestObserver::OFFER, offer, true,
+  a2_.SetRemote(TestObserver::OFFER, offer, true,
     sipcc::PeerConnectionImpl::kSignalingStable);
-  ASSERT_TRUE(a2_->pObserver->state == TestObserver::stateError);
+  ASSERT_TRUE(a2_.pObserver->state == TestObserver::stateError);
 }
 
 TEST_F(SignalingTest, AudioOnlyCalleeNoRtcpMux)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
-  ParsedSDP sdpWrapper(a1_->offer());
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer(), false);
+  ParsedSDP sdpWrapper(a1_.offer());
   sdpWrapper.DeleteLine("a=rtcp-mux");
   std::cout << "Modified SDP " << std::endl
             << indent(sdpWrapper.getSdp()) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
-  a2_->CreateAnswer(constraints, sdpWrapper.getSdp(),
+  a2_.SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
+  a2_.CreateAnswer(constraints, sdpWrapper.getSdp(),
     OFFER_AUDIO | ANSWER_AUDIO);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
+  a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
 
   // Answer should not have a=rtcp-mux
-  ASSERT_EQ(a2_->getLocalDescription().find("\r\na=rtcp-mux"),
+  ASSERT_EQ(a2_.getLocalDescription().find("\r\na=rtcp-mux"),
             std::string::npos);
 
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 
   // Check the low-level media pipeline
   // for RTP and RTCP flows
   // The first Local pipeline gets stored at 0
-  a1_->CheckMediaPipeline(0, 0, PIPELINE_LOCAL | PIPELINE_SEND);
+  a1_.CheckMediaPipeline(0, 0, PIPELINE_LOCAL | PIPELINE_SEND);
 
   // The first Remote pipeline gets stored at 1
-  a2_->CheckMediaPipeline(0, 1, 0);
+  a2_.CheckMediaPipeline(0, 1, 0);
 }
 
 TEST_F(SignalingTest, FullCallAudioNoMuxVideoMux)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
 
-  a1_->CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
-  a1_->SetLocal(TestObserver::OFFER, a1_->offer(), false);
-  ParsedSDP sdpWrapper(a1_->offer());
+  a1_.CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
+  a1_.SetLocal(TestObserver::OFFER, a1_.offer(), false);
+  ParsedSDP sdpWrapper(a1_.offer());
   sdpWrapper.DeleteLine("a=rtcp-mux");
   std::cout << "Modified SDP " << std::endl
             << indent(sdpWrapper.getSdp()) << std::endl;
-  a2_->SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
-  a2_->CreateAnswer(constraints, sdpWrapper.getSdp(), OFFER_AV | ANSWER_AV);
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
+  a2_.SetRemote(TestObserver::OFFER, sdpWrapper.getSdp(), false);
+  a2_.CreateAnswer(constraints, sdpWrapper.getSdp(), OFFER_AV | ANSWER_AV);
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
+  a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
 
   // Answer should have only one a=rtcp-mux line
-  size_t match = a2_->getLocalDescription().find("\r\na=rtcp-mux");
+  size_t match = a2_.getLocalDescription().find("\r\na=rtcp-mux");
   if (fRtcpMux) {
     ASSERT_NE(match, std::string::npos);
-    match = a2_->getLocalDescription().find("\r\na=rtcp-mux", match + 1);
+    match = a2_.getLocalDescription().find("\r\na=rtcp-mux", match + 1);
   }
   ASSERT_EQ(match, std::string::npos);
 
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 
   // Check the low-level media pipeline
   // for RTP and RTCP flows
   // The first Local pipeline gets stored at 0
-  a1_->CheckMediaPipeline(0, 0, PIPELINE_LOCAL | PIPELINE_SEND);
+  a1_.CheckMediaPipeline(0, 0, PIPELINE_LOCAL | PIPELINE_SEND);
 
   // Now check video mux.
-  a1_->CheckMediaPipeline(0, 1,
+  a1_.CheckMediaPipeline(0, 1,
     PIPELINE_LOCAL | (fRtcpMux ? PIPELINE_RTCP_MUX : 0) | PIPELINE_SEND |
     PIPELINE_VIDEO);
 
   // The first Remote pipeline gets stored at 1
-  a2_->CheckMediaPipeline(0, 1, 0);
+  a2_.CheckMediaPipeline(0, 1, 0);
 
   // Now check video mux.
-  a2_->CheckMediaPipeline(0, 2, (fRtcpMux ?  PIPELINE_RTCP_MUX : 0) |
+  a2_.CheckMediaPipeline(0, 2, (fRtcpMux ?  PIPELINE_RTCP_MUX : 0) |
     PIPELINE_VIDEO | PIPELINE_RTCP_NACK, VideoSessionConduit::FrameRequestPli);
 }
 
 TEST_F(SignalingTest, RtcpFbInOffer)
 {
-  EnsureInit();
   sipcc::MediaConstraints constraints;
-  a1_->CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
+  a1_.CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV);
   const char *expected[] = { "nack", "nack pli", "ccm fir" };
-  CheckRtcpFbSdp(a1_->offer(), ARRAY_TO_SET(std::string, expected));
+  CheckRtcpFbSdp(a1_.offer(), ARRAY_TO_SET(std::string, expected));
 }
 
 TEST_F(SignalingTest, RtcpFbInAnswer)
 {
   const char *feedbackTypes[] = { "nack", "nack pli", "ccm fir" };
   TestRtcpFb(ARRAY_TO_SET(std::string, feedbackTypes),
              PIPELINE_RTCP_NACK,
              VideoSessionConduit::FrameRequestPli);
@@ -2886,347 +2679,295 @@ TEST_F(SignalingTest, RtcpFbNoFeedback)
              0,
              VideoSessionConduit::FrameRequestNone);
 }
 
 // In this test we will change the offer SDP's a=setup value
 // from actpass to passive.  This will make the answer do active.
 TEST_F(SignalingTest, AudioCallForceDtlsRoles)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   size_t match;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // By default the offer should give actpass
-  std::string offer(a1_->offer());
+  std::string offer(a1_.offer());
   match = offer.find("\r\na=setup:actpass");
   ASSERT_NE(match, std::string::npos);
   // Now replace the actpass with passive so that the answer will
   // return active
   offer.replace(match, strlen("\r\na=setup:actpass"),
     "\r\na=setup:passive");
   std::cout << "Modified SDP " << std::endl
             << indent(offer) << std::endl;
 
-  a1_->SetLocal(TestObserver::OFFER, offer.c_str(), false);
-  a2_->SetRemote(TestObserver::OFFER, offer.c_str(), false);
-  a2_->CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
+  a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
+  a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
 
   // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
+  std::string answer(a2_.answer());
   match = answer.find("\r\na=setup:active");
   ASSERT_NE(match, std::string::npos);
 
   // This should setup the DTLS with the same roles
   // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
+  a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
+
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 // In this test we will change the offer SDP's a=setup value
 // from actpass to active.  This will make the answer do passive
 TEST_F(SignalingTest, AudioCallReverseDtlsRoles)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   size_t match;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // By default the offer should give actpass
-  std::string offer(a1_->offer());
+  std::string offer(a1_.offer());
   match = offer.find("\r\na=setup:actpass");
   ASSERT_NE(match, std::string::npos);
   // Now replace the actpass with active so that the answer will
   // return passive
   offer.replace(match, strlen("\r\na=setup:actpass"),
     "\r\na=setup:active");
   std::cout << "Modified SDP " << std::endl
             << indent(offer) << std::endl;
 
-  a1_->SetLocal(TestObserver::OFFER, offer.c_str(), false);
-  a2_->SetRemote(TestObserver::OFFER, offer.c_str(), false);
-  a2_->CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
+  a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
+  a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
 
   // Now the answer should contain a=setup:passive
-  std::string answer(a2_->answer());
+  std::string answer(a2_.answer());
   match = answer.find("\r\na=setup:passive");
   ASSERT_NE(match, std::string::npos);
 
   // This should setup the DTLS with the opposite roles
   // than the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
+  a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
+
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 // In this test we will change the answer SDP's a=setup value
 // from active to passive.  This will make both sides do
 // active and should not connect.
 TEST_F(SignalingTest, AudioCallMismatchDtlsRoles)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   size_t match;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // By default the offer should give actpass
-  std::string offer(a1_->offer());
+  std::string offer(a1_.offer());
   match = offer.find("\r\na=setup:actpass");
   ASSERT_NE(match, std::string::npos);
-  a1_->SetLocal(TestObserver::OFFER, offer.c_str(), false);
-  a2_->SetRemote(TestObserver::OFFER, offer.c_str(), false);
-  a2_->CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
+  a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
+  a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
 
   // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
+  std::string answer(a2_.answer());
   match = answer.find("\r\na=setup:active");
   ASSERT_NE(match, std::string::npos);
 
   // Now replace the active with passive so that the offerer will
   // also do active.
   answer.replace(match, strlen("\r\na=setup:active"),
     "\r\na=setup:passive");
   std::cout << "Modified SDP " << std::endl
             << indent(answer) << std::endl;
 
   // This should setup the DTLS with both sides playing active
-  a2_->SetLocal(TestObserver::ANSWER, answer.c_str(), false);
-  a1_->SetRemote(TestObserver::ANSWER, answer.c_str(), false);
-
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  a2_.SetLocal(TestObserver::ANSWER, answer.c_str(), false);
+  a1_.SetRemote(TestObserver::ANSWER, answer.c_str(), false);
+
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Not using ASSERT_TRUE_WAIT here because we expect failure
   PR_Sleep(kDefaultTimeout * 2); // Wait for some data to get written
 
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
   // In this case we should receive nothing.
-  ASSERT_EQ(a2_->GetPacketsReceived(0), 0);
+  ASSERT_EQ(a2_.GetPacketsReceived(0), 0);
 }
 
 // In this test we will change the offer SDP's a=setup value
 // from actpass to garbage.  It should ignore the garbage value
 // and respond with setup:active
 TEST_F(SignalingTest, AudioCallGarbageSetup)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   size_t match;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // By default the offer should give actpass
-  std::string offer(a1_->offer());
+  std::string offer(a1_.offer());
   match = offer.find("\r\na=setup:actpass");
   ASSERT_NE(match, std::string::npos);
   // Now replace the actpass with a garbage value
   offer.replace(match, strlen("\r\na=setup:actpass"),
     "\r\na=setup:G4rb4g3V4lu3");
   std::cout << "Modified SDP " << std::endl
             << indent(offer) << std::endl;
 
-  a1_->SetLocal(TestObserver::OFFER, offer.c_str(), false);
-  a2_->SetRemote(TestObserver::OFFER, offer.c_str(), false);
-  a2_->CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
+  a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
+  a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
 
   // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
+  std::string answer(a2_.answer());
   match = answer.find("\r\na=setup:active");
   ASSERT_NE(match, std::string::npos);
 
   // This should setup the DTLS with the same roles
   // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
+  a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
+
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 // In this test we will change the offer SDP to remove the
 // a=setup line.  Answer should respond with a=setup:active.
 TEST_F(SignalingTest, AudioCallOfferNoSetupOrConnection)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   size_t match;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // By default the offer should give setup:actpass
-  std::string offer(a1_->offer());
+  std::string offer(a1_.offer());
   match = offer.find("\r\na=setup:actpass");
   ASSERT_NE(match, std::string::npos);
   // Remove the a=setup line
   offer.replace(match, strlen("\r\na=setup:actpass"), "");
   std::cout << "Modified SDP " << std::endl
             << indent(offer) << std::endl;
 
-  a1_->SetLocal(TestObserver::OFFER, offer.c_str(), false);
-  a2_->SetRemote(TestObserver::OFFER, offer.c_str(), false);
-  a2_->CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
+  a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
+  a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
 
   // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
+  std::string answer(a2_.answer());
   match = answer.find("\r\na=setup:active");
   ASSERT_NE(match, std::string::npos);
 
   // This should setup the DTLS with the same roles
   // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, a2_->answer(), false);
-  a1_->SetRemote(TestObserver::ANSWER, a2_->answer(), false);
-
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
+  a2_.SetLocal(TestObserver::ANSWER, a2_.answer(), false);
+  a1_.SetRemote(TestObserver::ANSWER, a2_.answer(), false);
+
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 // In this test we will change the answer SDP to remove the
 // a=setup line.  ICE should still connect since active will
 // be assumed.
 TEST_F(SignalingTest, AudioCallAnswerNoSetupOrConnection)
 {
-  EnsureInit();
-
   sipcc::MediaConstraints constraints;
   size_t match;
 
-  a1_->CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
+  a1_.CreateOffer(constraints, OFFER_AUDIO, SHOULD_SENDRECV_AUDIO);
 
   // By default the offer should give setup:actpass
-  std::string offer(a1_->offer());
+  std::string offer(a1_.offer());
   match = offer.find("\r\na=setup:actpass");
   ASSERT_NE(match, std::string::npos);
 
-  a1_->SetLocal(TestObserver::OFFER, offer.c_str(), false);
-  a2_->SetRemote(TestObserver::OFFER, offer.c_str(), false);
-  a2_->CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
+  a1_.SetLocal(TestObserver::OFFER, offer.c_str(), false);
+  a2_.SetRemote(TestObserver::OFFER, offer.c_str(), false);
+  a2_.CreateAnswer(constraints, offer.c_str(), OFFER_AUDIO | ANSWER_AUDIO);
 
   // Now the answer should contain a=setup:active
-  std::string answer(a2_->answer());
+  std::string answer(a2_.answer());
   match = answer.find("\r\na=setup:active");
   ASSERT_NE(match, std::string::npos);
   // Remove the a=setup line
   answer.replace(match, strlen("\r\na=setup:active"), "");
   std::cout << "Modified SDP " << std::endl
             << indent(answer) << std::endl;
 
   // This should setup the DTLS with the same roles
   // as the regular tests above.
-  a2_->SetLocal(TestObserver::ANSWER, answer, false);
-  a1_->SetRemote(TestObserver::ANSWER, answer, false);
-
-  ASSERT_TRUE_WAIT(a1_->IceCompleted() == true, kDefaultTimeout);
-  ASSERT_TRUE_WAIT(a2_->IceCompleted() == true, kDefaultTimeout);
-
-  // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
-}
-
-
-TEST_F(SignalingTest, FullCallRealTrickle)
-{
-  wait_for_gather_ = false;
-
-  sipcc::MediaConstraints constraints;
-  OfferAnswer(constraints, constraints, OFFER_AV | ANSWER_AV,
-              true, SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
+  a2_.SetLocal(TestObserver::ANSWER, answer, false);
+  a1_.SetRemote(TestObserver::ANSWER, answer, false);
+
+  ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
+  ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
 
   // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
-}
-
-TEST_F(SignalingTest, FullCallRealTrickleTestServer)
-{
-  wait_for_gather_ = false;
-  SetTestStunServer();
-
-  sipcc::MediaConstraints constraints;
-  OfferAnswer(constraints, constraints, OFFER_AV | ANSWER_AV,
-              true, SHOULD_SENDRECV_AV, SHOULD_SENDRECV_AV);
-
-  TestStunServer::GetInstance()->SetActive(true);
-
-  // Wait for some data to get written
-  ASSERT_TRUE_WAIT(a1_->GetPacketsSent(0) >= 40 &&
-                   a2_->GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
-
-  a1_->CloseSendStreams();
-  a2_->CloseReceiveStreams();
-  ASSERT_GE(a1_->GetPacketsSent(0), 40);
-  ASSERT_GE(a2_->GetPacketsReceived(0), 40);
+  ASSERT_TRUE_WAIT(a1_.GetPacketsSent(0) >= 40 &&
+                   a2_.GetPacketsReceived(0) >= 40, kDefaultTimeout * 2);
+
+  a1_.CloseSendStreams();
+  a2_.CloseReceiveStreams();
+
+  ASSERT_GE(a1_.GetPacketsSent(0), 40);
+  ASSERT_GE(a2_.GetPacketsReceived(0), 40);
 }
 
 } // End namespace test.
 
 bool is_color_terminal(const char *terminal) {
   if (!terminal) {
     return false;
   }
@@ -3244,67 +2985,45 @@ bool is_color_terminal(const char *termi
     if (!strcmp(terminal, *p)) {
       return true;
     }
     p++;
   }
   return false;
 }
 
-static std::string get_environment(const char *name) {
-  char *value = getenv(name);
-
-  if (!value)
-    return "";
-
-  return value;
-}
-
 int main(int argc, char **argv) {
 
   // This test can cause intermittent oranges on the builders
   CHECK_ENVIRONMENT_FLAG("MOZ_WEBRTC_TESTS")
 
   if (isatty(STDOUT_FILENO) && is_color_terminal(getenv("TERM"))) {
     std::string ansiMagenta = "\x1b[35m";
     std::string ansiCyan = "\x1b[36m";
     std::string ansiColorOff = "\x1b[0m";
     callerName = ansiCyan + callerName + ansiColorOff;
     calleeName = ansiMagenta + calleeName + ansiColorOff;
   }
 
-  std::string tmp = get_environment("STUN_SERVER_ADDRESS");
-  if (tmp != "")
-    g_stun_server_address = tmp;
-
-  tmp = get_environment("STUN_SERVER_PORT");
-  if (tmp != "")
-      g_stun_server_port = atoi(tmp.c_str());
-
   test_utils = new MtransportTestUtils();
   NSS_NoDB_Init(NULL);
   NSS_SetDomesticPolicy();
 
   ::testing::InitGoogleTest(&argc, argv);
 
   for(int i=0; i<argc; i++) {
     if (!strcmp(argv[i],"-t")) {
       kDefaultTimeout = 20000;
     }
   }
 
-  test_utils->sts_target()->Dispatch(
-    WrapRunnableNM(&TestStunServer::GetInstance), NS_DISPATCH_SYNC);
-
   ::testing::AddGlobalTestEnvironment(new test::SignalingEnvironment);
   int result = RUN_ALL_TESTS();
 
-  test_utils->sts_target()->Dispatch(
-    WrapRunnableNM(&TestStunServer::ShutdownInstance), NS_DISPATCH_SYNC);
-
   // Because we don't initialize on the main thread, we can't register for
   // XPCOM shutdown callbacks (where the context is usually shut down) --
   // so we need to explictly destroy the context.
   sipcc::PeerConnectionCtx::Destroy();
   delete test_utils;
 
+
   return result;
 }
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -215,17 +215,16 @@ pref("media.apple.mp3.enabled", true);
 pref("media.navigator.enabled", true);
 pref("media.navigator.video.default_width",640);
 pref("media.navigator.video.default_height",480);
 pref("media.navigator.video.default_fps",30);
 pref("media.navigator.video.default_minfps",10);
 pref("media.peerconnection.enabled", true);
 pref("media.navigator.permission.disabled", false);
 pref("media.peerconnection.default_iceservers", "[{\"url\": \"stun:23.21.150.121\"}]");
-pref("media.peerconnection.trickle_ice", true);
 pref("media.peerconnection.use_document_iceservers", true);
 // These values (aec, agc, and noice) are from media/webrtc/trunk/webrtc/common_types.h
 // kXxxUnchanged = 0, kXxxDefault = 1, and higher values are specific to each 
 // setting (for Xxx = Ec, Agc, or Ns).  Defaults are all set to kXxxDefault here.
 pref("media.peerconnection.turn.disable", false);
 pref("media.peerconnection.aec_enabled", true);
 pref("media.peerconnection.aec", 1);
 pref("media.peerconnection.agc_enabled", false);