omx: Reset nOffset to 0 in EmptyBufferDone if nFilledLen is 0

Some OMX implementations don't reset nOffset when the complete
buffer is emptied but instead only reset nFilledLen. We reset
nOffset to 0 if nFilledLen == 0, which is safe to do because
the offset *must* be 0 if the buffer is not filled at all.

Seen in QCOM's OMX implementation.
This commit is contained in:
Sebastian Dröge 2011-10-14 10:26:00 +02:00
parent ac8085dce9
commit 2750a8869b

View file

@ -333,12 +333,17 @@ EmptyBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
port->index, buf);
buf->used = FALSE;
if (comp->hacks & GST_OMX_HACK_NO_NOFFSET_RESET) {
if (buf->omx_buf->nFilledLen != 0)
GST_WARNING_OBJECT (comp->parent,
"Not completely emptied buffer returned");
/* Some OMX implementations don't reset nOffset
* when the complete buffer is emptied but instead
* only reset nFilledLen. We reset nOffset to 0
* if nFilledLen == 0, which is safe to do because
* the offset *must* be 0 if the buffer is not
* filled at all.
*
* Seen in QCOM's OMX implementation.
*/
if (buf->omx_buf->nFilledLen == 0)
buf->omx_buf->nOffset = 0;
}
g_queue_push_tail (port->pending_buffers, buf);
g_cond_broadcast (port->port_cond);