From d62c2c8293df8401e2786284417faa1926893ed8 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Tue, 19 Jul 2016 19:09:16 +0200 Subject: [PATCH] Bug 1287854 - Fix MediaEngineGonk build r=padenot MozReview-Commit-ID: 5jmepGcWiIG --HG-- extra : rebase_source : 55e0d6b33dd2670fb4ac40afca011c1d34b438f8 --- .../webrtc/MediaEngineGonkVideoSource.cpp | 23 +++++++++++++------ dom/media/webrtc/MediaEngineGonkVideoSource.h | 14 +++++++---- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 476310062bcc..b85c71cdc561 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -104,7 +104,7 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph, } size_t -MediaEngineGonkVideoSource::NumCapabilities() +MediaEngineGonkVideoSource::NumCapabilities() const { // TODO: Stop hardcoding. Use GetRecorderProfiles+GetProfileInfo (Bug 1128550) // @@ -150,13 +150,16 @@ nsresult MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstraints, const MediaEnginePrefs& aPrefs, const nsString& aDeviceId, - const nsACString& aOrigin) + const nsACString& aOrigin, + BaseAllocationHandle** aOutHandle, + const char** aOutBadConstraint) { LOG((__FUNCTION__)); ReentrantMonitorAutoEnter sync(mCallbackMonitor); if (mState == kReleased && mInitDone) { - ChooseCapability(aConstraints, aPrefs, aDeviceId); + NormalizedConstraints constraints(aConstraints); + ChooseCapability(constraints, aPrefs, aDeviceId); NS_DispatchToMainThread(WrapRunnable(RefPtr(this), &MediaEngineGonkVideoSource::AllocImpl)); mCallbackMonitor.Wait(); @@ -165,13 +168,17 @@ MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstrai } } + aOutHandle = nullptr; return NS_OK; } nsresult -MediaEngineGonkVideoSource::Deallocate() +MediaEngineGonkVideoSource::Deallocate(BaseAllocationHandle* aHandle) { LOG((__FUNCTION__)); + AssertIsOnOwningThread(); + MOZ_ASSERT(!aHandle); + bool empty; { MonitorAutoLock lock(mMonitor); @@ -332,9 +339,11 @@ MediaEngineGonkVideoSource::Stop(SourceMediaStream* aSource, TrackID aID) } nsresult -MediaEngineGonkVideoSource::Restart(const dom::MediaTrackConstraints& aConstraints, +MediaEngineGonkVideoSource::Restart(BaseAllocationHandle* aHandle, + const dom::MediaTrackConstraints& aConstraints, const MediaEnginePrefs& aPrefs, - const nsString& aDeviceId) + const nsString& aDeviceId, + const char** aOutBadConstraint) { return NS_OK; } @@ -384,7 +393,7 @@ MediaEngineGonkVideoSource::Shutdown() } if (mState == kAllocated || mState == kStopped) { - Deallocate(); + Deallocate(nullptr); } mState = kReleased; diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.h b/dom/media/webrtc/MediaEngineGonkVideoSource.h index c14e8b3c5716..9cf974dec127 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.h +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.h @@ -63,14 +63,18 @@ public: nsresult Allocate(const dom::MediaTrackConstraints &aConstraints, const MediaEnginePrefs &aPrefs, const nsString& aDeviceId, - const nsACString& aOrigin) override; - nsresult Deallocate() override; + const nsACString& aOrigin, + BaseAllocationHandle** aOutHandle, + const char** aOutBadConstraint) override; + nsresult Deallocate(BaseAllocationHandle* aHandle) override; nsresult Start(SourceMediaStream* aStream, TrackID aID, const PrincipalHandle& aPrincipalHandle) override; nsresult Stop(SourceMediaStream* aSource, TrackID aID) override; - nsresult Restart(const dom::MediaTrackConstraints& aConstraints, + nsresult Restart(BaseAllocationHandle* aHandle, + const dom::MediaTrackConstraints& aConstraints, const MediaEnginePrefs &aPrefs, - const nsString& aDeviceId) override; + const nsString& aDeviceId, + const char** aOutBadConstraint) override; void NotifyPull(MediaStreamGraph* aGraph, SourceMediaStream* aSource, TrackID aId, @@ -114,7 +118,7 @@ protected: // Initialize the needed Video engine interfaces. void Init(); void Shutdown(); - size_t NumCapabilities() override; + size_t NumCapabilities() const override; // Initialize the recording frame (MediaBuffer) callback and Gonk camera. // MediaBuffer will transfers to MediaStreamGraph via AppendToTrack. nsresult InitDirectMediaBuffer();