Bug 1342523 - Part 1: Clean up how controlling/offerer is specified. r=drno
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 24 Feb 2017 14:05:27 -0600
changeset 346395 5074cc34731dffa58704a041540a46c2a397aba6
parent 346394 62163a007dd51b25d66592df89d23ba10a811f9f
child 346396 d99df97e4115adbc20a76be02407b74a508565bf
push id87795
push userkwierso@gmail.com
push dateWed, 08 Mar 2017 00:45:17 +0000
treeherdermozilla-inbound@fed3397d5988 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1342523
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1342523 - Part 1: Clean up how controlling/offerer is specified. r=drno MozReview-Commit-ID: D8qPAPUZC1J
media/mtransport/nricectx.cpp
media/mtransport/nricectx.h
media/mtransport/nricectxhandler.cpp
media/mtransport/nricectxhandler.h
media/mtransport/test/ice_unittest.cpp
media/mtransport/test/transport_unittests.cpp
media/mtransport/third_party/nICEr/src/ice/ice_ctx.h
media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
media/webrtc/signaling/src/jsep/JsepSession.h
media/webrtc/signaling/src/jsep/JsepSessionImpl.h
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -267,34 +267,30 @@ nsresult NrIceTurnServer::ToNicerTurnStr
   if (r) {
     RFREE(server->username);
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
 }
 
-NrIceCtx::NrIceCtx(const std::string& name,
-                   bool offerer,
-                   Policy policy)
+NrIceCtx::NrIceCtx(const std::string& name, Policy policy)
   : connection_state_(ICE_CTX_INIT),
     gathering_state_(ICE_CTX_GATHER_INIT),
     name_(name),
-    offerer_(offerer),
+    offerer_(false),
     ice_controlling_set_(false),
     streams_(),
     ctx_(nullptr),
     peer_(nullptr),
     ice_handler_vtbl_(nullptr),
     ice_handler_(nullptr),
     trickle_(true),
     policy_(policy),
     nat_ (nullptr) {
-  // XXX: offerer_ will be used eventually;  placate clang in the meantime.
-  (void)offerer_;
 }
 
 // Handler callbacks
 int NrIceCtx::select_pair(void *obj,nr_ice_media_stream *stream,
                    int component_id, nr_ice_cand_pair **potentials,
                    int potential_ct) {
   MOZ_MTLOG(ML_DEBUG, "select pair called: potential_ct = "
             << potential_ct);
@@ -540,19 +536,17 @@ NrIceCtx::Initialize(const std::string& 
   MOZ_ASSERT(!pwd.empty());
   if (ufrag.empty() || pwd.empty()) {
     return false;
   }
 
   // Create the ICE context
   int r;
 
-  UINT4 flags = offerer_ ? NR_ICE_CTX_FLAGS_OFFERER:
-      NR_ICE_CTX_FLAGS_ANSWERER;
-  flags |= NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION;
+  UINT4 flags = NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION;
   switch (policy_) {
     case ICE_POLICY_RELAY:
       flags |= NR_ICE_CTX_FLAGS_RELAY_ONLY;
       break;
     case ICE_POLICY_NO_HOST:
       flags |= NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES;
       break;
     case ICE_POLICY_ALL:
@@ -967,19 +961,21 @@ nsresult NrIceCtx::ParseGlobalAttributes
     MOZ_MTLOG(ML_ERROR, "Couldn't parse global attributes for "
               << name_ << "'");
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
-nsresult NrIceCtx::StartChecks() {
+nsresult NrIceCtx::StartChecks(bool offerer) {
   int r;
 
+  offerer_ = offerer;
+
   r=nr_ice_peer_ctx_pair_candidates(peer_);
   if (r) {
     MOZ_MTLOG(ML_ERROR, "Couldn't pair candidates on "
               << name_ << "'");
     SetConnectionState(ICE_CTX_FAILED);
     return NS_ERROR_FAILURE;
   }
 
--- a/media/mtransport/nricectx.h
+++ b/media/mtransport/nricectx.h
@@ -316,17 +316,17 @@ class NrIceCtx {
   // Provide the proxy address. Must be called before
   // StartGathering.
   nsresult SetProxyServer(const NrIceProxyServer& proxy_server);
 
   // Start ICE gathering
   nsresult StartGathering(bool default_route_only, bool proxy_only);
 
   // Start checking
-  nsresult StartChecks();
+  nsresult StartChecks(bool offerer);
 
   // Notify that the network has gone online/offline
   void UpdateNetworkState(bool online);
 
   // Finalize the ICE negotiation. I.e., there will be no
   // more forking.
   nsresult Finalize();
 
@@ -344,19 +344,17 @@ class NrIceCtx {
     SignalConnectionStateChange;
 
   // The thread to direct method calls to
   nsCOMPtr<nsIEventTarget> thread() { return sts_target_; }
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(NrIceCtx)
 
 private:
-  NrIceCtx(const std::string& name,
-           bool offerer,
-           Policy policy);
+  NrIceCtx(const std::string& name, Policy policy);
 
   virtual ~NrIceCtx();
 
   DISALLOW_COPY_ASSIGN(NrIceCtx);
 
   // Callbacks for nICEr
   static void gather_cb(NR_SOCKET s, int h, void *arg);  // ICE gather complete
 
--- a/media/mtransport/nricectxhandler.cpp
+++ b/media/mtransport/nricectxhandler.cpp
@@ -13,36 +13,34 @@ extern "C" {
 #include "nricemediastream.h"
 #include "nriceresolver.h"
 
 namespace mozilla {
 
 MOZ_MTLOG_MODULE("mtransport")
 
 NrIceCtxHandler::NrIceCtxHandler(const std::string& name,
-                                 bool offerer,
                                  NrIceCtx::Policy policy)
-  : current_ctx(new NrIceCtx(name, offerer, policy)),
+  : current_ctx(new NrIceCtx(name, policy)),
     old_ctx(nullptr),
     restart_count(0)
 {
 }
 
 RefPtr<NrIceCtxHandler>
 NrIceCtxHandler::Create(const std::string& name,
-                        bool offerer,
                         bool allow_loopback,
                         bool tcp_enabled,
                         bool allow_link_local,
                         NrIceCtx::Policy policy)
 {
   // InitializeGlobals only executes once
   NrIceCtx::InitializeGlobals(allow_loopback, tcp_enabled, allow_link_local);
 
-  RefPtr<NrIceCtxHandler> ctx = new NrIceCtxHandler(name, offerer, policy);
+  RefPtr<NrIceCtxHandler> ctx = new NrIceCtxHandler(name, policy);
 
   if (ctx == nullptr ||
       ctx->current_ctx == nullptr ||
       !ctx->current_ctx->Initialize()) {
     return nullptr;
   }
 
   return ctx;
@@ -67,17 +65,16 @@ NrIceCtxHandler::CreateCtx() const
 }
 
 
 RefPtr<NrIceCtx>
 NrIceCtxHandler::CreateCtx(const std::string& ufrag,
                            const std::string& pwd) const
 {
   RefPtr<NrIceCtx> new_ctx = new NrIceCtx(this->current_ctx->name(),
-                                          true, // offerer (hardcoded per bwc)
                                           this->current_ctx->policy());
   if (new_ctx == nullptr) {
     return nullptr;
   }
 
   if (!new_ctx->Initialize(ufrag, pwd)) {
     return nullptr;
   }
--- a/media/mtransport/nricectxhandler.h
+++ b/media/mtransport/nricectxhandler.h
@@ -4,17 +4,16 @@
 #include "nricectx.h"
 
 namespace mozilla {
 
 class NrIceCtxHandler {
 public:
   // TODO(ekr@rtfm.com): Too many bools here. Bug 1193437.
   static RefPtr<NrIceCtxHandler> Create(const std::string& name,
-                                        bool offerer,
                                         bool allow_loopback = false,
                                         bool tcp_enabled = true,
                                         bool allow_link_local = false,
                                         NrIceCtx::Policy policy =
                                           NrIceCtx::ICE_POLICY_ALL);
 
   RefPtr<NrIceMediaStream> CreateStream(const std::string& name,
                                         int components);
@@ -31,19 +30,17 @@ public:
   void FinalizeIceRestart();
   void RollbackIceRestart();
 
   NrIceStats Destroy();
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(NrIceCtxHandler)
 
 private:
-  NrIceCtxHandler(const std::string& name,
-                  bool offerer,
-                  NrIceCtx::Policy policy);
+  NrIceCtxHandler(const std::string& name, NrIceCtx::Policy policy);
   NrIceCtxHandler() = delete;
   ~NrIceCtxHandler();
   DISALLOW_COPY_ASSIGN(NrIceCtxHandler);
 
   RefPtr<NrIceCtx> current_ctx;
   RefPtr<NrIceCtx> old_ctx; // for while restart is in progress
   int restart_count; // used to differentiate streams between restarted ctx
 };
--- a/media/mtransport/test/ice_unittest.cpp
+++ b/media/mtransport/test/ice_unittest.cpp
@@ -381,19 +381,20 @@ class IceTestPeer : public sigslot::has_
   // TODO(ekr@rtfm.com): Convert to flags when NrIceCtx::Create() does.
   // Bug 1193437.
   IceTestPeer(const std::string& name, MtransportTestUtils* utils,
               bool offerer,
               bool allow_loopback = false, bool enable_tcp = true,
               bool allow_link_local = false,
               NrIceCtx::Policy ice_policy = NrIceCtx::ICE_POLICY_ALL) :
       name_(name),
-      ice_ctx_(NrIceCtxHandler::Create(name, offerer, allow_loopback,
+      ice_ctx_(NrIceCtxHandler::Create(name, allow_loopback,
                                        enable_tcp, allow_link_local,
                                        ice_policy)),
+      offerer_(offerer),
       candidates_(),
       shutting_down_(false),
       gathering_complete_(false),
       ready_ct_(0),
       ice_connected_(false),
       ice_failed_(false),
       ice_reached_checking_(false),
       received_(0),
@@ -786,18 +787,20 @@ class IceTestPeer : public sigslot::has_
         std::vector<std::string> empty_attrs;
         std::cout << "Calling ParseAttributes on stream " << i << std::endl;
         res = aStream->ParseAttributes(empty_attrs);
         ASSERT_TRUE(NS_SUCCEEDED(res));
       }
     }
 
     if (start) {
+      ice_ctx_->ctx()->SetControlling(
+          offerer_ ? NrIceCtx::ICE_CONTROLLING : NrIceCtx::ICE_CONTROLLED);
       // Now start checks
-      res = ice_ctx_->ctx()->StartChecks();
+      res = ice_ctx_->ctx()->StartChecks(offerer_);
       ASSERT_TRUE(NS_SUCCEEDED(res));
     }
   }
 
   void Connect(IceTestPeer *remote, TrickleMode trickle_mode,
                bool start = true) {
     test_utils_->sts_target()->Dispatch(
         WrapRunnable(
@@ -997,19 +1000,25 @@ class IceTestPeer : public sigslot::has_
   void UnsetRemote()
   {
     remote_ = nullptr;
   }
 
   void StartChecks() {
     nsresult res;
 
+    test_utils_->sts_target()->Dispatch(
+        WrapRunnableRet(&res, ice_ctx_->ctx(), &NrIceCtx::SetControlling,
+                        offerer_ ?
+                          NrIceCtx::ICE_CONTROLLING : NrIceCtx::ICE_CONTROLLED),
+        NS_DISPATCH_SYNC);
     // Now start checks
     test_utils_->sts_target()->Dispatch(
-        WrapRunnableRet(&res, ice_ctx_->ctx(), &NrIceCtx::StartChecks),
+        WrapRunnableRet(&res, ice_ctx_->ctx(), &NrIceCtx::StartChecks,
+                        offerer_),
         NS_DISPATCH_SYNC);
     ASSERT_TRUE(NS_SUCCEEDED(res));
   }
 
   // Handle events
   void GatheringStateChange(NrIceCtx* ctx,
                             NrIceCtx::GatheringState state) {
     if (shutting_down_) {
@@ -1429,16 +1438,17 @@ class IceTestPeer : public sigslot::has_
 
   nsresult GetDefaultCandidate_s(unsigned int stream, NrIceCandidate* cand) {
     return ice_ctx_->ctx()->GetStream(stream)->GetDefaultCandidate(1, cand);
   }
 
  private:
   std::string name_;
   RefPtr<NrIceCtxHandler> ice_ctx_;
+  bool offerer_;
   std::map<std::string, std::vector<std::string> > candidates_;
   // Maps from stream id to list of remote trickle candidates
   std::map<size_t, std::vector<SchedulableTrickleCandidate*> >
     controlled_trickle_candidates_;
   bool shutting_down_;
   bool gathering_complete_;
   int ready_ct_;
   bool ice_connected_;
--- a/media/mtransport/test/transport_unittests.cpp
+++ b/media/mtransport/test/transport_unittests.cpp
@@ -429,44 +429,41 @@ class TlsServerKeyExchangeECDHE {
 
   DataBuffer public_key_;
 };
 
 namespace {
 class TransportTestPeer : public sigslot::has_slots<> {
  public:
   TransportTestPeer(nsCOMPtr<nsIEventTarget> target, std::string name, MtransportTestUtils* utils)
-      : name_(name), target_(target),
+      : name_(name), offerer_(name == "P1"), target_(target),
         received_packets_(0),received_bytes_(0),flow_(new TransportFlow(name)),
         loopback_(new TransportLayerLoopback()),
         logging_(new TransportLayerLogging()),
         lossy_(new TransportLayerLossy()),
         dtls_(new TransportLayerDtls()),
         identity_(DtlsIdentity::Generate()),
-        ice_ctx_(NrIceCtxHandler::Create(name,
-                                         name == "P2" ?
-                                         TransportLayerDtls::CLIENT :
-                                         TransportLayerDtls::SERVER)),
+        ice_ctx_(NrIceCtxHandler::Create(name)),
         streams_(), candidates_(),
         peer_(nullptr),
         gathering_complete_(false),
         enabled_cipersuites_(),
         disabled_cipersuites_(),
         reuse_dhe_key_(false),
         test_utils_(utils) {
     std::vector<NrIceStunServer> stun_servers;
     UniquePtr<NrIceStunServer> server(NrIceStunServer::Create(
         std::string((char *)"stun.services.mozilla.com"), 3478));
     stun_servers.push_back(*server);
     EXPECT_TRUE(NS_SUCCEEDED(ice_ctx_->ctx()->SetStunServers(stun_servers)));
 
     dtls_->SetIdentity(identity_);
-    dtls_->SetRole(name == "P2" ?
-                   TransportLayerDtls::CLIENT :
-                   TransportLayerDtls::SERVER);
+    dtls_->SetRole(offerer_ ?
+                   TransportLayerDtls::SERVER :
+                   TransportLayerDtls::CLIENT);
 
     nsresult res = identity_->ComputeFingerprint("sha-1",
                                              fingerprint_,
                                              sizeof(fingerprint_),
                                              &fingerprint_len_);
     EXPECT_TRUE(NS_SUCCEEDED(res));
     EXPECT_EQ(20u, fingerprint_len_);
   }
@@ -693,17 +690,18 @@ class TransportTestPeer : public sigslot
         WrapRunnableRet(&res, peer_->streams_[i], &NrIceMediaStream::ParseAttributes,
                         candidates_[streams_[i]->name()]), NS_DISPATCH_SYNC);
 
       ASSERT_TRUE(NS_SUCCEEDED(res));
     }
 
     // Start checks on the other peer.
     test_utils_->sts_target()->Dispatch(
-      WrapRunnableRet(&res, peer_->ice_ctx_->ctx(), &NrIceCtx::StartChecks),
+      WrapRunnableRet(&res, peer_->ice_ctx_->ctx(), &NrIceCtx::StartChecks,
+                      offerer_),
       NS_DISPATCH_SYNC);
     ASSERT_TRUE(NS_SUCCEEDED(res));
   }
 
   TransportResult SendPacket(const unsigned char* data, size_t len) {
     TransportResult ret;
     test_utils_->sts_target()->Dispatch(
       WrapRunnableRet(&ret, flow_, &TransportFlow::SendPacket, data, len),
@@ -797,16 +795,17 @@ class TransportTestPeer : public sigslot
     if (NS_FAILED(rv)) {
       return 0; // the SRTP equivalent of TLS_NULL_WITH_NULL_NULL
     }
     return cipher;
   }
 
  private:
   std::string name_;
+  bool offerer_;
   nsCOMPtr<nsIEventTarget> target_;
   size_t received_packets_;
   size_t received_bytes_;
     RefPtr<TransportFlow> flow_;
   TransportLayerLoopback *loopback_;
   TransportLayerLogging *logging_;
   TransportLayerLossy *lossy_;
   TransportLayerDtls *dtls_;
--- a/media/mtransport/third_party/nICEr/src/ice/ice_ctx.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_ctx.h
@@ -162,24 +162,22 @@ struct nr_ice_ctx_ {
   void *trickle_cb_arg;
 
   char force_net_interface[MAXIFNAME];
   nr_ice_stats stats;
 };
 
 int nr_ice_ctx_create(char *label, UINT4 flags, nr_ice_ctx **ctxp);
 int nr_ice_ctx_create_with_credentials(char *label, UINT4 flags, char* ufrag, char* pwd, 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)
-#define NR_ICE_CTX_FLAGS_RELAY_ONLY                        (1<<4)
-#define NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES              (1<<5)
-#define NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS                (1<<6)
-#define NR_ICE_CTX_FLAGS_ONLY_PROXY                        (1<<7)
+#define NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION             (1)
+#define NR_ICE_CTX_FLAGS_LITE                              (1<<1)
+#define NR_ICE_CTX_FLAGS_RELAY_ONLY                        (1<<2)
+#define NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES              (1<<3)
+#define NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS                (1<<4)
+#define NR_ICE_CTX_FLAGS_ONLY_PROXY                        (1<<5)
 
 void nr_ice_ctx_add_flags(nr_ice_ctx *ctx, UINT4 flags);
 void nr_ice_ctx_remove_flags(nr_ice_ctx *ctx, UINT4 flags);
 int nr_ice_ctx_destroy(nr_ice_ctx **ctxp);
 int nr_ice_gather(nr_ice_ctx *ctx, NR_async_cb done_cb, void *cb_arg);
 int nr_ice_add_candidate(nr_ice_ctx *ctx, nr_ice_candidate *cand);
 void nr_ice_gather_finished_cb(NR_SOCKET s, int h, void *cb_arg);
 int nr_ice_add_media_stream(nr_ice_ctx *ctx,char *label,int components, nr_ice_media_stream **streamp);
--- a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
@@ -65,22 +65,18 @@ int nr_ice_peer_ctx_create(nr_ice_ctx *c
       ABORT(R_NO_MEMORY);
 
     pctx->ctx=ctx;
     pctx->handler=handler;
 
     /* Decide controlling vs. controlled */
     if(ctx->flags & NR_ICE_CTX_FLAGS_LITE){
       pctx->controlling=0;
-    }
-    else{
-      if(ctx->flags & NR_ICE_CTX_FLAGS_OFFERER)
-        pctx->controlling=1;
-      else if(ctx->flags & NR_ICE_CTX_FLAGS_ANSWERER)
-        pctx->controlling=0;
+    } else {
+      pctx->controlling=1;
     }
     if(r=nr_crypto_random_bytes((UCHAR *)&pctx->tiebreaker,8))
       ABORT(r);
 
     STAILQ_INIT(&pctx->peer_streams);
 
     STAILQ_INSERT_TAIL(&ctx->peers,pctx,entry);
 
--- a/media/webrtc/signaling/src/jsep/JsepSession.h
+++ b/media/webrtc/signaling/src/jsep/JsepSession.h
@@ -188,16 +188,17 @@ public:
       const std::string& defaultRtcpCandidateAddr,
       uint16_t defaultRtcpCandidatePort,
       uint16_t level) = 0;
   virtual nsresult EndOfLocalCandidates(uint16_t level) = 0;
   virtual nsresult Close() = 0;
 
   // ICE controlling or controlled
   virtual bool IsIceControlling() const = 0;
+  virtual bool IsOfferer() const = 0;
 
   virtual const std::string
   GetLastError() const
   {
     return "Error";
   }
 
   static const char*
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.h
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.h
@@ -163,17 +163,17 @@ public:
 
   virtual bool
   IsIceControlling() const override
   {
     return mIceControlling;
   }
 
   virtual bool
-  IsOfferer() const
+  IsOfferer() const override
   {
     return mIsOfferer;
   }
 
   // Access transports.
   virtual std::vector<RefPtr<JsepTransport>>
   GetTransports() const override
   {
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -351,17 +351,16 @@ nsresult PeerConnectionMedia::Init(const
   nsresult rv = InitProxy();
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool ice_tcp = Preferences::GetBool("media.peerconnection.ice.tcp", false);
 
   // TODO(ekr@rtfm.com): need some way to set not offerer later
   // Looks like a bug in the NrIceCtx API.
   mIceCtxHdlr = NrIceCtxHandler::Create("PC:" + mParentName,
-                                        true, // Offerer
                                         mParent->GetAllowIceLoopback(),
                                         ice_tcp,
                                         mParent->GetAllowIceLinkLocal(),
                                         policy);
   if(!mIceCtxHdlr) {
     CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
     return NS_ERROR_FAILURE;
   }
@@ -587,26 +586,28 @@ nsresult PeerConnectionMedia::UpdateMedi
 void
 PeerConnectionMedia::StartIceChecks(const JsepSession& aSession)
 {
   nsCOMPtr<nsIRunnable> runnable(
       WrapRunnable(
         RefPtr<PeerConnectionMedia>(this),
         &PeerConnectionMedia::StartIceChecks_s,
         aSession.IsIceControlling(),
+        aSession.IsOfferer(),
         aSession.RemoteIsIceLite(),
         // Copy, just in case API changes to return a ref
         std::vector<std::string>(aSession.GetIceOptions())));
 
   PerformOrEnqueueIceCtxOperation(runnable);
 }
 
 void
 PeerConnectionMedia::StartIceChecks_s(
     bool aIsControlling,
+    bool aIsOfferer,
     bool aIsIceLite,
     const std::vector<std::string>& aIceOptionsList) {
 
   CSFLogDebug(logTag, "Starting ICE Checking");
 
   std::vector<std::string> attributes;
   if (aIsIceLite) {
     attributes.push_back("ice-lite");
@@ -623,17 +624,17 @@ PeerConnectionMedia::StartIceChecks_s(
   if (NS_FAILED(rv)) {
     CSFLogError(logTag, "%s: couldn't parse global parameters", __FUNCTION__ );
   }
 
   mIceCtxHdlr->ctx()->SetControlling(aIsControlling ?
                                      NrIceCtx::ICE_CONTROLLING :
                                      NrIceCtx::ICE_CONTROLLED);
 
-  mIceCtxHdlr->ctx()->StartChecks();
+  mIceCtxHdlr->ctx()->StartChecks(aIsOfferer);
 }
 
 bool
 PeerConnectionMedia::IsIceRestarting() const
 {
   ASSERT_ON_THREAD(mMainThread);
 
   return (mIceRestartState != ICE_RESTART_NONE);
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
@@ -466,16 +466,17 @@ class PeerConnectionMedia : public sigsl
       const std::vector<std::string>& aCandidateList);
   void RemoveTransportsAtOrAfter_s(size_t aMLine);
 
   void GatherIfReady();
   void FlushIceCtxOperationQueueIfReady();
   void PerformOrEnqueueIceCtxOperation(nsIRunnable* runnable);
   void EnsureIceGathering_s(bool aDefaultRouteOnly, bool aProxyOnly);
   void StartIceChecks_s(bool aIsControlling,
+                        bool aIsOfferer,
                         bool aIsIceLite,
                         const std::vector<std::string>& aIceOptionsList);
 
   void BeginIceRestart_s(RefPtr<NrIceCtx> new_ctx);
   void FinalizeIceRestart_s();
   void RollbackIceRestart_s();
   bool GetPrefDefaultAddressOnly() const;
   bool GetPrefProxyOnly() const;