The branch, master has been updated
via ec0a04de0d46b6104a4d92570b2412df5fafb483 (commit)
via b3793d9941516ea8c3511ca2b7db339148e3f122 (commit)
from 469aad38977e47574f019c8d69715dc7be74f92d (commit)
- Log -----------------------------------------------------------------
commit ec0a04de0d46b6104a4d92570b2412df5fafb483
Author: Jack Lau <[email protected]>
AuthorDate: Wed Sep 17 10:50:18 2025 +0800
Commit: stevenliu <[email protected]>
CommitDate: Thu Oct 9 09:55:18 2025 +0000
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 <[email protected]>
diff --git a/libavformat/whip.c b/libavformat/whip.c
index 6dd786db58..50ca218cbd 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -1945,8 +1945,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;
}
commit b3793d9941516ea8c3511ca2b7db339148e3f122
Author: Jack Lau <[email protected]>
AuthorDate: Wed Sep 17 10:25:41 2025 +0800
Commit: stevenliu <[email protected]>
CommitDate: Thu Oct 9 09:55:18 2025 +0000
avformat/whip: pass through buffer_size option to udp
Signed-off-by: Jack Lau <[email protected]>
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 8c45b7d47a..18c99e57b6 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -3955,6 +3955,10 @@ 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.
+Default value is -1(auto). The UDP auto selects a reasonable value.
+
@item authorization @var{string}
The optional Bearer token for WHIP Authorization.
diff --git a/libavformat/whip.c b/libavformat/whip.c
index dff2502afd..6dd786db58 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -325,6 +325,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
@@ -1221,8 +1222,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);
@@ -2023,6 +2025,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 },
-----------------------------------------------------------------------
Summary of changes:
doc/muxers.texi | 4 ++++
libavformat/whip.c | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]