From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id EF74B4BB1C for ; Tue, 30 Dec 2025 17:12:30 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'B24Bi4R5bBxQV8lmuwRCwoB0FzUB/h1fxez+l8mAH3E=', expected b'zDXuXvybJJSTGBt+GldHZ66NpOp2J+oKalHfs16TiBo=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767114731; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=B24Bi4R5bBxQV8lmuwRCwoB0FzUB/h1fxez+l8mAH3E=; b=IC5nQLwfKR3Vu1XPpp1TV0iOG9M19CP8zaWl4ukQJ17BY0kHjrxujYJe9SRPlKyKkMft7 5jgmbVGtbI4yDRMRtEV5TvHQaQV/Wqhrz+hKV4NiBvs84DtrSJuFh14DKZQQ4FxTnGnRBsg xOOhoxR8+yE+susGeGEriplk5qZ2B9yA8WRJSKZOkgnBfzDo0opBEI6KUE8HMEOcqWNwMH0 q+mzKf/EFj+/Cf6HU0+xdOAn92EbYwlSLt0Bt1nvSxHRZSu8Ie3EmhD0mxL5iuqGx6QK2aj rSz1Ve/Vzq5idBt0EGGVYj3SMr9gw/FTOWCtezWnBvwJfvK6zQp8N2JJ2Rdw== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id D0B8A690C7A; Tue, 30 Dec 2025 19:12:11 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1767114717; b=YMpDivbj78tno6NyjCDZ1aTLHC7FuPbZ75rtV4ziZzelA1UzdUB1KTveRRWZEQaC1Q57A oCQcdKzi3AswtM0l7MyOomhiOh0OL2pC1B8YtkB4oCRb47XyDLwl3KYtAOv/aBBoiNvVPBR JMUtEl+NeKuAY5s50slsl72NLp25ZUCohYPP3g4vsdaGLn/zVc+Nd+wVy17wiGAqeKkDrkW v9fJwq32VKEiYC+dwmwWMg4dkcYrAPKDNhC/c+dIweCSRnqVH2NH8X1dXJM5nnufb86HFsD wHp+R+aQQvSpj47x/d+4MbBsRK38MQJHF3igtUvrNMF5Cl4le2l6a3vhKd7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1767114717; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=xXKTWJVvr1mtOVwa/x/xQ7uny1EAZkLTCoZeqWcbi28=; b=XJFZLrBGvlpZyQWrhLDLY39UHXX0QV4saG6xcQoGL5y9A51uB6yzZDM3RNJIyT+ZL7HGP flXR7TaQSnuHr9YzdUxbhY4NNmAkCvtyFh2Y3TFdGpV1cULfKY2J2QeXPIkhffp+tkPrSKu FUK30LTC9pBnj5Y/K5SEjnH3i3ES7d+SuPz0BAc7HCV8RdjFxQ9Aa++6CqeLRZW/gsZk0Vy 2lbHRY7STMxYw6FDSZkBSCxiTIVab+L7Roa/3FFbYV1EkpqpSJeGxk8QtPxe00yfbsphDsp kk/gBXgkvepgLhjRng/eNRYmjC9GSc/VJ9RML/I43+gRpUlNuuL20J2pmRbg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767114709; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=zDXuXvybJJSTGBt+GldHZ66NpOp2J+oKalHfs16TiBo=; b=nYNrI3UQcQtEMdhNtztD3LbdZrus76idTb7Wt9kv/Jipz0gPjuCGjdkIgrB80zNqHzdeD +x8aR2Tcw7WJMZEUnv8ppR1Z3VH02purjtU42CfLYg2duE5GIiiV28LyybttLF1SmFpdTZs P3Vhj0X/h8gaL8MCpfMfcEtJdyc0a35qQPk3Ld9a+szACbmeqBAUVnRfRugVgiChnv8j55y PsXn4UNTAfv8gWs2quKflqQdVIqyWpLRSeHn/h6TTdQvG+9jyXhPsCRB5iX4vRlf6zcDP7x hZXuB90nIdvfxSMnSaZ9J/JcmZh49br3swv7y+VoJUeXlI59tz78gUyh/Urw== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id A6D54690BF1 for ; Tue, 30 Dec 2025 19:11:49 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 Dec 2025 17:11:49 -0000 Message-ID: <176711470981.25.17031785521120988050@4457048688e7> Message-ID-Hash: YCTZW4J3BXCO47654LOWI3Z7HFULQXM7 X-Message-ID-Hash: YCTZW4J3BXCO47654LOWI3Z7HFULQXM7 X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avformat/file: respect pkt_size even in streaming mode (PR #21321) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Marton Balint via ffmpeg-devel Cc: Marton Balint Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21321 opened by Marton Balint (cus) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21321 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21321.patch Also clarify the documentation a bit. Signed-off-by: Marton Balint >>From 3c14b23663d09be291799af0b6a62dfe553a072a Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Tue, 30 Dec 2025 02:36:04 +0100 Subject: [PATCH] avformat/file: respect pkt_size even in streaming mode Also clarify the documentation a bit. Signed-off-by: Marton Balint --- doc/protocols.texi | 12 +++++++----- libavformat/file.c | 18 +++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index b5330a1160..350c52a465 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -354,13 +354,15 @@ overriding this might speed up opening certain files at the cost of losing some features (e.g. accurate seeking). @item pkt_size -Set the maximum packet size used for file I/O. +Set the maximum packet size used for file I/O. A smaller value may reduce +memory usage. A higher value may increase throughput especially with networked +filesystems. -For writing, this sets the size of each write operation. The default is -262144 bytes. For reading, if explicitly set, it overrides the default internal buffer size -(32768 bytes) and limits the maximum amount of data read per operation. -Setting a smaller value may reduce memory usage when reading files sequentially. +(32 KB) and limits the maximum amount of data read per operation. + +For writing, this sets the size of each write operation. The default is 256 KB +for regular files, 32 KB otherwise. @end table @section ftp diff --git a/libavformat/file.c b/libavformat/file.c index 23dc7081d3..3ceddc8c25 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -312,14 +312,18 @@ static int file_open(URLContext *h, const char *filename, int flags) h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode); - /* Buffer writes more than the default 32k to improve throughput especially - * with networked file systems */ - if (!h->is_streamed) { - if (flags & AVIO_FLAG_WRITE) - h->min_packet_size = h->max_packet_size = c->pkt_size ? c->pkt_size : 262144; - else if (flags & AVIO_FLAG_READ && c->pkt_size) - h->max_packet_size = c->pkt_size; + if (c->pkt_size) { + h->max_packet_size = c->pkt_size; + } else { + /* Buffer writes more than the default 32k to improve throughput especially + * with networked file systems */ + if (!h->is_streamed && flags & AVIO_FLAG_WRITE) + h->max_packet_size = 262144; } + /* Disable per-packet flushing by default to improve throughput especially + * with networked file systems */ + if (!h->is_streamed && flags & AVIO_FLAG_WRITE) + h->min_packet_size = h->max_packet_size; if (c->seekable >= 0) h->is_streamed = !c->seekable; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org