From patchwork Fri May 29 03:39:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 19956 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 52A6A44B96A for ; Fri, 29 May 2020 06:46:46 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E7D168AAD8; Fri, 29 May 2020 06:46:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from qq.com (smtpbg551.qq.com [183.3.226.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 786B968A308 for ; Fri, 29 May 2020 06:46:39 +0300 (EEST) X-QQ-mid: bizesmtp20t1590723548tk7r0l0c Received: from localhost (unknown [103.107.216.232]) by esmtp6.qq.com (ESMTP) with id ; Fri, 29 May 2020 11:39:07 +0800 (CST) X-QQ-SSF: 01100000002000Y0ZXF0B00A0000000 X-QQ-FEAT: P8dY9APmXTQmeCCKxIvKKyFQRfaG6lcm1GGpNGmvhXraFDB0q9yP5hHcr2mz/ oh5B73V4axBEJ6vnIjJ6b6WlvHR3wdi4Pf5IfJj+xBlPkFo03WLyjlYJ69mtDHEPlVu2Xj6 gVEPoResMABtsewEjq+dmpsT9+fUv9tFA7sm6zskAptwIuw6sxgStyJ7QB0qIBCKJWE3U9u FltznVSiyblkeDP3ED17/xxOnexeWuZCcHELQ9w27/9x5Gu8TDZjRjmxEoPTbDMW6met/KG dRpsgcJlVPaz4p3BqxjhmX5DGVOwgN76AIZsJXRVb0CV9OhiOQundrxZw= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 May 2020 11:39:05 +0800 Message-Id: <20200529033905.41926-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avformat/hls: check segment duration value of EXTINF 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" fix ticket: 8673 set the default EXTINF duration to 1ms if duration is smaller than 1ms Signed-off-by: Steven Liu --- libavformat/hls.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 3e35d157ad..8c4126b880 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -883,8 +883,6 @@ static int parse_playlist(HLSContext *c, const char *url, ret = AVERROR(ENOMEM); goto fail; } - seg->duration = duration; - seg->key_type = key_type; if (has_iv) { memcpy(seg->iv, iv, sizeof(iv)); } else { @@ -914,6 +912,13 @@ static int parse_playlist(HLSContext *c, const char *url, goto fail; } + if (duration < 0.001 * AV_TIME_BASE) { + av_log(c->ctx, AV_LOG_WARNING, "Cannot get correct #EXTINF value of segment %s," + " set to default value to 1ms.\n", seg->url); + duration = 0.001 * AV_TIME_BASE; + } + seg->duration = duration; + seg->key_type = key_type; dynarray_add(&pls->segments, &pls->n_segments, seg); is_segment = 0;