diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index f6220cee495c..4a22c4e8579e 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -504,11 +504,15 @@ void MediaFormatReader::DisableHardwareAcceleration() { MOZ_ASSERT(OnTaskQueue()); - if (HasVideo() && mSharedDecoderManager) { - mSharedDecoderManager->DisableHardwareAcceleration(); - - if (!mSharedDecoderManager->Recreate(mInfo.mVideo)) { - mVideo.mError = true; + if (HasVideo()) { + mPlatform->DisableHardwareAcceleration(); + Flush(TrackInfo::kVideoTrack); + mVideo.mDecoder->Shutdown(); + mVideo.mDecoder = nullptr; + if (!EnsureDecodersSetup()) { + LOG("Unable to re-create decoder, aborting"); + NotifyError(TrackInfo::kVideoTrack); + return; } ScheduleUpdate(TrackInfo::kVideoTrack); }