From 0c0aa7837361f823495a3044fb0da064b8f51429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 4 Nov 2011 09:43:48 +0100 Subject: [PATCH] omxaudioenc: Only drain the component a single time and only after processing started --- omx/gstomxaudioenc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index e54a11ef52..238fa0f9ea 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -656,7 +656,11 @@ gst_omx_audio_enc_set_format (GstBaseAudioEncoder * encoder, * format change happened we can just exit here. */ if (needs_disable) { - gst_omx_audio_enc_drain (self); + if (self->started) { + gst_omx_audio_enc_drain (self); + self->started = FALSE; + } + if (gst_omx_port_manual_reconfigure (self->in_port, TRUE) != OMX_ErrorNone) return FALSE; if (gst_omx_port_set_enabled (self->in_port, FALSE) != OMX_ErrorNone) @@ -795,6 +799,7 @@ gst_omx_audio_enc_flush (GstBaseAudioEncoder * encoder) if (self->started) { gst_omx_audio_enc_drain (self); + self->started = FALSE; gst_omx_port_set_flushing (self->in_port, TRUE); gst_omx_port_set_flushing (self->out_port, TRUE); @@ -974,6 +979,8 @@ gst_omx_audio_enc_drain (GstOMXAudioEnc * self) GST_DEBUG_OBJECT (self, "Draining component"); + g_assert (self->started); + /* Send an EOS buffer to the component and let the base * class drop the EOS event. We will send it later when * the EOS buffer arrives on the output port. */