diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2011-08-25 23:33:10 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-08-26 09:51:45 +0200 |
commit | e1a0bdcdf589db8e29c0779cd5518634db7c903f (patch) | |
tree | b42e01700ce99d164adfc92337a9ab388531f4a8 | |
parent | adcfcabb14cec04e3e70529c3bc57ff4aae14c39 (diff) |
hlsdemux: do not allow two fetchers to run simultanously
-rw-r--r-- | gst/hls/gsthlsdemux.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index cd61ed95b..10d2b9150 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -555,7 +555,7 @@ gst_hls_demux_fetcher_sink_event (GstPad * pad, GstEvent * event) GST_DEBUG_OBJECT (demux, "Got EOS on the fetcher pad"); /* signal we have fetched the URI */ if (!demux->cancelled) - g_cond_signal (demux->fetcher_cond); + g_cond_broadcast (demux->fetcher_cond); } default: break; @@ -771,7 +771,7 @@ gst_hls_demux_fetcher_bus_handler (GstBus * bus, if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) { demux->fetcher_error = TRUE; - g_cond_signal (demux->fetcher_cond); + g_cond_broadcast (demux->fetcher_cond); } gst_message_unref (message); @@ -994,6 +994,12 @@ gst_hls_demux_fetch_location (GstHLSDemux * demux, const gchar * uri) g_mutex_lock (demux->fetcher_lock); + while (demux->fetcher) + g_cond_wait (demux->fetcher_cond, demux->fetcher_lock); + + if (demux->cancelled) + goto quit; + if (!gst_hls_demux_make_fetcher (demux, uri)) { goto uri_error; } @@ -1034,6 +1040,8 @@ state_change_error: quit: { g_mutex_unlock (demux->fetcher_lock); + /* Unlock any other fetcher that might be waiting */ + g_cond_broadcast (demux->fetcher_cond); return bret; } } |