Bug 1371202. P2 - don't release decoders if we are looping since we will need them soon. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 08 Jun 2017 11:42:43 +0800
changeset 592380 4a4f372aa82a2aa22deea6dc58bb2ce6402732da
parent 592379 c68dae62eb37e71de0be41e8c61a4530d75969c3
child 592449 aa48525908fde82267eb717f467fbc0a34a947ac
push id63361
push userjwwang@mozilla.com
push dateMon, 12 Jun 2017 06:07:22 +0000
bugs1371202
milestone55.0a1
Bug 1371202. P2 - don't release decoders if we are looping since we will need them soon. MozReview-Commit-ID: L1hOBytfENK
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1905,18 +1905,21 @@ class MediaDecoderStateMachine::Complete
 public:
   explicit CompletedState(Master* aPtr) : StateObject(aPtr) { }
 
   void Enter()
   {
     // TODO : use more approriate way to decide whether need to release
     // resource in bug1367983.
 #ifndef MOZ_WIDGET_ANDROID
-    // We've decoded all samples. We don't need decoders anymore.
-    Reader()->ReleaseResources();
+    if (!mMaster->mLooping) {
+      // We've decoded all samples.
+      // We don't need decoders anymore if not looping.
+      Reader()->ReleaseResources();
+    }
 #endif
     bool hasNextFrame = (!mMaster->HasAudio() || !mMaster->mAudioCompleted)
                         && (!mMaster->HasVideo() || !mMaster->mVideoCompleted);
 
     mMaster->UpdateNextFrameStatus(
       hasNextFrame ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
                    : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE);