From 961445aa1b5f0741422a499e7efd32d0691bf45d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 14 Jul 2011 07:58:41 +0200 Subject: [PATCH] omxvideodec: Only flush the component ports after we passed input to them --- omx/gstomxvideodec.c | 19 ++++++++++++------- omx/gstomxvideodec.h | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index e6cd3eb..3c1ef9f 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -233,6 +233,7 @@ gst_omx_video_dec_open (GstOMXVideoDec * self) self->component = gst_omx_component_new (GST_OBJECT_CAST (self), klass->core_name, klass->component_name, klass->component_role); + self->started = FALSE; if (!self->component) return FALSE; @@ -780,15 +781,17 @@ gst_omx_video_dec_reset (GstBaseVideoDecoder * decoder) GST_BASE_VIDEO_CODEC (self)->frames = NULL; GST_OBJECT_UNLOCK (self); - gst_omx_port_set_flushing (self->in_port, TRUE); - gst_omx_port_set_flushing (self->out_port, TRUE); + if (self->started) { + gst_omx_port_set_flushing (self->in_port, TRUE); + gst_omx_port_set_flushing (self->out_port, TRUE); - /* Wait until the srcpad loop is finished */ - GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self)); - GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self)); + /* Wait until the srcpad loop is finished */ + GST_PAD_STREAM_LOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self)); + GST_PAD_STREAM_UNLOCK (GST_BASE_VIDEO_CODEC_SRC_PAD (self)); - gst_omx_port_set_flushing (self->in_port, FALSE); - gst_omx_port_set_flushing (self->out_port, FALSE); + gst_omx_port_set_flushing (self->in_port, FALSE); + gst_omx_port_set_flushing (self->out_port, FALSE); + } /* Start the srcpad loop again */ gst_pad_start_task (GST_BASE_VIDEO_CODEC_SRC_PAD (self), @@ -853,6 +856,7 @@ gst_omx_video_dec_handle_frame (GstBaseVideoDecoder * decoder, memcpy (buf->omx_buf->pBuffer + buf->omx_buf->nOffset, GST_BUFFER_DATA (codec_data), GST_BUFFER_SIZE (codec_data)); + self->started = TRUE; gst_omx_port_release_buffer (self->in_port, buf); gst_buffer_replace (&self->codec_data, NULL); /* Acquire new buffer for the actual frame */ @@ -909,6 +913,7 @@ gst_omx_video_dec_handle_frame (GstBaseVideoDecoder * decoder, */ offset += buf->omx_buf->nFilledLen; + self->started = TRUE; gst_omx_port_release_buffer (self->in_port, buf); } diff --git a/omx/gstomxvideodec.h b/omx/gstomxvideodec.h index 0845869..af20602 100644 --- a/omx/gstomxvideodec.h +++ b/omx/gstomxvideodec.h @@ -55,6 +55,9 @@ struct _GstOMXVideoDec /* < private > */ GstBuffer *codec_data; + /* TRUE if the component is configured and saw + * the first buffer */ + gboolean started; }; struct _GstOMXVideoDecClass -- 2.7.4