omxvideodec: Add hack for Ducati components not returning from drain

This happens on the Galaxy Nexus, and causes the pipeline to hang waiting
endlessly for a drain. The hack replaces the wait with a wait + 500ms timeout.
This commit is contained in:
Arun Raghavan 2012-04-25 19:01:32 +05:30
parent 036cd16756
commit 9e4cddee7e
3 changed files with 21 additions and 2 deletions

View file

@ -1973,6 +1973,8 @@ gst_omx_parse_hacks (gchar ** hacks)
hacks_flags |= GST_OMX_HACK_NO_COMPONENT_RECONFIGURE;
else if (g_str_equal (*hacks, "no-empty-eos-buffer"))
hacks_flags |= GST_OMX_HACK_NO_EMPTY_EOS_BUFFER;
else if (g_str_equal (*hacks, "drain-may-not-return"))
hacks_flags |= GST_OMX_HACK_DRAIN_MAY_NOT_RETURN;
else
GST_WARNING ("Unknown hack: %s", *hacks);
hacks++;

View file

@ -65,6 +65,11 @@ G_BEGIN_DECLS
*/
#define GST_OMX_HACK_NO_EMPTY_EOS_BUFFER G_GUINT64_CONSTANT (0x0000000000000020)
/* If the component might not acknowledge a drain.
* Happens with TI's Ducati OpenMAX implementation.
*/
#define GST_OMX_HACK_DRAIN_MAY_NOT_RETURN G_GUINT64_CONSTANT (0x0000000000000040)
typedef struct _GstOMXCore GstOMXCore;
typedef struct _GstOMXPort GstOMXPort;

View file

@ -1398,8 +1398,20 @@ gst_omx_video_dec_drain (GstOMXVideoDec * self)
buf->omx_buf->nFlags |= OMX_BUFFERFLAG_EOS;
gst_omx_port_release_buffer (self->in_port, buf);
GST_DEBUG_OBJECT (self, "Waiting until component is drained");
g_cond_wait (self->drain_cond, self->drain_lock);
GST_DEBUG_OBJECT (self, "Drained component");
if (G_UNLIKELY(self->component->hacks & GST_OMX_HACK_DRAIN_MAY_NOT_RETURN)) {
GTimeVal tv = { .tv_sec = 0, .tv_usec = 500000 };
if (!g_cond_timed_wait (self->drain_cond, self->drain_lock, &tv))
GST_WARNING_OBJECT (self, "Drain timed out");
else
GST_DEBUG_OBJECT (self, "Drained component");
} else {
g_cond_wait (self->drain_cond, self->drain_lock);
GST_DEBUG_OBJECT (self, "Drained component");
}
g_mutex_unlock (self->drain_lock);
GST_BASE_VIDEO_CODEC_STREAM_LOCK (self);