зеркало из 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 : f4dccbc5a56e33ecc54d63ddefbae43d90ee95d4 extra : source : f5cc71d38e4a7c0e4db830242c1d454fcbdb9e48 extra : histedit_source : 3cd8615054ce9935047e4168c3a472152792886b
This commit is contained in:
Родитель
c9e4a19d1e
Коммит
411e973fab
|
@ -237,6 +237,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);
|
||||
|
@ -495,8 +499,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
|
||||
|
|
Загрузка…
Ссылка в новой задаче