summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorPraveen Chavan <pchavan@codeaurora.org>2014-10-15 02:24:34 -0700
committerLajos Molnar <lajos@google.com>2014-10-21 11:15:08 -0700
commit52dfbee90cc3c4426428318e06a92774f5201198 (patch)
tree3721c673f64eefe2bab9a7065ccc17a6f5109800 /media/libstagefright
parent7de5ac1f067ec61f7ea424d5534cfd40987b11fa (diff)
downloadframeworks_av-52dfbee90cc3c4426428318e06a92774f5201198.zip
frameworks_av-52dfbee90cc3c4426428318e06a92774f5201198.tar.gz
frameworks_av-52dfbee90cc3c4426428318e06a92774f5201198.tar.bz2
Stagefright: MediaCodec: shutdown allocated codec on error
If MediaCodec sees a fatal error and transitions to UNINITIALIZED state, The codec may still be alive (with an exception of 'mediaserver-died' error). Handle Shutdown of the codec during release(). Bug: 17784012 Bug: 18033275 Change-Id: I891e036499d9b440a57f77fb735a5ba4da9a6e43
Diffstat (limited to 'media/libstagefright')
-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 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()