omx: Add a hacks flag for the Qualcomm 7x30 OMX_FillThisBuffer() race and make it...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 1 Aug 2011 11:22:05 +0000 (13:22 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 1 Aug 2011 11:22:05 +0000 (13:22 +0200)
omx/gstomx.c
omx/gstomx.h

index 1e78a04..591d698 100644 (file)
@@ -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++;
index 7be012b..337acf5 100644 (file)
@@ -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;