From patchwork Thu Apr 13 16:33:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Hunt X-Patchwork-Id: 3397 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp770933vsd; Thu, 13 Apr 2017 09:34:04 -0700 (PDT) X-Received: by 10.28.40.198 with SMTP id o189mr26803697wmo.108.1492101244388; Thu, 13 Apr 2017 09:34:04 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 7si13802245wmx.19.2017.04.13.09.34.03; Thu, 13 Apr 2017 09:34:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4E05A689933; Thu, 13 Apr 2017 19:33:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw0-f193.google.com (mail-yw0-f193.google.com [209.85.161.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5FC0689216 for ; Thu, 13 Apr 2017 19:33:48 +0300 (EEST) Received: by mail-yw0-f193.google.com with SMTP id l189so4589388ywb.0 for ; Thu, 13 Apr 2017 09:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=2f/yY+QvjrHICwb9R89jjbF3UyF1+EExhX9Fj5Mg/wI=; b=tQe7wg3y7bd9gGG/YcpNqAw2mckAZzTtpAySMkjuV4AUjGNEBT+FbIkjFOBYPBbW3l hbNJDuhZumjMSZqqxYLt+BC/VJDHS7XayWM683I/4tDEuzfgurWxMq0mXp6HCf0XkbHi 7Zjro3DfWdwj5CAdUN/7gK1wUTT0+b98NQEndh4i/xqmM3ZnEyZhZx0rpLM+LD7n6fl4 yHlbTC/jLZ+LBY4SBQwsNGA1FovHACSqxztEWbjfFQSjNGdS3h5x51ZjSpbNbFFnWlV+ rRufdYWuf9r5xcmn7bFVFyqSwE8LzL848I5iqV4J6ojH9RGcfoFcRiUjKqyZRjKeZy7H Awcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=2f/yY+QvjrHICwb9R89jjbF3UyF1+EExhX9Fj5Mg/wI=; b=O8WSXT9c4+weXm7iWVeNA4mREAIBrLtY2ODuJ7lKF5f57m/hRUKpvDlq0rA/ZD92Av gcnEb5Vz2IvGMizSyg6GrSeGv+PyKu26/WO9En1ENxdWx8DVxlV3FIqjs53+SrC/cCls htsmE9tNUXFUvE4HMRbqCkWBqWkmFSDogeWjWeISYMKWHTtRZxiquA+LgaFpWefEiK26 YjmblXFlvJHDsX5a4C8beaxC6iDKhkpdmVXVHHcqNmsSUJqJ+3uLm8Gy2jyFwDoPV7ZG anOGBhJWaUlEXfRi/Iflyea3Jtpp2pCkoHASfj0XmtCyBI3AIUsOQMsZgjNjeD65nT+b EWdA== X-Gm-Message-State: AN3rC/7xNFHWOJakVxS54Mz0dyO0630iwT8qOVFDB7GIbixKIVw+Lun3 qTqI9M0HoaI7CWF11PHJxNWtNY2Y6w== X-Received: by 10.129.51.74 with SMTP id z71mr2976611ywz.352.1492101233555; Thu, 13 Apr 2017 09:33:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.215.130 with HTTP; Thu, 13 Apr 2017 09:33:33 -0700 (PDT) In-Reply-To: <20170413162433.GJ4714@nb4> References: <20170413162433.GJ4714@nb4> From: Tim Hunt Date: Thu, 13 Apr 2017 17:33:33 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] avformat/hls allow playback when some variant streams are unavailable 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Not sure if it was email formatting or editor setting. Is this patch ok? On Thu, Apr 13, 2017 at 5:24 PM, Michael Niedermayer wrote: > On Thu, Apr 13, 2017 at 04:14:46PM +0100, Tim Hunt wrote: > > My last patch was slightly convoluted and really dumb. > > > > I suspect it impacts on a couple of checks for > > variants[0]->playlists[0]->finished and the problem will be when a non > live > > stream has two variants using EXT-X-ENDLIST and the first stream in the > > playlist is down? Not sure how to approach this, will look into it more > > later. > > > > --- > > libavformat/hls.c | 17 +++++++++++------ > > 1 file changed, 11 insertions(+), 6 deletions(-) > > > > diff --git a/libavformat/hls.c b/libavformat/hls.c > > index bac53a4..26b8751 100644 > > --- a/libavformat/hls.c > > +++ b/libavformat/hls.c > > @@ -1611,7 +1611,7 @@ static int hls_read_header(AVFormatContext *s) > > void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; > > HLSContext *c = s->priv_data; > > int ret = 0, i; > > - int highest_cur_seq_no = 0; > > + int highest_cur_seq_no = 0, found_segments; > > > > c->ctx = s; > > c->interrupt_callback = &s->interrupt_callback; > > @@ -1652,14 +1652,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) { > > + found_segments = -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) > > - goto fail; > > + if (parse_playlist(c, pls->url, pls, NULL) == 0 && > > pls->n_segments > 0) > > + found_segments = 1; > > this patch is corrupted by newlines > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Old school: Use the lowest level language in which you can solve the > problem > conveniently. > New school: Use the highest level language in which the latest > supercomputer > can solve the problem without the user falling asleep waiting. > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > From cc20762ec30e3021b4593fb89c681f5000ddb1fe Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 13 Apr 2017 15:35:07 +0100 Subject: [PATCH] avformat/hls allow playback of variant streams when some missing ticket #2617 --- libavformat/hls.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index bac53a4..26b8751 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1611,7 +1611,7 @@ static int hls_read_header(AVFormatContext *s) void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; HLSContext *c = s->priv_data; int ret = 0, i; - int highest_cur_seq_no = 0; + int highest_cur_seq_no = 0, found_segments; c->ctx = s; c->interrupt_callback = &s->interrupt_callback; @@ -1652,14 +1652,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) { + found_segments = -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) - goto fail; + if (parse_playlist(c, pls->url, pls, NULL) == 0 && pls->n_segments > 0) + found_segments = 1; } - } - if (c->variants[0]->playlists[0]->n_segments == 0) { + if(found_segments == -1) { + av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); + ret = AVERROR_EOF; + goto fail; + } + } else if (c->variants[0]->playlists[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; @@ -1805,7 +1811,6 @@ static int hls_read_header(AVFormatContext *s) } update_noheader_flag(s); - return 0; fail: hls_close(s); -- 2.7.4