Bug 1367980 - don't release decoder in complete state on Fennec. draft
authorAlastor Wu <alwu@mozilla.com>
Fri, 26 May 2017 15:42:20 +0800
changeset 584926 75685548b5d1f2b7d51d3808f7af8be03464f68a
parent 583638 291a11111bdd05c5cd55dd552da4b1285ceba9b2
child 630571 fe9bd9e31e74f687b9bd86c28fdd306a4c03e6ce
push id60941
push useralwu@mozilla.com
push dateFri, 26 May 2017 07:43:42 +0000
bugs1367980, 1367983
Bug 1367980 - don't release decoder in complete state on Fennec. On Android, the life cycle of graphic buffer is equal to Android's codec, and it would be released immediately if we shutdown the decoder. Since the buffer has been release, the memory we access is totally meaningless. The result is we would render the black image on the screen. In addition, I suspect this issue might be one of the root cause which results in lots of timeout for media mochitest, so I would like to land this patch first, and then do the follow-up in bug1367983. MozReview-Commit-ID: 5eZph6MItZs
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1864,19 +1864,22 @@ private:
 class MediaDecoderStateMachine::CompletedState
   : public MediaDecoderStateMachine::StateObject
   explicit CompletedState(Master* aPtr) : StateObject(aPtr) { }
   void Enter()
+    // TODO : use more approriate way to decide whether need to release
+    // resource in bug1367983.
     // We've decoded all samples. We don't need decoders anymore.
     bool hasNextFrame = (!mMaster->HasAudio() || !mMaster->mAudioCompleted)
                         && (!mMaster->HasVideo() || !mMaster->mVideoCompleted);
       hasNextFrame ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
                    : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE);