summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-12 20:02:53 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-13 09:38:03 +0100
commit1ebd34e63707e878ac06af2cda6a1a724a6bf61c (patch)
tree63b3fd7f3592438bf6a02e62975cdab9cee6542e
parentf4ad6e08580b8b755b3761d67c60a5498264cda0 (diff)
downloadgst-omx-1ebd34e63707e878ac06af2cda6a1a724a6bf61c.tar.gz
omxvideodec: Make sure to always get the right buffer
-rw-r--r--omx/gstomxvideodec.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index 6e21fa2..b190dbb 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -487,6 +487,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
if (pool->port->port_def.eDir == OMX_DirOutput) {
GstBuffer *buf;
GstBufferPoolAcquireParams int_params = *params;
+ GList *free_buffers = NULL;
int_params.flags |= GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT;
@@ -500,14 +501,17 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
GST_BUFFER_POOL_CLASS
(gst_omx_buffer_pool_parent_class)->acquire_buffer (bpool, buffer,
&int_params)) != GST_FLOW_EOS) {
- if (ret != GST_FLOW_OK)
+ if (ret != GST_FLOW_OK) {
+ g_list_free_full (free_buffers, (GDestroyNotify) gst_buffer_unref);
return ret;
+ }
if (*buffer == buf)
break;
gst_object_replace ((GstObject **) & (*buffer)->pool, (GstObject *) pool);
- gst_buffer_unref (*buffer);
+ free_buffers = g_list_prepend (free_buffers, *buffer);
*buffer = NULL;
}
+ g_list_free_full (free_buffers, (GDestroyNotify) gst_buffer_unref);
g_return_val_if_fail (*buffer != NULL, GST_FLOW_ERROR);
@@ -543,7 +547,7 @@ gst_omx_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
omx_buf =
gst_mini_object_get_qdata (GST_MINI_OBJECT_CAST (buffer),
gst_omx_buffer_data_quark);
- if (pool->port->port_def.eDir == OMX_DirOutput) {
+ if (pool->port->port_def.eDir == OMX_DirOutput && !omx_buf->used) {
/* Release back to the port, can be filled again */
err = gst_omx_port_release_buffer (pool->port, omx_buf);
if (err != OMX_ErrorNone) {
@@ -551,7 +555,7 @@ gst_omx_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
("Failed to relase output buffer to component: %s (0x%08x)",
gst_omx_error_to_string (err), err));
}
- } else {
+ } else if (!omx_buf->used) {
/* TODO: Implement.
*
* If not used (i.e. was not passed to the component) this should do