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 632894B795 for ; Mon, 24 Nov 2025 13:09:35 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'DkesW8CPTiTBxi4mwRVLvpSQRaiFC/WwdxAt3Wu1P5o=', expected b'oXSl6Loq/jc8k9T7FnJlLa4ZcJZiM5uZnXmSJmr/7QI=')) 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=1763989760; 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=DkesW8CPTiTBxi4mwRVLvpSQRaiFC/WwdxAt3Wu1P5o=; b=KTVdJcVyh9s/D5wGt2ikvpo5Nq5+CinYxo7qct46evAwvxtdcwgnuQEY1qonZiq9oMvjO hyH1CiS49IEh8b4SaeX3oHxqYw1V8ihcjnyCNKXuoP4omjQ9P07U+Gr+d+kasRJRAFHXzgS n1ejZyIcsvX4d1BsRux4L+h4xtbWmrFRXV1wgZDRteyps1gINfRAXULjl5T6KpFhhGSJYdR zdFV8Pi4ftti8B5cWBtAOE7EqWA+E313IrVT7NFuoU+Ec+J/i0Y6otf1JORbe8a3M9ppDVi HnG8ynFy4hBGr4ekexJyIf49JBE8i77KZduBXodqFWeSMgYquXvLIfkj+nIQ== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 42388690163; Mon, 24 Nov 2025 15:09:20 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1763989744; b=ZmqG9tb8IdrkUxtPfhJHIeRtdJ45ZLyILzvLNikKlerq5WjUIZYCcmRrBRcQFHuZl7C/8 aKW2kNOyjFiNdPdDe75V3GqeCyh4B+Z8+05bsfw9Ki/2ogxWOHeUr8BRUiWets7YxvqQeUw 2pL2qqRYUckyAX7LqWCX2eiq4Gn40VOckqlgFpnfVH3Gdu5kRF+ZSaizJDDAcUddhypXZqb Nv7AdwU8RXMW1mNifd6aeukORypFReyA2FgNA50eDwHRkBCS39Jb5lncWUvDqxCRGrENIdC UprpPqKSLvVo/U/3SnVW62kkbFbwLjfFXPpkEqMW8JOmzF87xPvSw4GUj83g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1763989744; 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=PK8OpX76xz4aTUN6rBC9EH3Mu2oqusOGPuRNuRsTpGc=; b=q1+ZM/IsWfFIFM8OHvUkxGuJhY4So/iiTXszg585CKkTR/Vf/cACPt0im7hndpOmnNiKP 72eARZOLTFPQbSIH2qFwGhrlFgZPEZX4ZWTzBd1iBQWnJ3F3qmElmJmAbtvECfTOfLMp0cb gTNB+X/a3jV0aIDAl6D2X5IV6tLVKuDjOB+7L7K0f/0UuFKsqgdpDHILrlgd3xvdWeFxc9N LLrMlHD3UCxiXqFEce91+1yFIKdkJouiCJO4olmXe6j1nddUaSX/5zBBkCyh5HqPRhZE130 iE5hLaSrEl2jHWYLAPTneZfbjNQn5Q4Y3eLXGQSJuXl4kDE0sgjPoJ1vgKIg== 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=1763989737; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=oXSl6Loq/jc8k9T7FnJlLa4ZcJZiM5uZnXmSJmr/7QI=; b=etEtTQ8uSS4YXlPGTLq0H3h9mGbikdYhSJeN/9oYefD98sPhWW2GJ2cKeDQ61I2ZNdZYE xg4UGYVSX5444uNuWGA/9mxfwqZlnNblO38oOWf0qn0ICefrpz3LEd1KDuTFugg3JyBVsaU eGBetmuJYq1eJQSPW7YEZJMRUT2fWh5n5DC4M+MXLSfnHDe6LNSfbuZ2JsQ0VzdckDjLZck 8p8hFrjyLjd6eUn2RFQDi/Y9YSqjNV3HpbnV1xRtiPlCr0hDibuKnTrpG0X8h2QJ1xVWlfQ V1ELqGuSZhbQYq89xoVIFVfuEEbXYM0uGPpQs8/2HJkLYt0AF+UmcOB7RihQ== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 072466900F0 for ; Mon, 24 Nov 2025 15:08:56 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Nov 2025 13:08:56 -0000 Message-ID: <176398973716.39.6876964612433748486@2cb04c0e5124> Message-ID-Hash: URTKZEHL2RJHCE7TMKB5FJRQX3VQHZOB X-Message-ID-Hash: URTKZEHL2RJHCE7TMKB5FJRQX3VQHZOB 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] libavformat/file: allow configurable pkt_size for lower memory usage on embedded devices (PR #21004) 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: caifan via ffmpeg-devel Cc: caifan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21004 opened by caifan URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21004 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21004.patch This change lets embedded systems reduce memory usage by adjusting pkt_size through options. The code now applies pkt_size to both read and write cases. This makes the file protocol more flexible on devices with limited RAM. Signed-off-by: caifan3 >>From cb04a6c7ae0b65a97f8dae06e3557acce6d48fe3 Mon Sep 17 00:00:00 2001 From: caifan3 Date: Mon, 24 Nov 2025 20:59:54 +0800 Subject: [PATCH] libavformat/file: allow configurable pkt_size for lower memory usage on embedded devices This change lets embedded systems reduce memory usage by adjusting pkt_size through options. The code now applies pkt_size to both read and write cases. This makes the file protocol more flexible on devices with limited RAM. Signed-off-by: caifan3 --- libavformat/file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavformat/file.c b/libavformat/file.c index 97f5955f93..429ea644d7 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -107,7 +107,7 @@ static const AVOption file_options[] = { { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { "follow", "Follow a file as it is being written", offsetof(FileContext, follow), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, - { "pkt_size", "Maximum packet size", offsetof(FileContext, pkt_size), AV_OPT_TYPE_INT, { .i64 = 262144 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "pkt_size", "Maximum packet size", offsetof(FileContext, pkt_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { NULL } }; @@ -314,8 +314,11 @@ static int file_open(URLContext *h, const char *filename, int flags) /* Buffer writes more than the default 32k to improve throughput especially * with networked file systems */ - if (!h->is_streamed && flags & AVIO_FLAG_WRITE) - h->min_packet_size = h->max_packet_size = c->pkt_size; + if (!h->is_streamed && (flags & AVIO_FLAG_WRITE)) + h->min_packet_size = h->max_packet_size = c->pkt_size ? c->pkt_size : 262144; + + if (!h->is_streamed && (flags & AVIO_FLAG_READ)) + h->min_packet_size = h->max_packet_size = c->pkt_size ? c->pkt_size : 32768; 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