am 745602d8: Merge "MediaCodec: Prevent stop() in the UNINITIALIZED state" into lmp-mr1-dev automerge: 8bc9b3a
automerge: 3584a1a
* commit '3584a1afb3f263a13d12cc2d8003101c74453ce3':
MediaCodec: Prevent stop() in the UNINITIALIZED state
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 673d375..3622eb7 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1359,9 +1359,12 @@
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