From b1d666f5cb555d135eb69e005e88a03330bbb54c Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Wed, 19 Oct 2011 21:14:13 -0700 Subject: Stagefright: idle OMX after ANW errors This change fixes an issue in Stagefright where the state of an OMXCodec object can get out of sync with the state of the OMX component. In particular, if one of the ANativeWindow functions failed and put the OMXCodec into the ERROR state, this would cause Stagefright to skip doing the Executing -> Idle transition. Without this transition the freeBuffersOnPort call would never be made, and the MediaBuffers would end up being leaked (which would also leak the Gralloc buffers they reference). Bug: 5333695 Change-Id: I85ea0cf92d18e7ef6d35c7d1e2a7b4e2c9745d34 --- media/libstagefright/omx/OMX.cpp | 6 ++++++ media/libstagefright/omx/OMXNodeInstance.cpp | 8 ++++++++ 2 files changed, 14 insertions(+) (limited to 'media/libstagefright/omx') diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index 33d3f30..3715fe9 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -303,6 +303,12 @@ status_t OMX::setConfig( index, params, size); } +status_t OMX::getState( + node_id node, OMX_STATETYPE* state) { + return findInstance(node)->getState( + state); +} + status_t OMX::enableGraphicBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) { return findInstance(node)->enableGraphicBuffers(port_index, enable); diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index b612f89..0ff398a 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -266,6 +266,14 @@ status_t OMXNodeInstance::setConfig( return StatusFromOMXError(err); } +status_t OMXNodeInstance::getState(OMX_STATETYPE* state) { + Mutex::Autolock autoLock(mLock); + + OMX_ERRORTYPE err = OMX_GetState(mHandle, state); + + return StatusFromOMXError(err); +} + status_t OMXNodeInstance::enableGraphicBuffers( OMX_U32 portIndex, OMX_BOOL enable) { Mutex::Autolock autoLock(mLock); -- cgit v1.1