diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-11-10 21:52:32 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-11-10 21:52:32 -0800 |
commit | 2132505a5a95c85d0b7f9195d60332bff54d13af (patch) | |
tree | 378570560465a9196c0cc7e507f0f78053d09049 | |
parent | 898d55ba5c1467c615efdf6d553c4a3bf62aeb25 (diff) | |
parent | 5918d3601f5711671a6fb5ccc2f65a931aae33eb (diff) | |
download | frameworks_av-2132505a5a95c85d0b7f9195d60332bff54d13af.zip frameworks_av-2132505a5a95c85d0b7f9195d60332bff54d13af.tar.gz frameworks_av-2132505a5a95c85d0b7f9195d60332bff54d13af.tar.bz2 |
Merge "libstagefright: omx: Prevent assertion due to state mismatches"
-rw-r--r-- | media/libstagefright/include/SimpleSoftOMXComponent.h | 1 | ||||
-rw-r--r-- | media/libstagefright/omx/SimpleSoftOMXComponent.cpp | 44 |
2 files changed, 41 insertions, 4 deletions
diff --git a/media/libstagefright/include/SimpleSoftOMXComponent.h b/media/libstagefright/include/SimpleSoftOMXComponent.h index 591b38e..6a0a958 100644 --- a/media/libstagefright/include/SimpleSoftOMXComponent.h +++ b/media/libstagefright/include/SimpleSoftOMXComponent.h @@ -140,6 +140,7 @@ private: void onPortFlush(OMX_U32 portIndex, bool sendFlushComplete); void checkTransitions(); + void onTransitionError(); DISALLOW_EVIL_CONSTRUCTORS(SimpleSoftOMXComponent); }; diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp index e6a0c49..1fd0641 100644 --- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp +++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp @@ -417,16 +417,43 @@ void SimpleSoftOMXComponent::onSendCommand( } } +void SimpleSoftOMXComponent::onTransitionError() { + mState = OMX_StateInvalid; + mTargetState = OMX_StateInvalid; + notify(OMX_EventError, OMX_CommandStateSet, OMX_StateInvalid, 0); +} + void SimpleSoftOMXComponent::onChangeState(OMX_STATETYPE state) { + bool skipTransitions = false; + // We shouldn't be in a state transition already. - CHECK_EQ((int)mState, (int)mTargetState); + if (mState != mTargetState) { + // Workaround to prevent assertion + // XXX CHECK_EQ((int)mState, (int)mTargetState); + ALOGW("mState %d != mTargetState %d", mState, mTargetState); + skipTransitions = true; + onTransitionError(); + } switch (mState) { case OMX_StateLoaded: - CHECK_EQ((int)state, (int)OMX_StateIdle); + if (state != OMX_StateIdle) { + // Workaround to prevent assertion + // XXX CHECK_EQ((int)state, (int)OMX_StateIdle); + ALOGW("In OMX_StateLoaded, state %d != OMX_StateIdle", state); + skipTransitions = true; + onTransitionError(); + } break; case OMX_StateIdle: - CHECK(state == OMX_StateLoaded || state == OMX_StateExecuting); + if (!(state == OMX_StateLoaded || state == OMX_StateExecuting)) { + // Workaround to prevent assertion + // XXX CHECK(state == OMX_StateLoaded || state == OMX_StateExecuting); + ALOGW("In OMX_StateIdle, state %d != OMX_StateLoaded||OMX_StateExecuting", + state); + skipTransitions = true; + onTransitionError(); + } break; case OMX_StateExecuting: { @@ -440,11 +467,20 @@ void SimpleSoftOMXComponent::onChangeState(OMX_STATETYPE state) { notify(OMX_EventCmdComplete, OMX_CommandStateSet, state, NULL); break; } - + case OMX_StateInvalid: { + ALOGW("In OMX_StateInvalid, ignore state transition to %d", state); + skipTransitions = true; + onTransitionError(); + break; + } default: TRESPASS(); } + if (skipTransitions) { + return; + } + mTargetState = state; checkTransitions(); |