diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 1d4abfb69f8e..5c9be8422e3e 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -1113,7 +1113,7 @@ MediaFormatReader::Shutdown() mAudio.mTrackDemuxer->BreakCycles(); mAudio.mTrackDemuxer = nullptr; mAudio.ResetState(); - mShutdownPromisePool->Track(ShutdownDecoderWithPromise(TrackInfo::kAudioTrack)); + ShutdownDecoderWithPromise(TrackInfo::kAudioTrack); } if (HasVideo()) { @@ -1121,7 +1121,7 @@ MediaFormatReader::Shutdown() mVideo.mTrackDemuxer->BreakCycles(); mVideo.mTrackDemuxer = nullptr; mVideo.ResetState(); - mShutdownPromisePool->Track(ShutdownDecoderWithPromise(TrackInfo::kVideoTrack)); + ShutdownDecoderWithPromise(TrackInfo::kVideoTrack); } mShutdownPromisePool->Track(mDemuxer->Shutdown()); @@ -1137,7 +1137,7 @@ MediaFormatReader::Shutdown() &MediaFormatReader::TearDownDecoders); } -RefPtr +void MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack) { LOGV("%s", TrackTypeToStr(aTrack)); @@ -1148,13 +1148,15 @@ MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack) // We always flush the decoder prior to a shutdown to ensure that all the // potentially pending operations on the decoder are completed. decoder.Flush(); - return decoder.mShutdownPromise.Ensure(__func__); + mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__)); + return; } if (decoder.mFlushing || decoder.mShuttingDown) { // Let the current flush or shutdown operation complete, Flush will continue // shutting down the current decoder now that the shutdown promise is set. - return decoder.mShutdownPromise.Ensure(__func__); + mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__)); + return; } if (!decoder.mDecoder) { @@ -1163,12 +1165,12 @@ MediaFormatReader::ShutdownDecoderWithPromise(TrackType aTrack) // This will be a no-op until we're processing the final decoder shutdown // prior to the MediaFormatReader being shutdown. mDecoderFactory->ShutdownDecoder(aTrack); - return ShutdownPromise::CreateAndResolve(true, __func__); + return; } // Finally, let's just shut down the currently active decoder. decoder.ShutdownDecoder(); - return decoder.mShutdownPromise.Ensure(__func__); + mShutdownPromisePool->Track(decoder.mShutdownPromise.Ensure(__func__)); } void @@ -1184,7 +1186,7 @@ MediaFormatReader::ShutdownDecoder(TrackType aTrack) LOGV("Shutdown already in progress"); return; } - Unused << ShutdownDecoderWithPromise(aTrack); + ShutdownDecoderWithPromise(aTrack); } RefPtr diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index 6119d5bf7624..30af56ae9283 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -549,7 +549,7 @@ private: bool mHasStartTime = false; void ShutdownDecoder(TrackType aTrack); - RefPtr ShutdownDecoderWithPromise(TrackType aTrack); + void ShutdownDecoderWithPromise(TrackType aTrack); RefPtr TearDownDecoders(); };