omxvideodec: Make sure to always get the right buffer

This commit is contained in:
Sebastian Dröge 2013-03-12 20:02:53 +01:00
parent f4ad6e0858
commit 1ebd34e637

View file

@ -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