Bug 1374210: Reject/Cancel any pending operations. r=gerald

MozReview-Commit-ID: GVlzm2GWT1D

--HG--
extra : rebase_source : a94491b69960a2679ae20433461ecb51e1821b15
This commit is contained in:
Jean-Yves Avenard 2017-06-19 10:38:22 +02:00
parent b599411285
commit 851b08981f
2 changed files with 12 additions and 3 deletions

View File

@ -192,16 +192,24 @@ H264Converter::Shutdown()
{
mInitPromiseRequest.DisconnectIfExists();
mDecodePromiseRequest.DisconnectIfExists();
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mDrainRequest.DisconnectIfExists();
mFlushRequest.DisconnectIfExists();
mShutdownRequest.DisconnectIfExists();
mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mNeedAVCC.reset();
mShutdownRequest.DisconnectIfExists();
if (mShutdownPromise) {
// We have a shutdown in progress, return that promise instead as we can't
// shutdown a decoder twice.
return mShutdownPromise.forget();
}
return ShutdownDecoder();
}
RefPtr<ShutdownPromise>
H264Converter::ShutdownDecoder()
{
mNeedAVCC.reset();
if (mDecoder) {
RefPtr<MediaDataDecoder> decoder = mDecoder.forget();
return decoder->Shutdown();
@ -479,7 +487,7 @@ void H264Converter::FlushThenShutdownDecoder(MediaRawData* aPendingSample)
return;
}
mShutdownPromise = Shutdown();
mShutdownPromise = ShutdownDecoder();
mShutdownPromise
->Then(AbstractThread::GetCurrent()->AsTaskQueue(),
__func__,

View File

@ -76,6 +76,7 @@ private:
void DecodeFirstSample(MediaRawData* aSample);
void DrainThenFlushDecoder(MediaRawData* aPendingSample);
void FlushThenShutdownDecoder(MediaRawData* aPendingSample);
RefPtr<ShutdownPromise> ShutdownDecoder();
RefPtr<PlatformDecoderModule> mPDM;
const VideoInfo mOriginalConfig;