summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/OMXCodec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/OMXCodec.cpp')
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index f9cb882..7e55790 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -3618,11 +3618,24 @@ status_t OMXCodec::stop() {
mAsyncCompletion.wait(mLock);
}
+ bool isError = false;
switch (mState) {
case LOADED:
- case ERROR:
break;
+ case ERROR:
+ {
+ OMX_STATETYPE state = OMX_StateInvalid;
+ status_t err = mOMX->getState(mNode, &state);
+ CHECK_EQ(err, (status_t)OK);
+
+ if (state != OMX_StateExecuting) {
+ break;
+ }
+ // else fall through to the idling code
+ isError = true;
+ }
+
case EXECUTING:
{
setState(EXECUTING_TO_IDLE);
@@ -3657,6 +3670,12 @@ status_t OMXCodec::stop() {
mAsyncCompletion.wait(mLock);
}
+ if (isError) {
+ // We were in the ERROR state coming in, so restore that now
+ // that we've idled the OMX component.
+ setState(ERROR);
+ }
+
break;
}