androidmedia: fix access to invalid buffers in the decoding loop
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Fri, 18 Oct 2013 09:54:12 +0000 (11:54 +0200)
committerAndoni Morales Alastruey <ylatuya@gmail.com>
Wed, 30 Oct 2013 15:24:17 +0000 (16:24 +0100)
Flushing the decoder invalidates all buffers, so it should be done
after quiting the decoding loop. Otherwise we can jump into
"failed_release" and stop everything

https://bugzilla.gnome.org/show_bug.cgi?id=711156

sys/androidmedia/gstamcaudiodec.c
sys/androidmedia/gstamcvideodec.c

index bfa463e..114e72a 100644 (file)
@@ -1017,8 +1017,6 @@ gst_amc_audio_dec_flush (GstAudioDecoder * decoder, gboolean hard)
   }
 
   self->flushing = TRUE;
-  gst_amc_codec_flush (self->codec);
-
   /* Wait until the srcpad loop is finished,
    * unlock GST_AUDIO_DECODER_STREAM_LOCK to prevent deadlocks
    * caused by using this lock from inside the loop function */
@@ -1026,6 +1024,7 @@ gst_amc_audio_dec_flush (GstAudioDecoder * decoder, gboolean hard)
   GST_PAD_STREAM_LOCK (GST_AUDIO_DECODER_SRC_PAD (self));
   GST_PAD_STREAM_UNLOCK (GST_AUDIO_DECODER_SRC_PAD (self));
   GST_AUDIO_DECODER_STREAM_LOCK (self);
+  gst_amc_codec_flush (self->codec);
   self->flushing = FALSE;
 
   /* Start the srcpad loop again */
index f15f684..dd1a54a 100644 (file)
@@ -1507,8 +1507,6 @@ gst_amc_video_dec_flush (GstVideoDecoder * decoder)
   }
 
   self->flushing = TRUE;
-  gst_amc_codec_flush (self->codec);
-
   /* Wait until the srcpad loop is finished,
    * unlock GST_VIDEO_DECODER_STREAM_LOCK to prevent deadlocks
    * caused by using this lock from inside the loop function */
@@ -1516,6 +1514,7 @@ gst_amc_video_dec_flush (GstVideoDecoder * decoder)
   GST_PAD_STREAM_LOCK (GST_VIDEO_DECODER_SRC_PAD (self));
   GST_PAD_STREAM_UNLOCK (GST_VIDEO_DECODER_SRC_PAD (self));
   GST_VIDEO_DECODER_STREAM_LOCK (self);
+  gst_amc_codec_flush (self->codec);
   self->flushing = FALSE;
 
   /* Start the srcpad loop again */