videodecoder: Delete the link before pushing
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Sat, 8 Sep 2018 02:15:35 +0000 (22:15 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Mon, 10 Sep 2018 21:08:25 +0000 (17:08 -0400)
The gst_video_decoder_clip_and_push_buf() now drops the internal stream
lock while pushing. This means, the output_queued list could be modififed
during that time. To make the code safe again, we delete the link before
pushing the data. The walk pointer will later be updated with the list
head, which makes it safe in case the list was modififed.

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

gst-libs/gst/video/gstvideodecoder.c

index 4754aae595267104ad77c7d577d7b38406d75747..f1e2c89d0baf8b0356e62a5cc3e4f5fcf934e487 100644 (file)
@@ -2352,6 +2352,9 @@ gst_video_decoder_flush_parse (GstVideoDecoder * dec, gboolean at_eos)
       while (walk) {
         GstBuffer *buf = GST_BUFFER_CAST (walk->data);
 
+        priv->output_queued =
+            g_list_delete_link (priv->output_queued, priv->output_queued);
+
         if (G_LIKELY (res == GST_FLOW_OK)) {
           /* avoid stray DISCONT from forward processing,
            * which have no meaning in reverse pushing */
@@ -2376,8 +2379,6 @@ gst_video_decoder_flush_parse (GstVideoDecoder * dec, gboolean at_eos)
           gst_buffer_unref (buf);
         }
 
-        priv->output_queued =
-            g_list_delete_link (priv->output_queued, priv->output_queued);
         walk = priv->output_queued;
       }