From aced7478ab4b063110b7ecc677b0e64ab40d53a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 1 Aug 2011 13:22:05 +0200 Subject: [PATCH] omx: Add a hacks flag for the Qualcomm 7x30 OMX_FillThisBuffer() race and make it optional --- omx/gstomx.c | 9 +++++++-- omx/gstomx.h | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/omx/gstomx.c b/omx/gstomx.c index 1e78a04..591d698 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -1124,8 +1124,8 @@ gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush) if (port->port_def.eDir == OMX_DirOutput && port->buffers) { GstOMXBuffer *buf; - /* FIXME: Workaround for QCOM 7x30 race condition */ - g_usleep (G_USEC_PER_SEC / 10); + if (comp->hacks & GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE) + g_usleep (G_USEC_PER_SEC / 10); /* Enqueue all buffers for the component to fill */ while ((buf = g_queue_pop_head (port->pending_buffers))) { @@ -1500,6 +1500,9 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled) if (enabled && port->port_def.eDir == OMX_DirOutput) { GstOMXBuffer *buf; + if (comp->hacks & GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE) + g_usleep (G_USEC_PER_SEC / 10); + /* Enqueue all buffers for the component to fill */ while ((buf = g_queue_pop_head (port->pending_buffers))) { g_assert (!buf->used); @@ -1827,6 +1830,8 @@ gst_omx_parse_hacks (gchar ** hacks) hacks_flags |= GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER; else if (g_str_equal (*hacks, "syncframe-flag-not-used")) hacks_flags |= GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED; + else if (g_str_equal (*hacks, "qcom-7x30-fill-this-buffer-race")) + hacks_flags |= GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE; else GST_WARNING ("Unknown hack: %s", *hacks); hacks++; diff --git a/omx/gstomx.h b/omx/gstomx.h index 7be012b..337acf5 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -55,6 +55,12 @@ G_BEGIN_DECLS * Happens with the Bellagio ffmpegdist video encoder. */ #define GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED G_GUINT64_CONSTANT (0x0000000000000008) +/* Qualcomm 7x30 sometimes fails with an undefined error after + * allocating buffers, setting the state to Idle when calling + * OMX_FillThisBuffer() on all output buffers too early. + */ +#define GST_OMX_HACK_QCOM_7x30_FILL_THIS_BUFFER_RACE G_GUINT64_CONSTANT (0x0000000000000010) + typedef struct _GstOMXCore GstOMXCore; typedef struct _GstOMXPort GstOMXPort; -- 2.7.4