hlsdemux: clean up code a little bit

This commit is contained in:
Andoni Morales Alastruey 2011-02-16 00:55:30 +01:00 committed by Sebastian Dröge
parent 1450233a21
commit ec1d03e1b4

View file

@ -474,11 +474,9 @@ gst_hls_demux_loop (GstHLSDemux * demux)
* when we reached the end of the playlist */ * when we reached the end of the playlist */
if (G_UNLIKELY (demux->need_cache)) { if (G_UNLIKELY (demux->need_cache)) {
gboolean ret; if (!gst_hls_demux_cache_fragments (demux))
ret = gst_hls_demux_cache_fragments (demux);
if (!ret) {
goto cache_error; goto cache_error;
}
/* we can start now the updates thread */ /* we can start now the updates thread */
gst_hls_demux_start_update (demux); gst_hls_demux_start_update (demux);
GST_INFO_OBJECT (demux, "First fragments cached successfully"); GST_INFO_OBJECT (demux, "First fragments cached successfully");
@ -739,6 +737,7 @@ static gboolean
gst_hls_demux_fetch_location (GstHLSDemux * demux, const gchar * uri) gst_hls_demux_fetch_location (GstHLSDemux * demux, const gchar * uri)
{ {
GstStateChangeReturn ret; GstStateChangeReturn ret;
gboolean bret = FALSE;
g_mutex_lock (demux->fetcher_lock); g_mutex_lock (demux->fetcher_lock);
@ -754,19 +753,12 @@ 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) {
GST_INFO_OBJECT (demux, "URI fetched successfully"); GST_INFO_OBJECT (demux, "URI fetched successfully");
ret = TRUE; bret = TRUE;
goto quit;
} }
ret = FALSE;
goto quit; goto quit;
uri_error: uri_error:
@ -774,7 +766,7 @@ uri_error:
GST_ELEMENT_ERROR (demux, RESOURCE, OPEN_READ, GST_ELEMENT_ERROR (demux, RESOURCE, OPEN_READ,
("Could not create an element to fetch the given URI."), ("URI: \"%s\"", ("Could not create an element to fetch the given URI."), ("URI: \"%s\"",
uri)); uri));
ret = FALSE; bret = FALSE;
goto quit; goto quit;
} }
@ -782,14 +774,14 @@ state_change_error:
{ {
GST_ELEMENT_ERROR (demux, CORE, STATE_CHANGE, GST_ELEMENT_ERROR (demux, CORE, STATE_CHANGE,
("Error changing state of the fetcher element."), NULL); ("Error changing state of the fetcher element."), NULL);
ret = FALSE; bret = FALSE;
goto quit; goto quit;
} }
quit: quit:
{ {
g_mutex_unlock (demux->fetcher_lock); g_mutex_unlock (demux->fetcher_lock);
return ret; return bret;
} }
} }