omx: Always try to deallocate buffers, even if there's a component error

This commit is contained in:
Sebastian Dröge 2011-07-06 13:26:51 +02:00
parent 0b9c0ac78d
commit 7739049df5

View file

@ -1023,21 +1023,21 @@ gst_omx_port_deallocate_buffers_unlocked (GstOMXPort * port)
if ((err = gst_omx_component_get_last_error (comp)) != OMX_ErrorNone) { if ((err = gst_omx_component_get_last_error (comp)) != OMX_ErrorNone) {
GST_ERROR_OBJECT (comp->parent, "Component in error state: %d", err); GST_ERROR_OBJECT (comp->parent, "Component in error state: %d", err);
goto done; /* We still try to deallocate all buffers */
} }
/* We only allow deallocation of buffers after they /* We only allow deallocation of buffers after they
* were all released from the port, either by flushing * were all released from the port, either by flushing
* the port or by disabling it. * the port or by disabling it.
*/ */
g_assert (g_queue_get_length (port->pending_buffers) == port->buffers->len);
n = port->buffers->len; n = port->buffers->len;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
GstOMXBuffer *buf = g_ptr_array_index (port->buffers, i); GstOMXBuffer *buf = g_ptr_array_index (port->buffers, i);
OMX_ERRORTYPE tmp = OMX_ErrorNone; OMX_ERRORTYPE tmp = OMX_ErrorNone;
g_assert (!buf->used); if (buf->used)
GST_ERROR_OBJECT (comp->parent,
"Trying to free used buffer %p of port %u", buf, port->index);
/* omx_buf can be NULL if allocation failed earlier /* omx_buf can be NULL if allocation failed earlier
* and we're just shutting down * and we're just shutting down