Commit e51fe6c1 authored by Sebastian Dröge's avatar Sebastian Dröge

imagefreeze: Protect the flushing-seek variable by the srcpad's stream lock

This fixes a subtle race condition, that caused bufferalloc to fail
with wrong-state due to a seek but caused it to be not retried as
it should.
parent d8ef9bb6
......@@ -329,9 +329,16 @@ gst_image_freeze_sink_bufferalloc (GstPad * pad, guint64 offset, guint size,
if (do_alloc) {
gboolean seeking = FALSE;
do {
GST_PAD_STREAM_LOCK (self->srcpad);
ret = gst_pad_alloc_buffer (self->srcpad, offset, size, caps, buf);
} while (ret == GST_FLOW_WRONG_STATE && g_atomic_int_get (&self->seeking));
seeking = ret == GST_FLOW_WRONG_STATE
&& g_atomic_int_get (&self->seeking);
GST_PAD_STREAM_UNLOCK (self->srcpad);
} while (seeking);
if (G_UNLIKELY (ret != GST_FLOW_OK))
GST_ERROR_OBJECT (pad, "Allocating buffer failed: %s",
......@@ -56,7 +56,8 @@ struct _GstImageFreeze
guint64 offset;
/* TRUE if currently doing a flushing seek */
/* TRUE if currently doing a flushing seek, protected
* by srcpad's stream lock */
gint seeking;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment