mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
hlsdemux: Allow up to 3 consecutive failed downloads before erroring
In some networks, especiall in 3G, a fragment download or playlist update may fail. We allow for up to 3 consecutive failures, while using the rfc's specs for retry delays before considering that there was an error on the stream.
This commit is contained in:
parent
8889c5927c
commit
acacc251fa
1 changed files with 24 additions and 5 deletions
|
@ -909,10 +909,18 @@ gst_hls_demux_update_thread (GstHLSDemux * demux)
|
||||||
/* update the playlist for live sources */
|
/* update the playlist for live sources */
|
||||||
if (gst_m3u8_client_is_live (demux->client)) {
|
if (gst_m3u8_client_is_live (demux->client)) {
|
||||||
if (!gst_hls_demux_update_playlist (demux)) {
|
if (!gst_hls_demux_update_playlist (demux)) {
|
||||||
GST_ERROR_OBJECT (demux, "Could not update the playlist");
|
demux->client->update_failed_count++;
|
||||||
|
if (demux->client->update_failed_count < DEFAULT_FAILED_COUNT) {
|
||||||
|
GST_WARNING_OBJECT (demux, "Could not update the playlist");
|
||||||
|
gst_hls_demux_schedule (demux);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
|
||||||
|
("Could not update the playlist"), (NULL));
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* schedule the next update */
|
/* schedule the next update */
|
||||||
gst_hls_demux_schedule (demux);
|
gst_hls_demux_schedule (demux);
|
||||||
|
@ -931,10 +939,21 @@ gst_hls_demux_update_thread (GstHLSDemux * demux)
|
||||||
/* fetch the next fragment */
|
/* fetch the next fragment */
|
||||||
if (g_queue_is_empty (demux->queue)) {
|
if (g_queue_is_empty (demux->queue)) {
|
||||||
if (!gst_hls_demux_get_next_fragment (demux)) {
|
if (!gst_hls_demux_get_next_fragment (demux)) {
|
||||||
if (!demux->end_of_playlist && !demux->cancelled)
|
if (!demux->end_of_playlist && !demux->cancelled) {
|
||||||
GST_ERROR_OBJECT (demux, "Could not fetch the next fragment");
|
demux->client->update_failed_count++;
|
||||||
|
if (demux->client->update_failed_count < DEFAULT_FAILED_COUNT) {
|
||||||
|
GST_WARNING_OBJECT (demux, "Could not fetch the next fragment");
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
|
||||||
|
("Could not fetch the next fragment"), (NULL));
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
demux->client->update_failed_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* try to switch to another bitrate if needed */
|
/* try to switch to another bitrate if needed */
|
||||||
gst_hls_demux_switch_playlist (demux);
|
gst_hls_demux_switch_playlist (demux);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue