diff options
author | Lajos Molnar <lajos@google.com> | 2014-10-22 00:29:29 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-22 00:29:30 +0000 |
commit | 6ce19d24ff985cf845f04c2d6542ce03c7d07964 (patch) | |
tree | 3114f4e75c63fd0aaa9f9195f34f6299106aa44b /media | |
parent | f592671336be0a061799033e47ceeacb648ed3bf (diff) | |
parent | 52dfbee90cc3c4426428318e06a92774f5201198 (diff) | |
download | frameworks_av-6ce19d24ff985cf845f04c2d6542ce03c7d07964.zip frameworks_av-6ce19d24ff985cf845f04c2d6542ce03c7d07964.tar.gz frameworks_av-6ce19d24ff985cf845f04c2d6542ce03c7d07964.tar.bz2 |
Merge "Stagefright: MediaCodec: shutdown allocated codec on error" into lmp-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 5f55484..df47bd5 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -738,6 +738,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { err, actionCode, mState); if (err == DEAD_OBJECT) { mFlags |= kFlagSawMediaServerDie; + mFlags &= ~kFlagIsComponentAllocated; } bool sendErrorResponse = true; @@ -863,6 +864,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { { CHECK_EQ(mState, INITIALIZING); setState(INITIALIZED); + mFlags |= kFlagIsComponentAllocated; CHECK(msg->findString("componentName", &mComponentName)); @@ -1136,6 +1138,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { setState(UNINITIALIZED); mComponentName.clear(); } + mFlags &= ~kFlagIsComponentAllocated; (new AMessage)->postReply(mReplyID); break; @@ -1336,9 +1339,10 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { uint32_t replyID; CHECK(msg->senderAwaitsResponse(&replyID)); - if (mState != INITIALIZED + if (!(mFlags & kFlagIsComponentAllocated) && mState != INITIALIZED && mState != CONFIGURED && !isExecuting()) { - // We may be in "UNINITIALIZED" state already without the + // We may be in "UNINITIALIZED" state already and + // also shutdown the encoder/decoder without the // client being aware of this if media server died while // we were being stopped. The client would assume that // after stop() returned, it would be safe to call release() |