am 373d357a: Merge "More instrumentation to track down the hardware decoder not shutting down bug." into honeycomb

* commit '373d357a8b13dc2cdc82d9e1d6144fb26e3bb202':
  More instrumentation to track down the hardware decoder not shutting down bug.
This commit is contained in:
Andreas Huber
2011-01-26 12:10:00 -08:00
committed by Android Git Automerger
2 changed files with 20 additions and 2 deletions

View File

@@ -3317,7 +3317,7 @@ status_t OMXCodec::stop() {
mSource->stop(); mSource->stop();
CODEC_LOGV("stopped"); CODEC_LOGI("stopped in state %d", mState);
return OK; return OK;
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
//#define LOG_NDEBUG 0 #define LOG_NDEBUG 0
#define LOG_TAG "OMXNodeInstance" #define LOG_TAG "OMXNodeInstance"
#include <utils/Log.h> #include <utils/Log.h>
@@ -124,6 +124,8 @@ static status_t StatusFromOMXError(OMX_ERRORTYPE err) {
} }
status_t OMXNodeInstance::freeNode(OMXMaster *master) { status_t OMXNodeInstance::freeNode(OMXMaster *master) {
static int32_t kMaxNumIterations = 10;
// Transition the node from its current state all the way down // Transition the node from its current state all the way down
// to "Loaded". // to "Loaded".
// This ensures that all active buffers are properly freed even // This ensures that all active buffers are properly freed even
@@ -143,9 +145,16 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) {
LOGV("forcing Executing->Idle"); LOGV("forcing Executing->Idle");
sendCommand(OMX_CommandStateSet, OMX_StateIdle); sendCommand(OMX_CommandStateSet, OMX_StateIdle);
OMX_ERRORTYPE err; OMX_ERRORTYPE err;
int32_t iteration = 0;
while ((err = OMX_GetState(mHandle, &state)) == OMX_ErrorNone while ((err = OMX_GetState(mHandle, &state)) == OMX_ErrorNone
&& state != OMX_StateIdle && state != OMX_StateIdle
&& state != OMX_StateInvalid) { && state != OMX_StateInvalid) {
if (++iteration > kMaxNumIterations) {
LOGE("component failed to enter Idle state, aborting.");
state = OMX_StateInvalid;
break;
}
usleep(100000); usleep(100000);
} }
CHECK_EQ(err, OMX_ErrorNone); CHECK_EQ(err, OMX_ErrorNone);
@@ -165,9 +174,16 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) {
freeActiveBuffers(); freeActiveBuffers();
OMX_ERRORTYPE err; OMX_ERRORTYPE err;
int32_t iteration = 0;
while ((err = OMX_GetState(mHandle, &state)) == OMX_ErrorNone while ((err = OMX_GetState(mHandle, &state)) == OMX_ErrorNone
&& state != OMX_StateLoaded && state != OMX_StateLoaded
&& state != OMX_StateInvalid) { && state != OMX_StateInvalid) {
if (++iteration > kMaxNumIterations) {
LOGE("component failed to enter Loaded state, aborting.");
state = OMX_StateInvalid;
break;
}
LOGV("waiting for Loaded state..."); LOGV("waiting for Loaded state...");
usleep(100000); usleep(100000);
} }
@@ -185,8 +201,10 @@ status_t OMXNodeInstance::freeNode(OMXMaster *master) {
break; break;
} }
LOGV("calling destroyComponentInstance");
OMX_ERRORTYPE err = master->destroyComponentInstance( OMX_ERRORTYPE err = master->destroyComponentInstance(
static_cast<OMX_COMPONENTTYPE *>(mHandle)); static_cast<OMX_COMPONENTTYPE *>(mHandle));
LOGV("destroyComponentInstance returned err %d", err);
mHandle = NULL; mHandle = NULL;