videodecoder: Delete the link before pushing

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
This commit is contained in:
Nicolas Dufresne 2018-09-07 22:15:35 -04:00
parent 1733233060
commit 8ffd15ab28

View file

@ -2352,6 +2352,9 @@ gst_video_decoder_flush_parse (GstVideoDecoder * dec, gboolean at_eos)
while (walk) { while (walk) {
GstBuffer *buf = GST_BUFFER_CAST (walk->data); 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)) { if (G_LIKELY (res == GST_FLOW_OK)) {
/* avoid stray DISCONT from forward processing, /* avoid stray DISCONT from forward processing,
* which have no meaning in reverse pushing */ * 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); gst_buffer_unref (buf);
} }
priv->output_queued =
g_list_delete_link (priv->output_queued, priv->output_queued);
walk = priv->output_queued; walk = priv->output_queued;
} }