summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodec.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-10-22 22:40:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-22 22:40:33 +0000
commit9b3d384753658a2b7985b1f4d124b09a8fb8f3b6 (patch)
treedaaa05148c125c43e84348e094b43e8dead723cb /media/libstagefright/MediaCodec.cpp
parent58f06b5e4fba042c3f94f5ef25b44b829cc3b02e (diff)
parentccaf667eb6e96a28caedb0d4f776b1ff9c4aed10 (diff)
downloadframeworks_av-9b3d384753658a2b7985b1f4d124b09a8fb8f3b6.zip
frameworks_av-9b3d384753658a2b7985b1f4d124b09a8fb8f3b6.tar.gz
frameworks_av-9b3d384753658a2b7985b1f4d124b09a8fb8f3b6.tar.bz2
am ccaf667e: am ffe39811: am 8274b049: am cd3fc4e3: am 6ce19d24: Merge "Stagefright: MediaCodec: shutdown allocated codec on error" into lmp-dev
* commit 'ccaf667eb6e96a28caedb0d4f776b1ff9c4aed10': Stagefright: MediaCodec: shutdown allocated codec on error
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r--media/libstagefright/MediaCodec.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index db3902b..c99ca00 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -748,6 +748,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
err, actionCode, mState);
if (err == DEAD_OBJECT) {
mFlags |= kFlagSawMediaServerDie;
+ mFlags &= ~kFlagIsComponentAllocated;
}
bool sendErrorResponse = true;
@@ -873,6 +874,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
{
CHECK_EQ(mState, INITIALIZING);
setState(INITIALIZED);
+ mFlags |= kFlagIsComponentAllocated;
CHECK(msg->findString("componentName", &mComponentName));
@@ -1146,6 +1148,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
setState(UNINITIALIZED);
mComponentName.clear();
}
+ mFlags &= ~kFlagIsComponentAllocated;
(new AMessage)->postReply(mReplyID);
break;
@@ -1346,9 +1349,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()