From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AC55945817 for ; Fri, 24 Mar 2023 21:05:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FCDF68C813; Fri, 24 Mar 2023 23:05:14 +0200 (EET) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AAC3768C7A8 for ; Fri, 24 Mar 2023 23:05:07 +0200 (EET) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 32OL56cO026300-32OL56cP026300 for ; Fri, 24 Mar 2023 23:05:06 +0200 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id AD80BA1542 for ; Fri, 24 Mar 2023 23:05:06 +0200 (EET) Date: Fri, 24 Mar 2023 23:05:05 +0200 (EET) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <7575f077-861b-6b95-7ab7-796fa22282e0@passwd.hu> Message-ID: <10da54aa-8e62-d650-b49e-86f5dc87e8f7@martin.st> References: <20230321123729.74124-1-martin@martin.st> <20230321123729.74124-2-martin@martin.st> <4ce99489-4b19-3c7c-88aa-1080531f925d@passwd.hu> <167965631336.27013.11967328893560145187@lain.khirnov.net> <167965895662.27013.10941166628081645662@lain.khirnov.net> <7575f077-861b-6b95-7ab7-796fa22282e0@passwd.hu> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM Subject: Re: [FFmpeg-devel] [PATCH 2/2] aviobuf: Avoid clearing the whole buffer in fill_buffer 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 24 Mar 2023, Marton Balint wrote: > I am uneasy about complicating an already complicated and > hard-to-follow AVIO layer with heuristics which activate on magic > behaviour. And we all know how long temporary solutions last :) > > I guess we could add some new parameter to AVIOContext end enable this > data-shifting behaviour explicitly when you reconfigure the buffer size > for index in the MOV demuxer. But is it worth it? How significant is the > "improvement" this patch provides over the previous one in the series? With the 2.6 GB, 40 minute mov file I'm looking at, originally, due to the issue fixed in patch 1/2, the buffer size was never increased from the original 32 KB, so when reading the file linearly, we would do many tens of thousands of seek requests, giving absolutely abysmal performance. (I saw a server side log number saying 120 000 requests.) With patch 1/2 applied, while reading the bulk of the file, it does ~170 seeks. So nothing terrible, but it still feels unnecessarily inefficient to do >4 seeks per minute due to the fact that the aviobuf layer is throwing away good data that it already had buffered. In this case, it used a buffer size of 16 MB, and calculating 2.6 GB / 16 MB ends up very near 170. So every time the 16 MB aviobuf buffer gets full and aviobuf clears it, we end up doing a seek backwards. With patch 2/2 applied, we no longer do any seeks while reading the bulk of the file (at the start/end of the file there are still a bunch of scattered seeks though). // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".