Bug 1290948 - Part 8: Don't cause ICE to fail if there's no streams to establish. r+drno r=drno
☠☠ backed out by e077a6e6e842 ☠ ☠
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 29 Sep 2017 09:16:14 -0500
changeset 443520 97a271bf671eb1e8adb9378ee4052e0d93a40a80
parent 443519 8ff38e646037f6857357efe95370b725d070fdf4
child 443521 d0df69766fa52a85a66e9bb8ef3d9745b6155667
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1290948
milestone59.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 1290948 - Part 8: Don't cause ICE to fail if there's no streams to establish. r+drno r=drno MozReview-Commit-ID: 4wxlK9w3sL6
media/mtransport/nricectx.cpp
media/mtransport/nricectx.h
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -1038,18 +1038,31 @@ nsresult NrIceCtx::ParseGlobalAttributes
     MOZ_MTLOG(ML_ERROR, "Couldn't parse global attributes for "
               << name_ << "'");
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
+bool NrIceCtx::HasStreamsToConnect() const {
+  for (auto& stream : streams_) {
+    if (stream && stream->state() != NrIceMediaStream::ICE_CLOSED) {
+      return true;
+    }
+  }
+  return false;
+}
+
 nsresult NrIceCtx::StartChecks(bool offerer) {
   int r;
+  if (!HasStreamsToConnect()) {
+    // Nothing to do
+    return NS_OK;
+  }
 
   offerer_ = offerer;
   ice_start_time_ = TimeStamp::Now();
 
   r=nr_ice_peer_ctx_pair_candidates(peer_);
   if (r) {
     MOZ_MTLOG(ML_ERROR, "Couldn't pair candidates on "
               << name_ << "'");
--- a/media/mtransport/nricectx.h
+++ b/media/mtransport/nricectx.h
@@ -267,16 +267,18 @@ class NrIceCtx {
   }
 
   // Some might be null
   size_t GetStreamCount() const
   {
     return streams_.size();
   }
 
+  bool HasStreamsToConnect() const;
+
   // The name of the ctx
   const std::string& name() const { return name_; }
 
   // Get ufrag and password.
   std::string ufrag() const;
   std::string pwd() const;
 
   // Current state