diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2016-12-01 18:23:50 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-12-22 14:44:15 +0200 |
commit | 2edb0ce69f220915e4c95d478dc6b5531a6a36a9 (patch) | |
tree | c2e388e344a117b89db277000832c40e7b45eca7 | |
parent | 21f4b338f4a8a7b80aff53c7f192ebeec2e499a0 (diff) |
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
-rw-r--r-- | config/rpi/gstomx.conf | 2 | ||||
-rw-r--r-- | omx/gstomx.c | 22 | ||||
-rw-r--r-- | omx/gstomx.h | 5 |
3 files changed, 25 insertions, 4 deletions
diff --git a/config/rpi/gstomx.conf b/config/rpi/gstomx.conf index 8b5c7d6..d3ea56a 100644 --- a/config/rpi/gstomx.conf +++ b/config/rpi/gstomx.conf @@ -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 diff --git a/omx/gstomx.c b/omx/gstomx.c index 7044400..907c760 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -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++; diff --git a/omx/gstomx.h b/omx/gstomx.h index bc9bdd0..60a315b 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -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> |