summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-07 11:11:58 +0100
committerJosep Torra <n770galaxy@gmail.com>2013-03-09 13:13:53 +0100
commita851f8d75e4dbd006cdc13a0fdd029eefdebde52 (patch)
tree2b5b7229f259189efc264f35c546eda7a5328971
parentd1f4cccf768786cc1c6fcf7f75c5b242ed4ca948 (diff)
omx: Add timeout to the flush operation and move buffer populating to a separate function
Conflicts: omx/gstomx.c
-rw-r--r--omx/gstomx.c191
-rw-r--r--omx/gstomx.h3
-rw-r--r--omx/gstomxaudioenc.c34
-rw-r--r--omx/gstomxvideodec.c24
-rw-r--r--omx/gstomxvideoenc.c33
5 files changed, 162 insertions, 123 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 3d531d2..913fd74 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -724,7 +724,8 @@ gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state)
comp->pending_state = state;
/* Reset some things */
- if (old_state == OMX_StateExecuting && state < old_state) {
+ if ((old_state == OMX_StateExecuting || old_state == OMX_StatePause)
+ && state < old_state) {
g_list_free (comp->pending_reconfigure_outports);
comp->pending_reconfigure_outports = NULL;
/* Notify all inports that are still waiting */
@@ -1352,7 +1353,8 @@ done:
/* NOTE: Uses comp->lock and comp->messages_lock */
OMX_ERRORTYPE
-gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush)
+gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
+ gboolean flush)
{
GstOMXComponent *comp;
OMX_ERRORTYPE err = OMX_ErrorNone;
@@ -1380,15 +1382,6 @@ gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush)
goto done;
}
- if (comp->state != OMX_StateIdle && comp->state != OMX_StateExecuting
- && comp->state != OMX_StatePause) {
- GST_DEBUG_OBJECT (comp->parent, "Component is in wrong state: %d",
- comp->state);
- err = OMX_ErrorUndefined;
-
- goto done;
- }
-
port->flushing = flush;
if (flush) {
GTimeVal abstimeout, *timeval;
@@ -1421,10 +1414,24 @@ gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush)
goto done;
}
- g_get_current_time (&abstimeout);
- g_time_val_add (&abstimeout, 5 * G_USEC_PER_SEC);
- timeval = &abstimeout;
- GST_DEBUG_OBJECT (comp->parent, "Waiting for 5s");
+ if (timeout != GST_CLOCK_TIME_NONE) {
+ glong add = timeout / (GST_SECOND / G_USEC_PER_SEC);
+
+ if (add == 0) {
+ if (!port->flushed || (port->buffers
+ && port->buffers->len >
+ g_queue_get_length (&port->pending_buffers)))
+ err = OMX_ErrorTimeout;
+ goto done;
+ }
+
+ g_get_current_time (&abstimeout);
+ g_time_val_add (&abstimeout, add);
+ timeval = &abstimeout;
+ GST_DEBUG_OBJECT (comp->parent, "Waiting for %ld us", add);
+ } else {
+ GST_DEBUG_OBJECT (comp->parent, "Waiting for signal");
+ }
/* Retry until timeout or until an error happend or
* until all buffers were released by the component and
@@ -1437,12 +1444,19 @@ gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush)
&& port->buffers->len > g_queue_get_length (&port->pending_buffers)) {
g_mutex_lock (comp->messages_lock);
g_mutex_unlock (comp->lock);
- if (!g_queue_is_empty (&comp->messages))
+
+ if (!g_queue_is_empty (&comp->messages)) {
signalled = TRUE;
- else
+ }
+ if (timeout == -1) {
+ g_cond_wait (comp->messages_cond, comp->messages_lock);
+ signalled = TRUE;
+ } else {
signalled =
g_cond_timed_wait (comp->messages_cond, comp->messages_lock,
timeval);
+ }
+
g_mutex_unlock (comp->messages_lock);
g_mutex_lock (comp->lock);
@@ -1466,36 +1480,6 @@ gst_omx_port_set_flushing (GstOMXPort * port, gboolean flush)
err = OMX_ErrorTimeout;
goto done;
}
- } else {
- if (port->port_def.eDir == OMX_DirOutput && port->buffers) {
- GstOMXBuffer *buf;
-
- /* Enqueue all buffers for the component to fill */
- while ((buf = g_queue_pop_head (&port->pending_buffers))) {
- if (!buf)
- continue;
-
- g_assert (!buf->used);
-
- /* Reset all flags, some implementations don't
- * reset them themselves and the flags are not
- * valid anymore after the buffer was consumed
- */
- buf->omx_buf->nFlags = 0;
-
- err = OMX_FillThisBuffer (comp->handle, buf->omx_buf);
-
- if (err != OMX_ErrorNone) {
- GST_ERROR_OBJECT (comp->parent,
- "Failed to pass buffer %p (%p) to port %u: %s (0x%08x)", buf,
- buf->omx_buf->pBuffer, port->index,
- gst_omx_error_to_string (err), err);
- goto done;
- }
- GST_DEBUG_OBJECT (comp->parent, "Passed buffer %p (%p) to component",
- buf, buf->omx_buf->pBuffer);
- }
- }
}
done:
@@ -1980,6 +1964,86 @@ gst_omx_port_set_enabled (GstOMXPort * port, gboolean enabled)
return err;
}
+static OMX_ERRORTYPE
+gst_omx_port_populate_unlocked (GstOMXPort * port)
+{
+ GstOMXComponent *comp;
+ OMX_ERRORTYPE err = OMX_ErrorNone;
+ GstOMXBuffer *buf;
+
+ g_return_val_if_fail (port != NULL, OMX_ErrorUndefined);
+
+ comp = port->comp;
+
+ GST_DEBUG_OBJECT (comp->parent, "Populating port %d", port->index);
+
+ gst_omx_component_handle_messages (comp);
+
+ if (port->flushing) {
+ GST_DEBUG_OBJECT (comp->parent, "Port %u is flushing", port->index);
+ err = OMX_ErrorIncorrectStateOperation;
+ goto done;
+ }
+
+ if ((err = comp->last_error) != OMX_ErrorNone) {
+ GST_ERROR_OBJECT (comp->parent, "Component is in error state: %s (0x%08x)",
+ gst_omx_error_to_string (err), err);
+ goto done;
+ }
+
+ if (port->port_def.eDir == OMX_DirOutput && port->buffers && !port->tunneled) {
+ /* Enqueue all buffers for the component to fill */
+ while ((buf = g_queue_pop_head (&port->pending_buffers))) {
+ if (!buf)
+ continue;
+
+ g_assert (!buf->used);
+
+ /* Reset all flags, some implementations don't
+ * reset them themselves and the flags are not
+ * valid anymore after the buffer was consumed
+ */
+ buf->omx_buf->nFlags = 0;
+
+ err = OMX_FillThisBuffer (comp->handle, buf->omx_buf);
+
+ if (err != OMX_ErrorNone) {
+ GST_ERROR_OBJECT (comp->parent,
+ "Failed to pass buffer %p (%p) to port %u: %s (0x%08x)", buf,
+ buf->omx_buf->pBuffer, port->index, gst_omx_error_to_string (err),
+ err);
+ goto done;
+ }
+ GST_DEBUG_OBJECT (comp->parent, "Passed buffer %p (%p) to component",
+ buf, buf->omx_buf->pBuffer);
+ }
+ }
+
+done:
+ gst_omx_port_update_port_definition (port, NULL);
+
+ GST_DEBUG_OBJECT (comp->parent, "Populated port %u: %s (0x%08x)",
+ port->index, gst_omx_error_to_string (err), err);
+ gst_omx_component_handle_messages (comp);
+
+ return err;
+}
+
+/* NOTE: Uses comp->lock and comp->messages_lock */
+OMX_ERRORTYPE
+gst_omx_port_populate (GstOMXPort * port)
+{
+ OMX_ERRORTYPE err;
+
+ g_return_val_if_fail (port != NULL, OMX_ErrorUndefined);
+
+ g_mutex_lock (port->comp->lock);
+ err = gst_omx_port_populate_unlocked (port);
+ g_mutex_unlock (port->comp->lock);
+
+ return err;
+}
+
/* NOTE: Must be called while holding comp->lock, uses comp->messages_lock */
static OMX_ERRORTYPE
gst_omx_port_wait_enabled_unlocked (GstOMXPort * port, GstClockTime timeout)
@@ -2075,39 +2139,6 @@ gst_omx_port_wait_enabled_unlocked (GstOMXPort * port, GstClockTime timeout)
} else {
if (enabled)
port->flushing = FALSE;
-
- /* If everything went fine and we have an output port we
- * should provide all newly allocated buffers to the port
- */
- if (enabled && port->port_def.eDir == OMX_DirOutput && !port->tunneled) {
- GstOMXBuffer *buf;
-
- /* Enqueue all buffers for the component to fill */
- while ((buf = g_queue_pop_head (&port->pending_buffers))) {
- if (!buf)
- continue;
-
- g_assert (!buf->used);
-
- /* Reset all flags, some implementations don't
- * reset them themselves and the flags are not
- * valid anymore after the buffer was consumed
- */
- buf->omx_buf->nFlags = 0;
-
- err = OMX_FillThisBuffer (comp->handle, buf->omx_buf);
-
- if (err != OMX_ErrorNone) {
- GST_ERROR_OBJECT (comp->parent,
- "Failed to pass buffer %p (%p) to port %u: %s (0x%08x)", buf,
- buf->omx_buf->pBuffer, port->index, gst_omx_error_to_string (err),
- err);
- goto done;
- }
- GST_DEBUG_OBJECT (comp->parent, "Passed buffer %p (%p) to component",
- buf, buf->omx_buf->pBuffer);
- }
- }
}
gst_omx_component_handle_messages (comp);
diff --git a/omx/gstomx.h b/omx/gstomx.h
index ad4bb15..3fb6a6a 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -304,13 +304,14 @@ OMX_ERRORTYPE gst_omx_port_update_port_definition (GstOMXPort *port, OMX_PAR
GstOMXAcquireBufferReturn gst_omx_port_acquire_buffer (GstOMXPort *port, GstOMXBuffer **buf);
OMX_ERRORTYPE gst_omx_port_release_buffer (GstOMXPort *port, GstOMXBuffer *buf);
-OMX_ERRORTYPE gst_omx_port_set_flushing (GstOMXPort *port, gboolean flush);
+OMX_ERRORTYPE gst_omx_port_set_flushing (GstOMXPort *port, GstClockTime timeout, gboolean flush);
gboolean gst_omx_port_is_flushing (GstOMXPort *port);
OMX_ERRORTYPE gst_omx_port_allocate_buffers (GstOMXPort *port);
OMX_ERRORTYPE gst_omx_port_use_buffers (GstOMXPort *port, const GList *buffers);
OMX_ERRORTYPE gst_omx_port_use_eglimages (GstOMXPort *port, const GList *images);
OMX_ERRORTYPE gst_omx_port_deallocate_buffers (GstOMXPort *port);
+OMX_ERRORTYPE gst_omx_port_populate (GstOMXPort *port);
OMX_ERRORTYPE gst_omx_port_wait_buffers_released (GstOMXPort * port, GstClockTime timeout);
OMX_ERRORTYPE gst_omx_port_mark_reconfigured (GstOMXPort * port);
diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c
index 3cb9a17..711b338 100644
--- a/omx/gstomxaudioenc.c
+++ b/omx/gstomxaudioenc.c
@@ -248,10 +248,6 @@ gst_omx_audio_enc_change_state (GstElement * element, GstStateChange transition)
ret = GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (self->enc_in_port)
- gst_omx_port_set_flushing (self->enc_in_port, FALSE);
- if (self->enc_out_port)
- gst_omx_port_set_flushing (self->enc_out_port, FALSE);
self->downstream_flow_ret = GST_FLOW_OK;
self->draining = FALSE;
@@ -261,9 +257,9 @@ gst_omx_audio_enc_change_state (GstElement * element, GstStateChange transition)
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
if (self->enc_in_port)
- gst_omx_port_set_flushing (self->enc_in_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
if (self->enc_out_port)
- gst_omx_port_set_flushing (self->enc_out_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
g_mutex_lock (self->drain_lock);
self->draining = FALSE;
@@ -387,6 +383,10 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
if (err != OMX_ErrorNone)
goto reconfigure_error;
+ err = gst_omx_port_populate (port);
+ if (err != OMX_ErrorNone)
+ goto reconfigure_error;
+
err = gst_omx_port_mark_reconfigured (port);
if (err != OMX_ErrorNone)
goto reconfigure_error;
@@ -595,8 +595,8 @@ gst_omx_audio_enc_stop (GstAudioEncoder * encoder)
GST_DEBUG_OBJECT (self, "Stopping encoder");
- gst_omx_port_set_flushing (self->enc_in_port, TRUE);
- gst_omx_port_set_flushing (self->enc_out_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
gst_pad_stop_task (GST_AUDIO_ENCODER_SRC_PAD (encoder));
@@ -788,8 +788,13 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
}
/* Unset flushing to allow ports to accept data again */
- gst_omx_port_set_flushing (self->enc_in_port, FALSE);
- gst_omx_port_set_flushing (self->enc_out_port, FALSE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, FALSE);
+
+ /* Populate outport with buffers if we any */
+ if (!needs_disable)
+ if (gst_omx_port_populate (self->enc_out_port) != OMX_ErrorNone)
+ return FALSE;
if (gst_omx_component_get_last_error (self->enc) != OMX_ErrorNone) {
GST_ERROR_OBJECT (self, "Component in error state: %s (0x%08x)",
@@ -818,8 +823,8 @@ gst_omx_audio_enc_flush (GstAudioEncoder * encoder)
gst_omx_audio_enc_drain (self);
- gst_omx_port_set_flushing (self->enc_in_port, TRUE);
- gst_omx_port_set_flushing (self->enc_out_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
/* Wait until the srcpad loop is finished */
GST_AUDIO_ENCODER_STREAM_UNLOCK (self);
@@ -827,8 +832,9 @@ gst_omx_audio_enc_flush (GstAudioEncoder * encoder)
GST_PAD_STREAM_UNLOCK (GST_AUDIO_ENCODER_SRC_PAD (self));
GST_AUDIO_ENCODER_STREAM_LOCK (self);
- gst_omx_port_set_flushing (self->enc_in_port, FALSE);
- gst_omx_port_set_flushing (self->enc_out_port, FALSE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_populate (self->enc_out_port);
/* Start the srcpad loop again */
self->last_upstream_ts = 0;
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index dfaf0cc..5d07bde 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -249,10 +249,6 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (self->dec_in_port)
- gst_omx_port_set_flushing (self->dec_in_port, FALSE);
- if (self->dec_out_port)
- gst_omx_port_set_flushing (self->dec_out_port, FALSE);
self->downstream_flow_ret = GST_FLOW_OK;
self->draining = FALSE;
self->started = FALSE;
@@ -261,9 +257,9 @@ gst_omx_video_dec_change_state (GstElement * element, GstStateChange transition)
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
if (self->dec_in_port)
- gst_omx_port_set_flushing (self->dec_in_port, TRUE);
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
if (self->dec_out_port)
- gst_omx_port_set_flushing (self->dec_out_port, TRUE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
g_mutex_lock (self->drain_lock);
self->draining = FALSE;
@@ -893,8 +889,8 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Stopping decoder");
- gst_omx_port_set_flushing (self->dec_in_port, TRUE);
- gst_omx_port_set_flushing (self->dec_out_port, TRUE);
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
gst_pad_stop_task (GST_VIDEO_DECODER_SRC_PAD (decoder));
@@ -1258,8 +1254,8 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
}
/* Unset flushing to allow ports to accept data again */
- gst_omx_port_set_flushing (self->dec_in_port, FALSE);
- gst_omx_port_set_flushing (self->dec_out_port, FALSE);
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, FALSE);
if (gst_omx_component_get_last_error (self->dec) != OMX_ErrorNone) {
GST_ERROR_OBJECT (self, "Component in error state: %s (0x%08x)",
@@ -1289,8 +1285,8 @@ gst_omx_video_dec_reset (GstVideoDecoder * decoder, gboolean hard)
GST_DEBUG_OBJECT (self, "Resetting decoder");
- gst_omx_port_set_flushing (self->dec_in_port, TRUE);
- gst_omx_port_set_flushing (self->dec_out_port, TRUE);
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, TRUE);
/* Wait until the srcpad loop is finished,
* unlock GST_VIDEO_DECODER_STREAM_LOCK to prevent deadlocks
@@ -1300,8 +1296,8 @@ gst_omx_video_dec_reset (GstVideoDecoder * decoder, gboolean hard)
GST_PAD_STREAM_UNLOCK (GST_VIDEO_DECODER_SRC_PAD (self));
GST_VIDEO_DECODER_STREAM_LOCK (self);
- gst_omx_port_set_flushing (self->dec_in_port, FALSE);
- gst_omx_port_set_flushing (self->dec_out_port, FALSE);
+ gst_omx_port_set_flushing (self->dec_in_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_set_flushing (self->dec_out_port, 5 * GST_SECOND, FALSE);
/* Start the srcpad loop again */
self->last_upstream_ts = 0;
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index cbb96fe..30a6606 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -491,10 +491,6 @@ gst_omx_video_enc_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (self->enc_in_port)
- gst_omx_port_set_flushing (self->enc_in_port, FALSE);
- if (self->enc_out_port)
- gst_omx_port_set_flushing (self->enc_out_port, FALSE);
self->downstream_flow_ret = GST_FLOW_OK;
self->draining = FALSE;
@@ -504,9 +500,9 @@ gst_omx_video_enc_change_state (GstElement * element, GstStateChange transition)
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
if (self->enc_in_port)
- gst_omx_port_set_flushing (self->enc_in_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
if (self->enc_out_port)
- gst_omx_port_set_flushing (self->enc_out_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
g_mutex_lock (self->drain_lock);
self->draining = FALSE;
@@ -814,6 +810,10 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
if (err != OMX_ErrorNone)
goto reconfigure_error;
+ err = gst_omx_port_populate (port);
+ if (err != OMX_ErrorNone)
+ goto reconfigure_error;
+
err = gst_omx_port_mark_reconfigured (port);
if (err != OMX_ErrorNone)
goto reconfigure_error;
@@ -969,8 +969,8 @@ gst_omx_video_enc_stop (GstVideoEncoder * encoder)
GST_DEBUG_OBJECT (self, "Stopping encoder");
- gst_omx_port_set_flushing (self->enc_in_port, TRUE);
- gst_omx_port_set_flushing (self->enc_out_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
gst_pad_stop_task (GST_VIDEO_ENCODER_SRC_PAD (encoder));
@@ -1243,8 +1243,12 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
}
/* Unset flushing to allow ports to accept data again */
- gst_omx_port_set_flushing (self->enc_in_port, FALSE);
- gst_omx_port_set_flushing (self->enc_out_port, FALSE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, FALSE);
+
+ if (!needs_disable)
+ if (gst_omx_port_populate (self->enc_out_port) != OMX_ErrorNone)
+ return FALSE;
if (gst_omx_component_get_last_error (self->enc) != OMX_ErrorNone) {
GST_ERROR_OBJECT (self, "Component in error state: %s (0x%08x)",
@@ -1275,8 +1279,8 @@ gst_omx_video_enc_reset (GstVideoEncoder * encoder, gboolean hard)
GST_DEBUG_OBJECT (self, "Resetting encoder");
- gst_omx_port_set_flushing (self->enc_in_port, TRUE);
- gst_omx_port_set_flushing (self->enc_out_port, TRUE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
/* Wait until the srcpad loop is finished,
* unlock GST_VIDEO_ENCODER_STREAM_LOCK to prevent deadlocks
@@ -1286,8 +1290,9 @@ gst_omx_video_enc_reset (GstVideoEncoder * encoder, gboolean hard)
GST_PAD_STREAM_UNLOCK (GST_VIDEO_ENCODER_SRC_PAD (self));
GST_VIDEO_ENCODER_STREAM_LOCK (self);
- gst_omx_port_set_flushing (self->enc_in_port, FALSE);
- gst_omx_port_set_flushing (self->enc_out_port, FALSE);
+ gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, FALSE);
+ gst_omx_port_populate (self->enc_out_port);
/* Start the srcpad loop again */
self->last_upstream_ts = 0;