Add a signals-premature-eos hack for egl_render

egl_render seems to have a bug and signals EOS before it has finished
pushing out all data; this hack simply makes acquire_buffer() wait
a bit more before signalling EOS, in case egl_render decides to spit
out some more data.

https://bugzilla.gnome.org/show_bug.cgi?id=741856
This commit is contained in:
George Kiagiadakis 2016-12-01 18:23:50 +01:00 committed by Sebastian Dröge
parent 8b01b06af6
commit 05b137a256
3 changed files with 25 additions and 4 deletions

View file

@ -32,7 +32,7 @@ component-name=OMX.broadcom.video_decode
rank=257
in-port-index=130
out-port-index=131
hacks=no-component-role
hacks=no-component-role;signals-premature-eos
[omxtheoradec]
type-name=GstOMXTheoraDec

View file

@ -1235,6 +1235,7 @@ gst_omx_port_acquire_buffer (GstOMXPort * port, GstOMXBuffer ** buf)
GstOMXComponent *comp;
OMX_ERRORTYPE err;
GstOMXBuffer *_buf = NULL;
gint64 timeout = GST_CLOCK_TIME_NONE;
g_return_val_if_fail (port != NULL, GST_OMX_ACQUIRE_BUFFER_ERROR);
g_return_val_if_fail (!port->tunneled, GST_OMX_ACQUIRE_BUFFER_ERROR);
@ -1251,6 +1252,11 @@ gst_omx_port_acquire_buffer (GstOMXPort * port, GstOMXBuffer ** buf)
retry:
gst_omx_component_handle_messages (comp);
/* If we are in the case where we waited for a buffer after EOS,
* make sure we don't do that again */
if (timeout != -1)
timeout = -2;
/* Check if the component is in an error state */
if ((err = comp->last_error) != OMX_ErrorNone) {
GST_ERROR_OBJECT (comp->parent, "Component %s is in error state: %s",
@ -1322,8 +1328,15 @@ retry:
goto done;
}
ret = GST_OMX_ACQUIRE_BUFFER_EOS;
goto done;
if (comp->hacks & GST_OMX_HACK_SIGNALS_PREMATURE_EOS && timeout != -2) {
timeout = 33 * GST_MSECOND;
GST_DEBUG_OBJECT (comp->parent, "%s output port %u is EOS but waiting "
"in case it spits out more buffers", comp->name, port->index);
} else {
ret = GST_OMX_ACQUIRE_BUFFER_EOS;
goto done;
}
}
/*
@ -1339,7 +1352,8 @@ retry:
if (g_queue_is_empty (&port->pending_buffers)) {
GST_DEBUG_OBJECT (comp->parent, "Queue of %s port %u is empty",
comp->name, port->index);
gst_omx_component_wait_message (comp, GST_CLOCK_TIME_NONE);
gst_omx_component_wait_message (comp,
timeout == -2 ? GST_CLOCK_TIME_NONE : timeout);
/* And now check everything again and maybe get a buffer */
goto retry;
@ -2465,6 +2479,8 @@ gst_omx_parse_hacks (gchar ** hacks)
hacks_flags |= GST_OMX_HACK_NO_COMPONENT_ROLE;
else if (g_str_equal (*hacks, "no-disable-outport"))
hacks_flags |= GST_OMX_HACK_NO_DISABLE_OUTPORT;
else if (g_str_equal (*hacks, "signals-premature-eos"))
hacks_flags |= GST_OMX_HACK_SIGNALS_PREMATURE_EOS;
else
GST_WARNING ("Unknown hack: %s", *hacks);
hacks++;

View file

@ -45,6 +45,11 @@
# endif
#endif
/* If the component may signal EOS before it has finished pushing
* out all of its buffers. Happens with egl_render on the rpi.
*/
#define GST_OMX_HACK_SIGNALS_PREMATURE_EOS G_GUINT64_CONSTANT (0x0000000000000400)
#include <OMX_Core.h>
#include <OMX_Component.h>