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
{
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();
-
+#endif
bool hasNextFrame = (!mMaster->HasAudio() || !mMaster->mAudioCompleted)
&& (!mMaster->HasVideo() || !mMaster->mVideoCompleted);
mMaster->UpdateNextFrameStatus(
hasNextFrame ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
: MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE);
Step();