summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IOMX.cpp
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-10-19 21:14:13 -0700
committerJamie Gennis <jgennis@google.com>2011-10-19 21:22:19 -0700
commitb1d666f5cb555d135eb69e005e88a03330bbb54c (patch)
tree573c9d484c210cfc7104d94f2f630cae0b70bb01 /media/libmedia/IOMX.cpp
parent3c57859f03ce9257128e3b2cd29a906b8f9a6aa5 (diff)
downloadframeworks_av-b1d666f5cb555d135eb69e005e88a03330bbb54c.zip
frameworks_av-b1d666f5cb555d135eb69e005e88a03330bbb54c.tar.gz
frameworks_av-b1d666f5cb555d135eb69e005e88a03330bbb54c.tar.bz2
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
Diffstat (limited to 'media/libmedia/IOMX.cpp')
-rw-r--r--media/libmedia/IOMX.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index d3aab08..7d2fbce 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -38,6 +38,7 @@ enum {
SET_PARAMETER,
GET_CONFIG,
SET_CONFIG,
+ GET_STATE,
ENABLE_GRAPHIC_BUFFERS,
USE_BUFFER,
USE_GRAPHIC_BUFFER,
@@ -198,6 +199,17 @@ public:
return reply.readInt32();
}
+ virtual status_t getState(
+ node_id node, OMX_STATETYPE* state) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
+ data.writeIntPtr((intptr_t)node);
+ remote()->transact(GET_STATE, data, &reply);
+
+ *state = static_cast<OMX_STATETYPE>(reply.readInt32());
+ return reply.readInt32();
+ }
+
virtual status_t enableGraphicBuffers(
node_id node, OMX_U32 port_index, OMX_BOOL enable) {
Parcel data, reply;
@@ -524,6 +536,20 @@ status_t BnOMX::onTransact(
return NO_ERROR;
}
+ case GET_STATE:
+ {
+ CHECK_INTERFACE(IOMX, data, reply);
+
+ node_id node = (void*)data.readIntPtr();
+ OMX_STATETYPE state = OMX_StateInvalid;
+
+ status_t err = getState(node, &state);
+ reply->writeInt32(state);
+ reply->writeInt32(err);
+
+ return NO_ERROR;
+ }
+
case ENABLE_GRAPHIC_BUFFERS:
{
CHECK_INTERFACE(IOMX, data, reply);