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;
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);
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) {
("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