From patchwork Tue Sep 3 02:41:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 14880 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0278244A4F3 for ; Tue, 3 Sep 2019 05:41:31 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D50D5687F9F; Tue, 3 Sep 2019 05:41:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02270687F9F for ; Tue, 3 Sep 2019 05:41:23 +0300 (EEST) X-QQ-mid: bizesmtp19t1567478477t0ain01a Received: from localhost (unknown [49.7.64.202]) by esmtp10.qq.com (ESMTP) with id ; Tue, 03 Sep 2019 10:41:16 +0800 (CST) X-QQ-SSF: 01100000008000K0ZQF0000A0000000 X-QQ-FEAT: p05UcSBKqihgfSnwgIjixORocOhr+pjXeteyaejABXCcBQHlCe0+563Zhm3o9 8TYctxBQWoTkriTJ5Jmrn3P+Cn+1TnXDI/l7C4HvhYjkK+8JtCG10NDdYFxGmlCFAq8GRCZ ipres7oAoB2uhGe2SdYlWfqc6z45Hd+Nfjg2WVD2tvGV+uWjWge9UFNE/PPprBDRuHvTjjJ 3eYPt+H+K7yKsJuZPXSAgVJbsgyxwwC9Yn7Y8WzXxRdv/D52ejEahyO9xrcbydDcsJZqam2 h15iQQvGP5a006yfAxeIDNLlYn/Ie/zQuFFiCGSDVDk7y3SuQlDaiUgYQIyaLXhNOoiTFNQ ADSk6hR X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Tue, 3 Sep 2019 10:41:14 +0800 Message-Id: <20190903024114.94705-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avformat/hls: mark the playlist is broken when the reload times is over X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" when the playlist is master playlist, there have many playlist. the workflow should continue if one of the playlist is broken. Signed-off-by: Steven Liu --- libavformat/hls.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 3aee7a19ae..d2fafe0302 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1408,8 +1408,11 @@ restart: reload: reload_count++; - if (reload_count > c->max_reload) + if (reload_count > c->max_reload) { + v->broken = 1; + v->needed = 0; return AVERROR_EOF; + } if (!v->finished && av_gettime_relative() - v->last_load_time >= reload_interval) { if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) { @@ -1459,7 +1462,7 @@ reload: if (ret < 0) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; - av_log(v->parent, AV_LOG_WARNING, "Failed to open segment %d of playlist %d\n", + av_log(v->parent, AV_LOG_WARNING, "Failed to open segment %d of playlist %d, will reload\n", v->cur_seq_no, v->index); v->cur_seq_no += 1; @@ -1925,6 +1928,7 @@ static int hls_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Error when loading first segment '%s'\n", pls->segments[0]->url); avformat_free_context(pls->ctx); pls->ctx = NULL; + if (c->n_playlists > 1) continue; goto fail; } pls->ctx->pb = &pls->pb;