From patchwork Wed May 10 21:58:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 41574 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp4169972pzb; Wed, 10 May 2023 14:58:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mC0yAUsi/MDYIUXcNVBP9kL8ermsKNNnR8pKDbGgKAadPjuLvKGgDALIDIbGgx3rywlub X-Received: by 2002:a05:6402:389:b0:50b:f72f:adf8 with SMTP id o9-20020a056402038900b0050bf72fadf8mr15929913edv.21.1683755923403; Wed, 10 May 2023 14:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683755923; cv=none; d=google.com; s=arc-20160816; b=meAyysRY3lpL80dBl9nW9I1wSX8HWnTucXzH/DkfxeTKrv8HTSDay9N8lfjOD0GWun zIEQPWHtU2+NkA8aSbtpUG3G3t4zVbjJ9z+dSQgAVEXYAoBi/wt/cglPx9hXfbOOjwyz itsbiEp58nD+RxZePYlqWCzdL8lJfilTf8WzUbABxgV3lsaC53FHFhcnVL4GMep2+a6L vDc26uFV5fJasetPdA+DQlcB3wqvUmr0Sq0Q302gSYeXYVPoR8MTEiXPDyYxx9r6LILI sf2QgCi0bLqdmdjUijhMaLt/xMpiHyDRkx6j34lYaPz9i6YfJs/79iw5GRdXoSm3WHHY kV6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=Oo5PAeR2BXDf5Og+SE1CYZ50fnEBt7AExPEW3W+iwOI=; b=LgBJh5kN2YNfhNZ5wgc5GgzkWa8Y79U+/aJCrdRlyCnhhsGGA+wKsEY9KtoTr74Gbv iq2yku6HLsLFAJThYM6FVaqpW/xw9IevGfArvskgCDedan+AekqW7gZwEcU3o95ZWyrT I/3Vo03ht91Tvs44meONrWdWfwvgBQUIqzwbxGRoLDyVR8emBWb/DullxL8or+lHrC0b gaB7RaZFTi0d8ihrNJeJAQ2zqdDX+oRrM/laZ9H6dQyjkhrAoA5pJg1bZMNzsZQRV/O7 At10oKVdcHspOivsC30bLVxro+hBFMnudzmMWc+MV7iUuMPmQz0APkxVl0flwGt1xguF oR5A== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g16-20020a056402115000b0050bc014786esi3661409edw.33.2023.05.10.14.58.42; Wed, 10 May 2023 14:58:43 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7D22E68C123; Thu, 11 May 2023 00:58:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02CED68BE02 for ; Thu, 11 May 2023 00:58:33 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 40882E0003 for ; Wed, 10 May 2023 21:58:33 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 10 May 2023 23:58:31 +0200 Message-Id: <20230510215832.1001-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/format: Stop reading data at EOF during probing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: Xz1OHGROyu/x Issue found by: Сергей Колесников Signed-off-by: Michael Niedermayer --- libavformat/format.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/format.c b/libavformat/format.c index 76f25ab5a6..52b814e67d 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -231,6 +231,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, int ret = 0, probe_size, buf_offset = 0; int score = 0; int ret2; + int eof = 0; if (!max_probe_size) max_probe_size = PROBE_BUF_MAX; @@ -254,7 +255,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, } } - for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt; + for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt && !eof; probe_size = FFMIN(probe_size << 1, FFMAX(max_probe_size, probe_size + 1))) { score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; @@ -270,6 +271,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, score = 0; ret = 0; /* error was end of file, nothing read */ + eof = 1; } buf_offset += ret; if (buf_offset < offset) From patchwork Wed May 10 21:58:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 41575 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dca6:b0:f3:34fa:f187 with SMTP id ky38csp4170033pzb; Wed, 10 May 2023 14:58:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78jl/kfjLCF6ied4X3dEjd8SrfVLqgs+Ou69UK6gY2swoNh29TkPea5qNlQkesbXyyffiS X-Received: by 2002:a17:907:da7:b0:966:4e84:d82d with SMTP id go39-20020a1709070da700b009664e84d82dmr13111712ejc.3.1683755932308; Wed, 10 May 2023 14:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683755932; cv=none; d=google.com; s=arc-20160816; b=pd+Cr4xsUl9AoSYLM7BzAqpu/h1Hk3lIPfLtWRfdqVf+Fvwyg8pPCjkaJng8tOIALk mEmGTSfhUnsWkN/WaSgAZvLWtow39mARpBrgewcbDrIe1AzRZlOTs3D/d8BCsbSSv34i 5H/p1T5y95tvJ8plSGS/OIsDosM/cLELgoyTyc+jZJEN+desJ+ljhusSkBDxdOSiu5mq LOB45O9sEVeYI2PF6oM+Ywfh/m5KodXl9cYDh8GUNFQrPJ2K36OxUTlZ5mHfRi7SBIz4 0cFfJ+C+6O0YDQwoMYcAT3pRllBNyisKC4bOweswIumNCjbDHz1dln+kntwBZbm2MUP6 2I/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=ltcq1fxvWk4MMas/VfXUUHxFemt5T8jkm88uhzkeloM=; b=zHIXzNoYRf6v/8v88XW1n+5NZEgFC3jslK2MPcWOTk5eNru+EnNq/4vQPJq1sywt33 9FOrIFhqiKh07AsgNOOYTvAgzF+j6vviuexuKeOOxo3OuZ/WuZwrYM9LKOq8JqTe96ut a3yWXhhz/OadFx/zehhJstLNoiW9DEqDRdCmO5d9H/m2YycHUYmCzpqOtutfsJgdKBVP JnYjJSDivBgUhD5FpzAeeInPSwhp12RocEFMYGTEQDiocaQA2xO+00IfIVuRYkcjWpRE vn+MbLqUK9ZyS9LzD5istUBurcRhI5w/5QIV0CssK+L9iewNgfKOKMwcDVXwi/8t1NF2 9KsQ== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h17-20020a1709070b1100b00965f9eccbcasi4416870ejl.726.2023.05.10.14.58.50; Wed, 10 May 2023 14:58:52 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6563668C16F; Thu, 11 May 2023 00:58:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 198FA68C123 for ; Thu, 11 May 2023 00:58:35 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 578761BF205 for ; Wed, 10 May 2023 21:58:34 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 10 May 2023 23:58:32 +0200 Message-Id: <20230510215832.1001-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230510215832.1001-1-michael@niedermayer.cc> References: <20230510215832.1001-1-michael@niedermayer.cc> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/hls: reduce default max reload to 100 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: V3Rs1ghQRCYh The 1000 did result in a apparent never ending reload loop Issue found by: Сергей Колесников Signed-off-by: Michael Niedermayer --- libavformat/hls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 11e345b280..77bce8fc0d 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2556,7 +2556,7 @@ static const AVOption hls_options[] = { {.str = "3gp,aac,avi,ac3,eac3,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"}, INT_MIN, INT_MAX, FLAGS}, {"max_reload", "Maximum number of times a insufficient list is attempted to be reloaded", - OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS}, + OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 100}, 0, INT_MAX, FLAGS}, {"m3u8_hold_counters", "The maximum number of times to load m3u8 when it refreshes without new segments", OFFSET(m3u8_hold_counters), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS}, {"http_persistent", "Use persistent HTTP connections",