From 6b49683447597f6a80c054e781fca76758a3775b Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Fri, 18 Oct 2013 11:54:12 +0200 Subject: [PATCH] androidmedia: fix access to invalid buffers in the decoding loop 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 | 3 +-- sys/androidmedia/gstamcvideodec.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/androidmedia/gstamcaudiodec.c b/sys/androidmedia/gstamcaudiodec.c index bfa463e..114e72a 100644 --- a/sys/androidmedia/gstamcaudiodec.c +++ b/sys/androidmedia/gstamcaudiodec.c @@ -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 */ diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index f15f684..dd1a54a 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -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 */ -- 2.7.4