From 18118218b14177e0f84af59cd0e6bd90b44b7543 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 31 Jan 2012 17:41:13 +0100 Subject: [PATCH] basesrc: fix race in startup Mark renegotiate before starting the pushing thread. Do also check if we are starting in the get_range function. --- libs/gst/base/gstbasesrc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 067f4b9..1fe6f9d 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2250,7 +2250,8 @@ again: } } - if (G_UNLIKELY (!GST_BASE_SRC_IS_STARTED (src))) + if (G_UNLIKELY (!GST_BASE_SRC_IS_STARTED (src) + && !GST_BASE_SRC_IS_STARTING (src))) goto not_started; if (G_UNLIKELY (!bclass->create)) @@ -3051,6 +3052,8 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret) * we are not yet PLAYING */ gst_base_src_set_flushing (basesrc, FALSE, FALSE, FALSE, NULL); + gst_pad_mark_reconfigure (GST_BASE_SRC_PAD (basesrc)); + GST_OBJECT_LOCK (basesrc->srcpad); mode = GST_PAD_MODE (basesrc->srcpad); GST_OBJECT_UNLOCK (basesrc->srcpad); @@ -3076,8 +3079,6 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret) goto no_get_range; } - gst_pad_mark_reconfigure (GST_BASE_SRC_PAD (basesrc)); - GST_LIVE_LOCK (basesrc); GST_OBJECT_FLAG_SET (basesrc, GST_BASE_SRC_FLAG_STARTED); GST_OBJECT_FLAG_UNSET (basesrc, GST_BASE_SRC_FLAG_STARTING); @@ -3115,7 +3116,7 @@ error: } /** - * gst_base_src_start_complete: + * gst_base_src_start_wait: * @src: base source instance * @ret: a #GstFlowReturn * -- 2.7.4