omxvideodec: Switch to Idle first and wait before switching to Loaded and deallocatin...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 27 Sep 2011 13:05:19 +0000 (15:05 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 28 Sep 2011 08:35:37 +0000 (10:35 +0200)
Allocating buffers before the Idle state is reached can lead to crashes.

omx/gstomxvideodec.c

index 9dd99c4..9849a85 100644 (file)
@@ -286,6 +286,10 @@ gst_omx_video_dec_close (GstOMXVideoDec * 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);