Bug 1295541 - Move mInitPromise.DisconnectIfExists() into DecoderData::ShutdownDecoder(). r=jya
authorJW Wang <jwwang@mozilla.com>
Tue, 16 Aug 2016 19:08:24 +0800
changeset 309781 c239558f86a3f6203a03704a7e8c9830e260bf2c
parent 309780 5f9021b0c9015170d514d2efdb6256fd5dcdf66c
child 309782 ac0f73714b99f1fdd88778509680b8dede954fdf
push id20333
push userkwierso@gmail.com
push dateThu, 18 Aug 2016 00:26:40 +0000
treeherderfx-team@11c94ec980d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1295541
milestone51.0a1
Bug 1295541 - Move mInitPromise.DisconnectIfExists() into DecoderData::ShutdownDecoder(). r=jya MozReview-Commit-ID: 67MvFfSU73X
dom/media/MediaFormatReader.cpp
dom/media/MediaFormatReader.h
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -98,17 +98,16 @@ MediaFormatReader::Shutdown()
   mSeekPromise.RejectIfExists(NS_ERROR_FAILURE, __func__);
   mSkipRequest.DisconnectIfExists();
 
   if (mAudio.mDecoder) {
     Reset(TrackInfo::kAudioTrack);
     if (mAudio.HasPromise()) {
       mAudio.RejectPromise(CANCELED, __func__);
     }
-    mAudio.mInitPromise.DisconnectIfExists();
     mAudio.ShutdownDecoder();
   }
   if (mAudio.mTrackDemuxer) {
     mAudio.ResetDemuxer();
     mAudio.mTrackDemuxer->BreakCycles();
     mAudio.mTrackDemuxer = nullptr;
   }
   if (mAudio.mTaskQueue) {
@@ -118,17 +117,16 @@ MediaFormatReader::Shutdown()
   }
   MOZ_ASSERT(!mAudio.HasPromise());
 
   if (mVideo.mDecoder) {
     Reset(TrackInfo::kVideoTrack);
     if (mVideo.HasPromise()) {
       mVideo.RejectPromise(CANCELED, __func__);
     }
-    mVideo.mInitPromise.DisconnectIfExists();
     mVideo.ShutdownDecoder();
   }
   if (mVideo.mTrackDemuxer) {
     mVideo.ResetDemuxer();
     mVideo.mTrackDemuxer->BreakCycles();
     mVideo.mTrackDemuxer = nullptr;
   }
   if (mVideo.mTaskQueue) {
@@ -1966,20 +1964,17 @@ MediaFormatReader::UpdateBufferedWithPro
 
 void MediaFormatReader::ReleaseMediaResources()
 {
   // Before freeing a video codec, all video buffers needed to be released
   // even from graphics pipeline.
   if (mVideoFrameContainer) {
     mVideoFrameContainer->ClearCurrentFrame();
   }
-  mVideo.mInitPromise.DisconnectIfExists();
   mVideo.ShutdownDecoder();
-
-  mAudio.mInitPromise.DisconnectIfExists();
   mAudio.ShutdownDecoder();
 }
 
 bool
 MediaFormatReader::VideoIsHardwareAccelerated() const
 {
   return mVideo.mIsHardwareAccelerated;
 }
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -271,16 +271,17 @@ private:
 
     // Monitor protecting mDescription and mDecoder.
     Monitor mMonitor;
     // The platform decoder.
     RefPtr<MediaDataDecoder> mDecoder;
     const char* mDescription;
     void ShutdownDecoder()
     {
+      mInitPromise.DisconnectIfExists();
       MonitorAutoLock mon(mMonitor);
       if (mDecoder) {
         mDecoder->Shutdown();
       }
       mDescription = "shutdown";
       mDecoder = nullptr;
     }