Bug 1290866: Ensure MediaDevices::Allocate's *aOutHandle is properly set to null r=jib, a=ritu
authorRandell Jesup <rjesup@jesup.org>
Mon, 01 Aug 2016 16:26:13 -0400
changeset 349650 291a9823eb6a705207b738ddb79b7b86bddc4db8
parent 349649 587904a10d9a4f2934a5cff85c9415ad2fb5cb56
child 349651 307fe134b473938131cb0f28db52cf371883f663
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, ritu
bugs1290866
milestone50.0a2
Bug 1290866: Ensure MediaDevices::Allocate's *aOutHandle is properly set to null r=jib, a=ritu
dom/media/webrtc/MediaEngineDefault.cpp
dom/media/webrtc/MediaEngineGonkVideoSource.cpp
dom/media/webrtc/MediaEngineTabVideoSource.cpp
dom/media/webrtc/MediaEngineWebRTC.h
--- a/dom/media/webrtc/MediaEngineDefault.cpp
+++ b/dom/media/webrtc/MediaEngineDefault.cpp
@@ -101,17 +101,17 @@ MediaEngineDefaultVideoSource::Allocate(
 
 
   mOpts = aPrefs;
   mOpts.mWidth = c.mWidth.Get(aPrefs.mWidth ? aPrefs.mWidth :
                               MediaEngine::DEFAULT_43_VIDEO_WIDTH);
   mOpts.mHeight = c.mHeight.Get(aPrefs.mHeight ? aPrefs.mHeight :
                                 MediaEngine::DEFAULT_43_VIDEO_HEIGHT);
   mState = kAllocated;
-  aOutHandle = nullptr;
+  *aOutHandle = nullptr;
   return NS_OK;
 }
 
 nsresult
 MediaEngineDefaultVideoSource::Deallocate(AllocationHandle* aHandle)
 {
   MOZ_ASSERT(!aHandle);
   if (mState != kStopped && mState != kAllocated) {
@@ -410,17 +410,17 @@ MediaEngineDefaultAudioSource::Allocate(
       aConstraints.mDeviceId.GetAsString().EqualsASCII("bad device")) {
     return NS_ERROR_FAILURE;
   }
 
   mState = kAllocated;
   // generate sine wave (default 1KHz)
   mSineGenerator = new SineWaveGenerator(AUDIO_RATE,
                                          static_cast<uint32_t>(aPrefs.mFreq ? aPrefs.mFreq : 1000));
-  aOutHandle = nullptr;
+  *aOutHandle = nullptr;
   return NS_OK;
 }
 
 nsresult
 MediaEngineDefaultAudioSource::Deallocate(AllocationHandle* aHandle)
 {
   MOZ_ASSERT(!aHandle);
   if (mState != kStopped && mState != kAllocated) {
--- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp
@@ -163,17 +163,17 @@ MediaEngineGonkVideoSource::Allocate(con
     NS_DispatchToMainThread(WrapRunnable(RefPtr<MediaEngineGonkVideoSource>(this),
                                          &MediaEngineGonkVideoSource::AllocImpl));
     mCallbackMonitor.Wait();
     if (mState != kAllocated) {
       return NS_ERROR_FAILURE;
     }
   }
 
-  aOutHandle = nullptr;
+  *aOutHandle = nullptr;
   return NS_OK;
 }
 
 nsresult
 MediaEngineGonkVideoSource::Deallocate(AllocationHandle* aHandle)
 {
   LOG((__FUNCTION__));
   AssertIsOnOwningThread();
--- a/dom/media/webrtc/MediaEngineTabVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineTabVideoSource.cpp
@@ -143,17 +143,17 @@ MediaEngineTabVideoSource::Allocate(cons
                                     AllocationHandle** aOutHandle,
                                     const char** aOutBadConstraint)
 {
   // windowId is not a proper constraint, so just read it.
   // It has no well-defined behavior in advanced, so ignore it there.
 
   mWindowId = aConstraints.mBrowserWindow.WasPassed() ?
               aConstraints.mBrowserWindow.Value() : -1;
-  aOutHandle = nullptr;
+  *aOutHandle = nullptr;
   return Restart(nullptr, aConstraints, aPrefs, aDeviceId, aOutBadConstraint);
 }
 
 nsresult
 MediaEngineTabVideoSource::Restart(AllocationHandle* aHandle,
                                    const dom::MediaTrackConstraints& aConstraints,
                                    const mozilla::MediaEnginePrefs& aPrefs,
                                    const nsString& aDeviceId,
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -77,17 +77,17 @@ public:
   nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
                     const MediaEnginePrefs& aPrefs,
                     const nsString& aDeviceId,
                     const nsACString& aOrigin,
                     AllocationHandle** aOutHandle,
                     const char** aOutBadConstraint) override
   {
     // Nothing to do here, everything is managed in MediaManager.cpp
-    aOutHandle = nullptr;
+    *aOutHandle = nullptr;
     return NS_OK;
   }
   nsresult Deallocate(AllocationHandle* aHandle) override
   {
     // Nothing to do here, everything is managed in MediaManager.cpp
     MOZ_ASSERT(!aHandle);
     return NS_OK;
   }