summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodec.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-11-03 17:06:30 -0800
committerAndy Hung <hunga@google.com>2014-11-04 10:32:44 -0800
commit33223c4f97abb78fa8c92e1b8c817546f15d97e1 (patch)
tree0ab28f3a0fe33bbd6553f5914cc49b395814f6e8 /media/libstagefright/MediaCodec.cpp
parentb9b21bc11bfb6e77cc0f9e9a31de02342ab9d653 (diff)
downloadframeworks_av-33223c4f97abb78fa8c92e1b8c817546f15d97e1.zip
frameworks_av-33223c4f97abb78fa8c92e1b8c817546f15d97e1.tar.gz
frameworks_av-33223c4f97abb78fa8c92e1b8c817546f15d97e1.tar.bz2
MediaCodec: Prevent stop() in the UNINITIALIZED state
Return INVALID_OPERATION instead. This is a corner case when the decoder is still allocated, occurring after codec error. Bug: 18121124 Change-Id: If87e44dd40db48f63f965b765205f1e733663efd
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r--media/libstagefright/MediaCodec.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index df47bd5..b3c12bf 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1339,9 +1339,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
uint32_t replyID;
CHECK(msg->senderAwaitsResponse(&replyID));
- if (!(mFlags & kFlagIsComponentAllocated) && mState != INITIALIZED
+ if (!((mFlags & kFlagIsComponentAllocated) && targetState == UNINITIALIZED) // See 1
+ && mState != INITIALIZED
&& mState != CONFIGURED && !isExecuting()) {
- // We may be in "UNINITIALIZED" state already and
+ // 1) Permit release to shut down the component if allocated.
+ //
+ // 2) 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