Handle idle->loaded state transition when loaded->idle is still in progress am: c5e316d4ef am: fd3ca8acd4
am: e1e7a5a1e2
Change-Id: Iccb6a413f3688c74fdcb6b8cc437428aa36bb909
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
index f523b97..761b425 100644
--- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
@@ -441,7 +441,19 @@
}
void SimpleSoftOMXComponent::onChangeState(OMX_STATETYPE state) {
+ ALOGV("%p requesting change from %d to %d", this, mState, state);
// We shouldn't be in a state transition already.
+
+ if (mState == OMX_StateLoaded
+ && mTargetState == OMX_StateIdle
+ && state == OMX_StateLoaded) {
+ // OMX specifically allows "canceling" a state transition from loaded
+ // to idle. Pretend we made it to idle, and go back to loaded
+ ALOGV("load->idle canceled");
+ mState = mTargetState = OMX_StateIdle;
+ state = OMX_StateLoaded;
+ }
+
CHECK_EQ((int)mState, (int)mTargetState);
switch (mState) {
@@ -621,6 +633,7 @@
}
if (transitionComplete) {
+ ALOGV("state transition from %d to %d complete", mState, mTargetState);
mState = mTargetState;
if (mState == OMX_StateLoaded) {
@@ -628,6 +641,8 @@
}
notify(OMX_EventCmdComplete, OMX_CommandStateSet, mState, NULL);
+ } else {
+ ALOGV("state transition from %d to %d not yet complete", mState, mTargetState);
}
}