avformat/whip: pass through buffer_size option to udp

Signed-off-by: Jack Lau <jacklau1222@qq.com>
(cherry picked from commit b3793d9941)
This commit is contained in:
Jack Lau
2025-09-17 10:25:41 +08:00
committed by Jack Lau
parent 2096bb7466
commit 185d07ede1
2 changed files with 8 additions and 1 deletions

View File

@@ -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.

View File

@@ -295,6 +295,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
@@ -1195,8 +1196,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);
@@ -1898,6 +1900,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 },