Bug 1287854 - Fix MediaEngineGonk build r=padenot

MozReview-Commit-ID: 5jmepGcWiIG

--HG--
extra : rebase_source : 55e0d6b33dd2670fb4ac40afca011c1d34b438f8
This commit is contained in:
Alexandre Lissy 2016-07-19 19:09:16 +02:00
Родитель faa2229a5e
Коммит d62c2c8293
2 изменённых файлов: 25 добавлений и 12 удалений

Просмотреть файл

@ -104,7 +104,7 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
} }
size_t size_t
MediaEngineGonkVideoSource::NumCapabilities() MediaEngineGonkVideoSource::NumCapabilities() const
{ {
// TODO: Stop hardcoding. Use GetRecorderProfiles+GetProfileInfo (Bug 1128550) // TODO: Stop hardcoding. Use GetRecorderProfiles+GetProfileInfo (Bug 1128550)
// //
@ -150,13 +150,16 @@ nsresult
MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstraints, MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstraints,
const MediaEnginePrefs& aPrefs, const MediaEnginePrefs& aPrefs,
const nsString& aDeviceId, const nsString& aDeviceId,
const nsACString& aOrigin) const nsACString& aOrigin,
BaseAllocationHandle** aOutHandle,
const char** aOutBadConstraint)
{ {
LOG((__FUNCTION__)); LOG((__FUNCTION__));
ReentrantMonitorAutoEnter sync(mCallbackMonitor); ReentrantMonitorAutoEnter sync(mCallbackMonitor);
if (mState == kReleased && mInitDone) { if (mState == kReleased && mInitDone) {
ChooseCapability(aConstraints, aPrefs, aDeviceId); NormalizedConstraints constraints(aConstraints);
ChooseCapability(constraints, aPrefs, aDeviceId);
NS_DispatchToMainThread(WrapRunnable(RefPtr<MediaEngineGonkVideoSource>(this), NS_DispatchToMainThread(WrapRunnable(RefPtr<MediaEngineGonkVideoSource>(this),
&MediaEngineGonkVideoSource::AllocImpl)); &MediaEngineGonkVideoSource::AllocImpl));
mCallbackMonitor.Wait(); mCallbackMonitor.Wait();
@ -165,13 +168,17 @@ MediaEngineGonkVideoSource::Allocate(const dom::MediaTrackConstraints& aConstrai
} }
} }
aOutHandle = nullptr;
return NS_OK; return NS_OK;
} }
nsresult nsresult
MediaEngineGonkVideoSource::Deallocate() MediaEngineGonkVideoSource::Deallocate(BaseAllocationHandle* aHandle)
{ {
LOG((__FUNCTION__)); LOG((__FUNCTION__));
AssertIsOnOwningThread();
MOZ_ASSERT(!aHandle);
bool empty; bool empty;
{ {
MonitorAutoLock lock(mMonitor); MonitorAutoLock lock(mMonitor);
@ -332,9 +339,11 @@ MediaEngineGonkVideoSource::Stop(SourceMediaStream* aSource, TrackID aID)
} }
nsresult nsresult
MediaEngineGonkVideoSource::Restart(const dom::MediaTrackConstraints& aConstraints, MediaEngineGonkVideoSource::Restart(BaseAllocationHandle* aHandle,
const dom::MediaTrackConstraints& aConstraints,
const MediaEnginePrefs& aPrefs, const MediaEnginePrefs& aPrefs,
const nsString& aDeviceId) const nsString& aDeviceId,
const char** aOutBadConstraint)
{ {
return NS_OK; return NS_OK;
} }
@ -384,7 +393,7 @@ MediaEngineGonkVideoSource::Shutdown()
} }
if (mState == kAllocated || mState == kStopped) { if (mState == kAllocated || mState == kStopped) {
Deallocate(); Deallocate(nullptr);
} }
mState = kReleased; mState = kReleased;

Просмотреть файл

@ -63,14 +63,18 @@ public:
nsresult Allocate(const dom::MediaTrackConstraints &aConstraints, nsresult Allocate(const dom::MediaTrackConstraints &aConstraints,
const MediaEnginePrefs &aPrefs, const MediaEnginePrefs &aPrefs,
const nsString& aDeviceId, const nsString& aDeviceId,
const nsACString& aOrigin) override; const nsACString& aOrigin,
nsresult Deallocate() override; BaseAllocationHandle** aOutHandle,
const char** aOutBadConstraint) override;
nsresult Deallocate(BaseAllocationHandle* aHandle) override;
nsresult Start(SourceMediaStream* aStream, TrackID aID, nsresult Start(SourceMediaStream* aStream, TrackID aID,
const PrincipalHandle& aPrincipalHandle) override; const PrincipalHandle& aPrincipalHandle) override;
nsresult Stop(SourceMediaStream* aSource, TrackID aID) 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 MediaEnginePrefs &aPrefs,
const nsString& aDeviceId) override; const nsString& aDeviceId,
const char** aOutBadConstraint) override;
void NotifyPull(MediaStreamGraph* aGraph, void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource, SourceMediaStream* aSource,
TrackID aId, TrackID aId,
@ -114,7 +118,7 @@ protected:
// Initialize the needed Video engine interfaces. // Initialize the needed Video engine interfaces.
void Init(); void Init();
void Shutdown(); void Shutdown();
size_t NumCapabilities() override; size_t NumCapabilities() const override;
// Initialize the recording frame (MediaBuffer) callback and Gonk camera. // Initialize the recording frame (MediaBuffer) callback and Gonk camera.
// MediaBuffer will transfers to MediaStreamGraph via AppendToTrack. // MediaBuffer will transfers to MediaStreamGraph via AppendToTrack.
nsresult InitDirectMediaBuffer(); nsresult InitDirectMediaBuffer();