mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-12 09:15:29 +00:00
hlsdemux: make sure we don't stop the fetcher twice from different threads
This commit is contained in:
parent
6a0aec0639
commit
b9a0b4ddd4
2 changed files with 9 additions and 1 deletions
|
@ -418,10 +418,11 @@ gst_hls_demux_stop_fetcher (GstHLSDemux * demux, gboolean cancelled)
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
if (demux->fetcher == NULL)
|
if (demux->fetcher == NULL || demux->stopping_fetcher)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "Stopping fetcher.");
|
GST_DEBUG_OBJECT (demux, "Stopping fetcher.");
|
||||||
|
demux->stopping_fetcher = TRUE;
|
||||||
gst_element_set_state (demux->fetcher, GST_STATE_NULL);
|
gst_element_set_state (demux->fetcher, GST_STATE_NULL);
|
||||||
pad = gst_pad_get_peer (demux->fetcherpad);
|
pad = gst_pad_get_peer (demux->fetcherpad);
|
||||||
if (pad) {
|
if (pad) {
|
||||||
|
@ -534,6 +535,7 @@ gst_hls_demux_make_fetcher (GstHLSDemux * demux, const gchar * uri)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
demux->fetcher_error = FALSE;
|
demux->fetcher_error = FALSE;
|
||||||
|
demux->stopping_fetcher = FALSE;
|
||||||
gst_element_set_bus (GST_ELEMENT (demux->fetcher), demux->fetcher_bus);
|
gst_element_set_bus (GST_ELEMENT (demux->fetcher), demux->fetcher_bus);
|
||||||
|
|
||||||
g_object_set (G_OBJECT (demux->fetcher), "location", uri, NULL);
|
g_object_set (G_OBJECT (demux->fetcher), "location", uri, NULL);
|
||||||
|
@ -718,6 +720,11 @@ gst_hls_demux_fetch_location (GstHLSDemux * demux, const gchar * uri)
|
||||||
GST_DEBUG_OBJECT (demux, "Waiting to fetch the URI");
|
GST_DEBUG_OBJECT (demux, "Waiting to fetch the URI");
|
||||||
g_cond_wait (demux->fetcher_cond, demux->fetcher_lock);
|
g_cond_wait (demux->fetcher_cond, demux->fetcher_lock);
|
||||||
|
|
||||||
|
if (demux->stopping_fetcher) {
|
||||||
|
ret = FALSE;
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
gst_hls_demux_stop_fetcher (demux, FALSE);
|
gst_hls_demux_stop_fetcher (demux, FALSE);
|
||||||
|
|
||||||
if (demux->downloaded_uri != NULL) {
|
if (demux->downloaded_uri != NULL) {
|
||||||
|
|
|
@ -81,6 +81,7 @@ struct _GstHLSDemux
|
||||||
GCond *fetcher_cond;
|
GCond *fetcher_cond;
|
||||||
GTimeVal *timeout;
|
GTimeVal *timeout;
|
||||||
gboolean fetcher_error;
|
gboolean fetcher_error;
|
||||||
|
gboolean stopping_fetcher;
|
||||||
GstBuffer *downloaded_uri;
|
GstBuffer *downloaded_uri;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue