diff options
author | Andreas Huber <andih@google.com> | 2011-01-26 12:08:09 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-26 12:08:09 -0800 |
commit | 2494373e91399a97ad405f4e42dff6543cc296c7 (patch) | |
tree | 275fad2e3ba96cfbae2696d2755dd4f32d99a576 /media/libstagefright | |
parent | fccf727542ac3efa1d75234260db73edb53c76a1 (diff) | |
parent | 43e5eca7048a3b7b3ee0223b7f3cbd837ed10ae5 (diff) | |
download | frameworks_av-2494373e91399a97ad405f4e42dff6543cc296c7.zip frameworks_av-2494373e91399a97ad405f4e42dff6543cc296c7.tar.gz frameworks_av-2494373e91399a97ad405f4e42dff6543cc296c7.tar.bz2 |
Merge "More instrumentation to track down the hardware decoder not shutting down bug." into honeycomb
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/OMXCodec.cpp | 2 | ||||
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 802eaa9..7c6e561 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -3317,7 +3317,7 @@ status_t OMXCodec::stop() { mSource->stop(); - CODEC_LOGV("stopped"); + CODEC_LOGI("stopped in state %d", mState); return OK; } diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index 9b6d441..c7c1409 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -//#define LOG_NDEBUG 0 +#define LOG_NDEBUG 0 #define LOG_TAG "OMXNodeInstance" #include <utils/Log.h> @@ -124,6 +124,8 @@ static status_t StatusFromOMXError(OMX_ERRORTYPE err) { } status_t OMXNodeInstance::freeNode(OMXMaster *master) { + static int32_t kMaxNumIterations = 10; + // Transition the node from its current state all the way down // to "Loaded". // This ensures that all active buffers are properly freed even @@ -143,9 +145,16 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) { LOGV("forcing Executing->Idle"); sendCommand(OMX_CommandStateSet, OMX_StateIdle); OMX_ERRORTYPE err; + int32_t iteration = 0; while ((err = OMX_GetState(mHandle, &state)) == OMX_ErrorNone && state != OMX_StateIdle && state != OMX_StateInvalid) { + if (++iteration > kMaxNumIterations) { + LOGE("component failed to enter Idle state, aborting."); + state = OMX_StateInvalid; + break; + } + usleep(100000); } CHECK_EQ(err, OMX_ErrorNone); @@ -165,9 +174,16 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) { freeActiveBuffers(); OMX_ERRORTYPE err; + int32_t iteration = 0; while ((err = OMX_GetState(mHandle, &state)) == OMX_ErrorNone && state != OMX_StateLoaded && state != OMX_StateInvalid) { + if (++iteration > kMaxNumIterations) { + LOGE("component failed to enter Loaded state, aborting."); + state = OMX_StateInvalid; + break; + } + LOGV("waiting for Loaded state..."); usleep(100000); } @@ -185,8 +201,10 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) { break; } + LOGV("calling destroyComponentInstance"); OMX_ERRORTYPE err = master->destroyComponentInstance( static_cast<OMX_COMPONENTTYPE *>(mHandle)); + LOGV("destroyComponentInstance returned err %d", err); mHandle = NULL; |