Bug 1488832 - Change init assert to runtime guard. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 20 Sep 2018 12:29:50 +0000
changeset 493593 fe9563002b6fcc600af3d9c102f5148dd0d9ee4a
parent 493592 2ea7113db27c18e1ed64deab6984dbed7d88f521
child 493594 5bd44d836cbfea1826511e91736a89c198c3123a
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1488832
milestone64.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 1488832 - Change init assert to runtime guard. r=jib Differential Revision: https://phabricator.services.mozilla.com/D6144
dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
@@ -182,19 +182,23 @@ MediaEngineRemoteVideoSource::Allocate(
     const nsString& aDeviceId,
     const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
     AllocationHandle** aOutHandle,
     const char** aOutBadConstraint)
 {
   LOG((__PRETTY_FUNCTION__));
   AssertIsOnOwningThread();
 
-  MOZ_ASSERT(mInitDone);
   MOZ_ASSERT(mState == kReleased);
 
+  if (!mInitDone) {
+    LOG(("Init not done"));
+    return NS_ERROR_FAILURE;
+  }
+
   NormalizedConstraints constraints(aConstraints);
   webrtc::CaptureCapability newCapability;
   LOG(("ChooseCapability(kFitness) for mCapability (Allocate) ++"));
   if (!ChooseCapability(constraints, aPrefs, aDeviceId, newCapability, kFitness)) {
     *aOutBadConstraint =
       MediaConstraintsHelper::FindBadConstraint(constraints, this, aDeviceId);
     return NS_ERROR_FAILURE;
   }
@@ -287,18 +291,18 @@ MediaEngineRemoteVideoSource::SetTrack(c
 }
 
 nsresult
 MediaEngineRemoteVideoSource::Start(const RefPtr<const AllocationHandle>& aHandle)
 {
   LOG((__PRETTY_FUNCTION__));
   AssertIsOnOwningThread();
 
+  MOZ_ASSERT(mState == kAllocated || mState == kStopped);
   MOZ_ASSERT(mInitDone);
-  MOZ_ASSERT(mState == kAllocated || mState == kStopped);
   MOZ_ASSERT(mStream);
   MOZ_ASSERT(IsTrackIDExplicit(mTrackID));
 
   {
     MutexAutoLock lock(mMutex);
     mState = kStarted;
   }