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 F3D7C4AFC5 for ; Mon, 22 Sep 2025 23:24:15 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'94r9TJZ69F7uOK4zIBD8IYzxsVcJHwxHkDgadYD4f4Y=', expected b'c6zE99B04OG/8HCGtbRsUiObN2bzn4rzkUGvk///I1A=')) 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=1758583450; 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=94r9TJZ69F7uOK4zIBD8IYzxsVcJHwxHkDgadYD4f4Y=; b=tRFfyLNAXlrussOZHC2asnnOH9lXZ0dqA6SpM1UJUA1bp/sP5U1mjZ86ANnEbiUtPbvQ/ t3KQSs5vt8JvpM40is7O91Gtx++rKT94dcdwKNvS6Rkjyw9ac3G3lwsYXAOhAdtsrMCisOT giGNAbVO3a5cXdnzbaV3UCiY14QLH/H7gMzsd/ZH7gBvWPLWXbaz+BCzQmvTjMGpGYpYrQ2 xPEwwCUypdBnkP8CvGBinEbPysWax3fIT3sHKE4DflFA/lM6o7uKtCY/zIFaBhl9RZ/6E/w OFSQWsg90rk1QsT08c7RIqZLIJKyvTuAJ1ynRlweSaCwo7PBfv6ty/GWAOnQ== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id CFDE068EB3C; Tue, 23 Sep 2025 02:24:10 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1758583449; b=rrSWL5qHS+jgamGQ9XYVBPhZITLiU6IC5hMGb3oZCKjqg4uH5FOgCa0PqUkI5ZlXTIrhK fC+iZi6ePQYFgSo+OWDhqRPVHmMZ40ctAt4RfUjJguKlXeNQy6A1Q/6uhtGLTeer4lNnNgZ qEfrJvPIrK0lcjXSY92OW9j6dVwiEhC2A1KQjO9dzZ72CgSBhr2vKbquJVsPBGHsPvlcNRl tHWsC/2ATx8eQ9px+DzTEtJMOLHklHK2vOzS5CBY1Hnp2ClX2IaT1X7LUUm7nSPXI6j9KIZ 0gCffT4W3hYkZ5j+slSU6z4kYkD3snCsnv8Lzi7j8RRVHqhSq0LyUW6Qyonw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1758583449; 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=n4eBBMZoya+Jb9IcGkDSdIHRKoxkJVEbvz1SO/RI7UI=; b=WhG0DRjpk1wh+jq6EsJv0P8911NUIichStdFEPwhKQb/fGKu93rt1yRBMJa+4T89MD7be qolaAvfZut8SuyZPYBq+qJy9ohB56ehhHdpYUvxi2PC9d+hEes8SnK58cPD/Gv8zLdTH62k otLKuLGg8sXk8StuZU8+VyuSLATBzBzZF0xAAkhSfV9Hvf1DhBusPSuYclsdLY79vpz+Lnm hdGx7w1RLADqqW5GY9SfxjfTchAr8zewj4UPOhH7O8HaO9dXyAyWoCYbaGHCem+GWpp+Uek X3CEPMuokXq/gDv7Jb6RrCLq1RRCU11y+ISCd0EHG5RNVK8SsSeVnkh4ExIQ== 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=1758583440; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=c6zE99B04OG/8HCGtbRsUiObN2bzn4rzkUGvk///I1A=; b=N8gJ46Sn3bXmcEGrHPH5DILhSVjRdapyxvC5kV9U4FpdrM589Gf/y2O0XF27K9rQv3mpz lsa4VzWFwT2bZAnTBq2e5qCSXv+2Y8eCiqmvF55mKuzbS27qZK2fmW+kpZ6KKjdfZi5LmN6 6qtdh2UKjdiixr8VXLPwuRTcVYMuoBJBhXJv+wDGBBRTwM3T6XXEd1TX/jA0X1YikP1TxSZ T0Ybkr219U1+j8GcyxiD322Zv7Vc+rsaIGifq+9OjdxrllodpsfQ84yMBvZ35mfy1VOKciU N25qmATNEXVBSFVYbRU9ZkZ8ccCesuAvwNCJx77qWKm7zTzb2EEO7e1p1rDg== Received: from ed19c606a818 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 1357C68EB2D for ; Tue, 23 Sep 2025 02:24:00 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Sep 2025 23:23:59 -0000 Message-ID: <175858344032.25.3513122687321718744@463a07221176> Message-ID-Hash: 64MJWY7J2VKLXC2WKHFPLW6BRD3XGO2B X-Message-ID-Hash: 64MJWY7J2VKLXC2WKHFPLW6BRD3XGO2B X-MailFrom: code@ffmpeg.org 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avformat/whip: remind user increase -buffer_size (PR #20579) 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: Jack Lau via ffmpeg-devel Cc: Jack Lau Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20579 opened by Jack Lau (JackLau) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20579 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20579.patch The udp buffer size might be too small to easily be full temporarily and return WSAEWOULDBLOCK. The udp code will handle the windows error code and convert it to AVERROR(EAGAIN). This issue just can be reproduced on windows. If sleep a interval and retry to send pkt when hit EAGAIN, it will increase latency, and appropriate interval is hard to define. So this patch just remind user increase the buffer size via -buffer_size to avoid this issue. Signed-off-by: Jack Lau >>From 07c0ee59f237e7f47e12224d1948c7f688a36ed7 Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Wed, 17 Sep 2025 10:25:41 +0800 Subject: [PATCH 1/3] avformat/whip: pass through buffer_size option to udp Signed-off-by: Jack Lau --- doc/muxers.texi | 3 +++ libavformat/whip.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 8c45b7d47a..f4caa4d7cb 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -3955,6 +3955,9 @@ Default value is 5000. Set the maximum size, in bytes, of RTP packets that send out. Default value is 1500. +@item buffer_size @var{integer} +Set the buffer size, in bytes, of underlying protocol. + @item authorization @var{string} The optional Bearer token for WHIP Authorization. diff --git a/libavformat/whip.c b/libavformat/whip.c index cfdc861c5b..e4386016a9 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -306,6 +306,7 @@ typedef struct WHIPContext { * Note that pion requires a smaller value, for example, 1200. */ int pkt_size; + int buffer_size;/* Underlying protocol send/receive buffer size */ /** * The optional Bearer token for WHIP Authorization. * See https://www.ietf.org/archive/id/draft-ietf-wish-whip-08.html#name-authentication-and-authoriz @@ -1191,8 +1192,9 @@ static int udp_connect(AVFormatContext *s) av_dict_set_int(&opts, "connect", 1, 0); av_dict_set_int(&opts, "fifo_size", 0, 0); - /* Set the max packet size to the buffer size. */ + /* Pass through the pkt_size and buffer_size to underling protocol */ av_dict_set_int(&opts, "pkt_size", whip->pkt_size, 0); + av_dict_set_int(&opts, "buffer_size", whip->buffer_size, 0); ret = ffurl_open_whitelist(&whip->udp, url, AVIO_FLAG_WRITE, &s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL); @@ -1954,6 +1956,7 @@ static int whip_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket static const AVOption options[] = { { "handshake_timeout", "Timeout in milliseconds for ICE and DTLS handshake.", OFFSET(handshake_timeout), AV_OPT_TYPE_INT, { .i64 = 5000 }, -1, INT_MAX, ENC }, { "pkt_size", "The maximum size, in bytes, of RTP packets that send out", OFFSET(pkt_size), AV_OPT_TYPE_INT, { .i64 = 1200 }, -1, INT_MAX, ENC }, + { "buffer_size", "The buffer size, in bytes, of underlying protocol", OFFSET(buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ENC }, { "authorization", "The optional Bearer token for WHIP Authorization", OFFSET(authorization), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, ENC }, { "cert_file", "The optional certificate file path for DTLS", OFFSET(cert_file), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, ENC }, { "key_file", "The optional private key file path for DTLS", OFFSET(key_file), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, ENC }, -- 2.49.1 >>From 4915fd78ba45f871ec750226b21ae2e5d0a1636e Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Wed, 17 Sep 2025 10:50:18 +0800 Subject: [PATCH 2/3] avformat/whip: remind user increase -buffer_size The udp buffer size might be too small to easily be full temporarily and return WSAEWOULDBLOCK. The udp code will handle the windows error code and convert it to AVERROR(EAGAIN). This issue just can be reproduced on windows. If sleep a interval and retry to send pkt when hit EAGAIN, it will increase latency, and appropriate interval is hard to define. So this patch just remind user increase the buffer size via -buffer_size to avoid this issue. Signed-off-by: Jack Lau --- libavformat/whip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/whip.c b/libavformat/whip.c index e4386016a9..887df5ad41 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -1877,8 +1877,10 @@ write_packet: if (ret == AVERROR(EINVAL)) { av_log(whip, AV_LOG_WARNING, "Ignore failed to write packet=%dB, ret=%d\n", pkt->size, ret); ret = 0; + } else if (ret == AVERROR(EAGAIN)) { + av_log(whip, AV_LOG_ERROR, "UDP send blocked, please increase the buffer via -buffer_size\n"); } else - av_log(whip, AV_LOG_ERROR, "Failed to write packet, size=%d\n", pkt->size); + av_log(whip, AV_LOG_ERROR, "Failed to write packet, size=%d, ret=%d\n", pkt->size, ret); goto end; } -- 2.49.1 >>From a9690e6522287faa5a9697d506eec06703507ad4 Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Mon, 22 Sep 2025 16:48:12 +0800 Subject: [PATCH 3/3] doc/muxers: correct default pkt_size value of whip Signed-off-by: Jack Lau --- doc/muxers.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index f4caa4d7cb..6ad7dad554 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -3953,7 +3953,7 @@ Default value is 5000. @item pkt_size @var{integer} Set the maximum size, in bytes, of RTP packets that send out. -Default value is 1500. +Default value is 1200. @item buffer_size @var{integer} Set the buffer size, in bytes, of underlying protocol. -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org