mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
bug 1095251 clear mDecoder on reader during Shutdown() r=cpearce
--HG-- extra : rebase_source : 7bd0c13ca1aa821998f6ec46ba578c6ed8a0d8f9
This commit is contained in:
parent
1891ba4549
commit
1d41559e74
@ -86,6 +86,7 @@ MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
|
||||
MediaDecoderReader::~MediaDecoderReader()
|
||||
{
|
||||
MOZ_ASSERT(mShutdown);
|
||||
MOZ_ASSERT(!mDecoder);
|
||||
ResetDecode();
|
||||
MOZ_COUNT_DTOR(MediaDecoderReader);
|
||||
}
|
||||
@ -317,6 +318,8 @@ MediaDecoderReader::Shutdown()
|
||||
p = ShutdownPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
mDecoder = nullptr;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReader)
|
||||
|
||||
// The caller must ensure that Shutdown() is called before aDecoder is
|
||||
// destroyed.
|
||||
explicit MediaDecoderReader(AbstractMediaDecoder* aDecoder);
|
||||
|
||||
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
|
||||
@ -251,10 +253,6 @@ public:
|
||||
return mTaskQueue;
|
||||
}
|
||||
|
||||
void ClearDecoder() {
|
||||
mDecoder = nullptr;
|
||||
}
|
||||
|
||||
// Returns true if the reader implements RequestAudioData()
|
||||
// and RequestVideoData() asynchronously, rather than using the
|
||||
// implementation in this class to adapt the old synchronous to
|
||||
|
@ -849,7 +849,6 @@ public:
|
||||
// so that it can't accidentally read it after the decoder
|
||||
// is destroyed.
|
||||
mDecoder->GetReader()->Shutdown();
|
||||
mDecoder->GetReader()->ClearDecoder();
|
||||
RefPtr<nsIRunnable> task = new ReleaseDecoderTask(mDecoder);
|
||||
mDecoder = nullptr;
|
||||
// task now holds the only ref to the decoder.
|
||||
|
Loading…
Reference in New Issue
Block a user