зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1436694 - Clarify that MediaEngineSources can be double-stopped. r=padenot
This is already true for the audio sources. It should be for all. Crashtests showed that shutting down amidst the async init can lead to double-stops. It is impossible to completely protect yourself from them without waiting for all queued operations to resolve (results to become known) before taking action. Doing that would require a refactor in MediaManager and cause higher latency for device operations so it seems like the wrong way to go. MozReview-Commit-ID: 5Cci6whzTL7 --HG-- extra : rebase_source : 18efef4e294ac2b02753721ca5813bcbf63e3111
This commit is contained in:
Родитель
98c3816ece
Коммит
0815f2e5dc
|
@ -238,6 +238,10 @@ MediaEngineDefaultVideoSource::Stop(const RefPtr<const AllocationHandle>& aHandl
|
|||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mState == kStopped || mState == kAllocated) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == kStarted);
|
||||
MOZ_ASSERT(mTimer);
|
||||
MOZ_ASSERT(mStream);
|
||||
|
@ -498,8 +502,11 @@ MediaEngineDefaultAudioSource::Stop(const RefPtr<const AllocationHandle>& aHandl
|
|||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
MOZ_ASSERT(mState == kStarted);
|
||||
if (mState == kStopped || mState == kAllocated) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == kStarted);
|
||||
|
||||
MutexAutoLock lock(mMutex);
|
||||
mState = kStopped;
|
||||
|
|
|
@ -324,6 +324,10 @@ MediaEngineRemoteVideoSource::Stop(const RefPtr<const AllocationHandle>& aHandle
|
|||
LOG((__PRETTY_FUNCTION__));
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mState == kStopped || mState == kAllocated) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == kStarted);
|
||||
|
||||
if (camera::GetChildAndCall(&camera::CamerasChild::StopCapture,
|
||||
|
|
|
@ -171,6 +171,9 @@ public:
|
|||
*
|
||||
* If this was the last AllocationHandle that had been started,
|
||||
* the underlying device will be stopped.
|
||||
*
|
||||
* Double-stopping a given allocation handle is allowed and will return NS_OK.
|
||||
* This is necessary sometimes during shutdown.
|
||||
*/
|
||||
virtual nsresult Stop(const RefPtr<const AllocationHandle>& aHandle) = 0;
|
||||
|
||||
|
|
|
@ -402,6 +402,11 @@ nsresult
|
|||
MediaEngineTabVideoSource::Stop(const RefPtr<const AllocationHandle>& aHandle)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mState == kStopped || mState == kAllocated) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mState == kStarted);
|
||||
|
||||
// If mBlackedoutWindow is true, we may be running
|
||||
|
|
Загрузка…
Ссылка в новой задаче