зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1306813 - Don't puslish events to mOnOutput after DecodedStream::Stop() is called. r=pehrsons
Because the TaskQueue of MDSM will shut down soon and TaskQueue::Dispatch() will fail (via mOnOutput.Notify()). We reset mStream in Forget() on the TaskQueue thread of MDSM so NotifyOutput() can check it and ensure mOnOutput.Notify() always happen before DecodedStream::Stop(). MozReview-Commit-ID: 4sCXk1KAfCC --HG-- extra : rebase_source : 1ec50a86fa1519c4fc8caa1087f2794411aa23b0
This commit is contained in:
Родитель
3e934c8f5c
Коммит
15fc2d73c6
|
@ -61,13 +61,16 @@ public:
|
|||
|
||||
void DoNotifyFinished()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mFinishPromise.ResolveIfExists(true, __func__);
|
||||
}
|
||||
|
||||
void Forget()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mFinishPromise.ResolveIfExists(true, __func__);
|
||||
AbstractThread::MainThread()->Dispatch(NS_NewRunnableFunction([this] () {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mFinishPromise.ResolveIfExists(true, __func__);
|
||||
}));
|
||||
MutexAutoLock lock(mMutex);
|
||||
mStream = nullptr;
|
||||
}
|
||||
|
@ -123,6 +126,7 @@ public:
|
|||
~DecodedStreamData();
|
||||
void SetPlaying(bool aPlaying);
|
||||
MediaEventSource<int64_t>& OnOutput();
|
||||
void Forget();
|
||||
|
||||
/* The following group of fields are protected by the decoder's monitor
|
||||
* and can be read or written on any thread.
|
||||
|
@ -188,7 +192,6 @@ DecodedStreamData::DecodedStreamData(OutputStreamManager* aOutputStreamManager,
|
|||
DecodedStreamData::~DecodedStreamData()
|
||||
{
|
||||
mOutputStreamManager->Disconnect();
|
||||
mListener->Forget();
|
||||
mStream->Destroy();
|
||||
}
|
||||
|
||||
|
@ -207,6 +210,12 @@ DecodedStreamData::SetPlaying(bool aPlaying)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
DecodedStreamData::Forget()
|
||||
{
|
||||
mListener->Forget();
|
||||
}
|
||||
|
||||
DecodedStream::DecodedStream(AbstractThread* aOwnerThread,
|
||||
MediaQueue<MediaData>& aAudioQueue,
|
||||
MediaQueue<MediaData>& aVideoQueue,
|
||||
|
@ -363,6 +372,7 @@ DecodedStream::DestroyData(UniquePtr<DecodedStreamData> aData)
|
|||
mOutputListener.Disconnect();
|
||||
|
||||
DecodedStreamData* data = aData.release();
|
||||
data->Forget();
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
delete data;
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче