From: Sebastian Dröge Date: Tue, 12 Mar 2013 19:02:53 +0000 (+0100) Subject: omxvideodec: Make sure to always get the right buffer X-Git-Tag: 1.19.3~501^2~616 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ebd34e63707e878ac06af2cda6a1a724a6bf61c;p=platform%2Fupstream%2Fgstreamer.git omxvideodec: Make sure to always get the right buffer --- 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