@@ -194,6 +194,7 @@ typedef struct HLSContext {
int cur_seq_no;
int live_start_index;
+ int skip_down_streams;
int first_packet;
int64_t first_timestamp;
int64_t cur_timestamp;
@@ -1652,11 +1653,20 @@ static int hls_read_header(AVFormatContext *s)
/* If the playlist only contained playlists (Master Playlist),
* parse each individual playlist. */
if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) {
+ int all_failed = 1;
for (i = 0; i < c->n_playlists; i++) {
struct playlist *pls = c->playlists[i];
- if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0)
+ av_log(NULL, AV_LOG_WARNING, "Trying %s\n", pls->url);
+ ret = parse_playlist(c, pls->url, pls, NULL);
+ if (c->skip_down_streams && ret < 0) {
+ all_failed = 0;
+ } else if(ret < 0) {
goto fail;
+ }
}
+
+ if (all_failed)
+ goto fail;
}
if (c->variants[0]->playlists[0]->n_segments == 0) {
@@ -2126,6 +2136,8 @@ static int hls_probe(AVProbeData *p)
static const AVOption hls_options[] = {
{"live_start_index", "segment index to start live streams at (negative values are from the end)",
OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, INT_MAX, FLAGS},
+ {"skip_down_streams", "continue playback of HLS when one of the variant streams are down",
+ OFFSET(skip_down_streams), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS},
{NULL}
};
option to skip down streams in HLS From 14eb94c48fddf92d63d7d7030689a625a4228740 Mon Sep 17 00:00:00 2001 From: amine kabab <amine.k@avito.ma> Date: Tue, 18 Apr 2017 15:12:38 +0000 Subject: [PATCH] HLS, add option to skip down streams --- libavformat/hls.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)