Bug 1153050 - Add ICameraControl check to MediaEngineGonkVideoSource::Start() r=jesup
authorSotaro Ikeda <sikeda@mozilla.com>
Fri, 10 Apr 2015 07:39:36 -0700
changeset 238676 77ab3d086a13b1f70bca58d397ccf8d56915aed6
parent 238675 14f69f2f4712c920214223ba02eb59c7970bdec1
child 238677 94a0aa18d1b0e935d4644e3ba63e9e64c5445c47
push idunknown
push userunknown
push dateunknown
reviewersjesup
bugs1153050
milestone40.0a1
Bug 1153050 - Add ICameraControl check to MediaEngineGonkVideoSource::Start() r=jesup
dom/media/webrtc/MediaEngineGonkVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp
@@ -216,18 +216,21 @@ MediaEngineGonkVideoSource::Start(Source
     MonitorAutoLock lock(mMonitor);
     mSources.AppendElement(aStream);
   }
 
   aStream->AddTrack(aID, 0, new VideoSegment());
 
   ReentrantMonitorAutoEnter sync(mCallbackMonitor);
 
+  MOZ_ASSERT(mCameraControl, "mCameraControl is nullptr");
   if (mState == kStarted) {
     return NS_OK;
+  } else if (!mCameraControl) {
+    return NS_ERROR_FAILURE;
   }
   mTrackID = aID;
   mImageContainer = layers::LayerManager::CreateImageContainer();
 
   NS_DispatchToMainThread(WrapRunnable(nsRefPtr<MediaEngineGonkVideoSource>(this),
                                        &MediaEngineGonkVideoSource::StartImpl,
                                        mCapability));
   mCallbackMonitor.Wait();