From febb83ec54dd3dec6deebc7ddc7eadb95ee9ed1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 27 Sep 2011 15:08:54 +0200 Subject: [PATCH] omxaudioenc: Switch to Idle first and wait before switching to Loaded and deallocating buffers Allocating buffers before the Idle state is reached can lead to crashes. --- omx/gstomxaudioenc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index f36f3825d3..127a233da2 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -288,6 +288,10 @@ gst_omx_audio_enc_close (GstOMXAudioEnc * self) state = gst_omx_component_get_state (self->component, 0); if (state > OMX_StateLoaded || state == OMX_StateInvalid) { + if (state > OMX_StateIdle) { + gst_omx_component_set_state (self->component, OMX_StateIdle); + gst_omx_component_get_state (self->component, 5 * GST_SECOND); + } gst_omx_component_set_state (self->component, OMX_StateLoaded); gst_omx_port_deallocate_buffers (self->in_port); gst_omx_port_deallocate_buffers (self->out_port);