Bug 1345342: Cancel pending requests. r=jya
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 04 Jun 2017 12:03:25 +0200
changeset 410406 8e78bd3e1e16594191f57bac69f9cd88460aa59d
parent 410405 6e9e40efea3995e0472fd64507b2ee2b4f76d481
child 410407 81e0a353d2dc82c8ea71a5dc26956f292a867895
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1345342
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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>