Bug 1345342: Cancel pending requests. r=jya draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 04 Jun 2017 12:03:25 +0200
changeset 588871 7be69dd94b6d3e15cf76791f66a342ab2a8da78b
parent 588678 8c5e9d525369d82198425270af5c299d588c6462
child 631711 ab044a92c0f5b1387d0f519a18b96e964accca76
push id62190
push userbmo:jyavenard@mozilla.com
push dateMon, 05 Jun 2017 08:23:29 +0000
reviewersjya
bugs1345342
milestone55.0a1
Bug 1345342: Cancel pending requests. r=jya If the pending first frame decoding was cancelled, the next call to decode could lead to a crash. MozReview-Commit-ID: 6Q4eKUzqOly
dom/media/platforms/wrappers/H264Converter.cpp
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -126,16 +126,20 @@ H264Converter::Decode(MediaRawData* aSam
   aSample->mExtraData = mCurrentConfig.mExtraData;
 
   return mDecoder->Decode(aSample);
 }
 
 RefPtr<MediaDataDecoder::FlushPromise>
 H264Converter::Flush()
 {
+  mDecodePromiseRequest.DisconnectIfExists();
+  mFlushRequest.DisconnectIfExists();
+  mShutdownRequest.DisconnectIfExists();
+  mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
   mNeedKeyframe = true;
   if (mDecoder) {
     return mDecoder->Flush();
   }
   return FlushPromise::CreateAndResolve(true, __func__);
 }
 
 RefPtr<MediaDataDecoder::DecodePromise>