diff --git a/gst/imagefreeze/gstimagefreeze.c b/gst/imagefreeze/gstimagefreeze.c index 2b21906d9a..b8e99772c9 100644 --- a/gst/imagefreeze/gstimagefreeze.c +++ b/gst/imagefreeze/gstimagefreeze.c @@ -329,9 +329,16 @@ gst_image_freeze_sink_bufferalloc (GstPad * pad, guint64 offset, guint size, GST_OBJECT_UNLOCK (self); 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", diff --git a/gst/imagefreeze/gstimagefreeze.h b/gst/imagefreeze/gstimagefreeze.h index b9bc53f39c..fff8c2ea3e 100644 --- a/gst/imagefreeze/gstimagefreeze.h +++ b/gst/imagefreeze/gstimagefreeze.h @@ -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; };