diff options
author | Marco Nelissen <marcone@google.com> | 2014-08-18 16:13:03 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2014-08-20 01:48:35 +0000 |
commit | 9e2b7918eb5621b24bd54c922f630da45339de77 (patch) | |
tree | 3d265889962c8ccb2ac05b3c4bef57b241736314 /media/libstagefright/MediaCodec.cpp | |
parent | 426c719a5f3b4d88480eb35a7b0b373f672ea3cb (diff) | |
download | frameworks_av-9e2b7918eb5621b24bd54c922f630da45339de77.zip frameworks_av-9e2b7918eb5621b24bd54c922f630da45339de77.tar.gz frameworks_av-9e2b7918eb5621b24bd54c922f630da45339de77.tar.bz2 |
handle error during flush in MediaPlayer.reset()
If there was an error during the flush phase of a reset, then the
reset would never complete. We now make sure the MediaCodec moves
to the right state in this case, and that NuPlayer cleans up and
resumes the rest of the reset after a failed flush.
Bug: 16955082
Change-Id: Ied61136871a9fcdffcc80647fa2bba64a926ac2a
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 42691b9..1181c2b 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -716,7 +716,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { CHECK(msg->findInt32("err", &err)); CHECK(msg->findInt32("actionCode", &actionCode)); - ALOGE("Codec reported err %#x, actionCode %d", err, actionCode); + ALOGE("Codec reported err %#x, actionCode %d, while in state %d", + err, actionCode, mState); if (err == DEAD_OBJECT) { mFlags |= kFlagSawMediaServerDie; } @@ -767,8 +768,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { case FLUSHING: { - setState( - (mFlags & kFlagIsAsync) ? FLUSHED : STARTED); + if (actionCode == ACTION_CODE_FATAL) { + setState(UNINITIALIZED); + } else { + setState( + (mFlags & kFlagIsAsync) ? FLUSHED : STARTED); + } break; } |