omx: factor out gst_omx_buffer_reset()

https://bugzilla.gnome.org/show_bug.cgi?id=788711
This commit is contained in:
Guillaume Desmottes 2017-10-04 17:11:55 +02:00 committed by Nicolas Dufresne
parent 3a0e4bc35d
commit 514699594d

View file

@ -225,6 +225,14 @@ gst_omx_component_flush_messages (GstOMXComponent * comp)
g_mutex_unlock (&comp->messages_lock);
}
static void
gst_omx_buffer_reset (GstOMXBuffer * buf)
{
buf->omx_buf->nFlags = 0;
buf->omx_buf->nOffset = 0;
buf->omx_buf->nFilledLen = 0;
}
/* NOTE: Call with comp->lock, comp->messages_lock will be used */
static void
gst_omx_component_handle_messages (GstOMXComponent * comp)
@ -372,15 +380,11 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
"%s port %u emptied buffer %p (%p)", port->comp->name,
port->index, buf, buf->omx_buf->pBuffer);
/* Reset offset and filled length */
buf->omx_buf->nOffset = 0;
buf->omx_buf->nFilledLen = 0;
/* Reset all flags, some implementations don't
* reset them themselves and the flags are not
* valid anymore after the buffer was consumed
*/
buf->omx_buf->nFlags = 0;
gst_omx_buffer_reset (buf);
} else {
/* Output buffer contains output now or
* the port was flushed */
@ -1438,11 +1442,7 @@ gst_omx_port_release_buffer (GstOMXPort * port, GstOMXBuffer * buf)
* reset them themselves and the flags are not
* valid anymore after the buffer was consumed
*/
buf->omx_buf->nFlags = 0;
/* Reset offset and filled length */
buf->omx_buf->nOffset = 0;
buf->omx_buf->nFilledLen = 0;
gst_omx_buffer_reset (buf);
}
if ((err = comp->last_error) != OMX_ErrorNone) {
@ -2094,8 +2094,7 @@ gst_omx_port_populate_unlocked (GstOMXPort * port)
* valid anymore after the buffer was consumed.
* Also reset nFilledLen as FillThisBuffer() expects an empty buffer.
*/
buf->omx_buf->nFlags = 0;
buf->omx_buf->nFilledLen = 0;
gst_omx_buffer_reset (buf);
err = OMX_FillThisBuffer (comp->handle, buf->omx_buf);