Loading media/libstagefright/MediaCodec.cpp +15 −9 Original line number Original line Diff line number Diff line Loading @@ -780,7 +780,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // STOPPING->UNINITIALIZED, instead of the // STOPPING->UNINITIALIZED, instead of the // usual STOPPING->INITIALIZED state. // usual STOPPING->INITIALIZED state. setState(UNINITIALIZED); setState(UNINITIALIZED); if (mState == RELEASING) { mComponentName.clear(); } (new AMessage)->postReply(mReplyID); (new AMessage)->postReply(mReplyID); } } break; break; Loading Loading @@ -1046,7 +1048,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } } if (mFlags & kFlagIsAsync) { if (mFlags & kFlagIsAsync) { if (!mHaveInputSurface) { onInputBufferAvailable(); onInputBufferAvailable(); } } else if (mFlags & kFlagDequeueInputPending) { } else if (mFlags & kFlagDequeueInputPending) { CHECK(handleDequeueInputBuffer(mDequeueInputReplyID)); CHECK(handleDequeueInputBuffer(mDequeueInputReplyID)); Loading Loading @@ -1130,6 +1134,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } else { } else { CHECK_EQ(mState, RELEASING); CHECK_EQ(mState, RELEASING); setState(UNINITIALIZED); setState(UNINITIALIZED); mComponentName.clear(); } } (new AMessage)->postReply(mReplyID); (new AMessage)->postReply(mReplyID); Loading Loading @@ -1339,12 +1344,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // after stop() returned, it would be safe to call release() // after stop() returned, it would be safe to call release() // and it should be in this case, no harm to allow a release() // and it should be in this case, no harm to allow a release() // if we're already uninitialized. // if we're already uninitialized. // Similarly stopping a stopped MediaCodec should be benign. sp<AMessage> response = new AMessage; sp<AMessage> response = new AMessage; response->setInt32( status_t err = mState == targetState ? OK : INVALID_OPERATION; "err", response->setInt32("err", err); mState == targetState ? OK : INVALID_OPERATION); if (err == OK && targetState == UNINITIALIZED) { mComponentName.clear(); } response->postReply(replyID); response->postReply(replyID); break; break; } } Loading @@ -1353,6 +1358,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // It's dead, Jim. Don't expect initiateShutdown to yield // It's dead, Jim. Don't expect initiateShutdown to yield // any useful results now... // any useful results now... setState(UNINITIALIZED); setState(UNINITIALIZED); if (targetState == UNINITIALIZED) { mComponentName.clear(); } (new AMessage)->postReply(replyID); (new AMessage)->postReply(replyID); break; break; } } Loading Loading @@ -1745,8 +1753,6 @@ void MediaCodec::setState(State newState) { // return any straggling buffers, e.g. if we got here on an error // return any straggling buffers, e.g. if we got here on an error returnBuffersToCodec(); returnBuffersToCodec(); mComponentName.clear(); // The component is gone, mediaserver's probably back up already // The component is gone, mediaserver's probably back up already // but should definitely be back up should we try to instantiate // but should definitely be back up should we try to instantiate // another component.. and the cycle continues. // another component.. and the cycle continues. Loading Loading
media/libstagefright/MediaCodec.cpp +15 −9 Original line number Original line Diff line number Diff line Loading @@ -780,7 +780,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // STOPPING->UNINITIALIZED, instead of the // STOPPING->UNINITIALIZED, instead of the // usual STOPPING->INITIALIZED state. // usual STOPPING->INITIALIZED state. setState(UNINITIALIZED); setState(UNINITIALIZED); if (mState == RELEASING) { mComponentName.clear(); } (new AMessage)->postReply(mReplyID); (new AMessage)->postReply(mReplyID); } } break; break; Loading Loading @@ -1046,7 +1048,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } } if (mFlags & kFlagIsAsync) { if (mFlags & kFlagIsAsync) { if (!mHaveInputSurface) { onInputBufferAvailable(); onInputBufferAvailable(); } } else if (mFlags & kFlagDequeueInputPending) { } else if (mFlags & kFlagDequeueInputPending) { CHECK(handleDequeueInputBuffer(mDequeueInputReplyID)); CHECK(handleDequeueInputBuffer(mDequeueInputReplyID)); Loading Loading @@ -1130,6 +1134,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } else { } else { CHECK_EQ(mState, RELEASING); CHECK_EQ(mState, RELEASING); setState(UNINITIALIZED); setState(UNINITIALIZED); mComponentName.clear(); } } (new AMessage)->postReply(mReplyID); (new AMessage)->postReply(mReplyID); Loading Loading @@ -1339,12 +1344,12 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // after stop() returned, it would be safe to call release() // after stop() returned, it would be safe to call release() // and it should be in this case, no harm to allow a release() // and it should be in this case, no harm to allow a release() // if we're already uninitialized. // if we're already uninitialized. // Similarly stopping a stopped MediaCodec should be benign. sp<AMessage> response = new AMessage; sp<AMessage> response = new AMessage; response->setInt32( status_t err = mState == targetState ? OK : INVALID_OPERATION; "err", response->setInt32("err", err); mState == targetState ? OK : INVALID_OPERATION); if (err == OK && targetState == UNINITIALIZED) { mComponentName.clear(); } response->postReply(replyID); response->postReply(replyID); break; break; } } Loading @@ -1353,6 +1358,9 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { // It's dead, Jim. Don't expect initiateShutdown to yield // It's dead, Jim. Don't expect initiateShutdown to yield // any useful results now... // any useful results now... setState(UNINITIALIZED); setState(UNINITIALIZED); if (targetState == UNINITIALIZED) { mComponentName.clear(); } (new AMessage)->postReply(replyID); (new AMessage)->postReply(replyID); break; break; } } Loading Loading @@ -1745,8 +1753,6 @@ void MediaCodec::setState(State newState) { // return any straggling buffers, e.g. if we got here on an error // return any straggling buffers, e.g. if we got here on an error returnBuffersToCodec(); returnBuffersToCodec(); mComponentName.clear(); // The component is gone, mediaserver's probably back up already // The component is gone, mediaserver's probably back up already // but should definitely be back up should we try to instantiate // but should definitely be back up should we try to instantiate // another component.. and the cycle continues. // another component.. and the cycle continues. Loading