* [FFmpeg-devel] [PR] avformat/tls_gnutls: limit the wirtten size to data mtu (PR #21696)
@ 2026-02-09 9:07 Jack Lau via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Jack Lau via ffmpeg-devel @ 2026-02-09 9:07 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Jack Lau
PR #21696 opened by Jack Lau (JackLau)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21696
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21696.patch
>From df9ab587cefe41752a5d056f7ea555a662fd659b Mon Sep 17 00:00:00 2001
From: Jack Lau <jacklau1222gm@gmail.com>
Date: Mon, 9 Feb 2026 16:57:27 +0800
Subject: [PATCH 1/2] avformat/tls_gnutls: limit the wirtten size to data mtu
Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
---
libavformat/tls_gnutls.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index d0358c162c..957831081e 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -709,6 +709,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
// Set or clear the AVIO_FLAG_NONBLOCK on c->tls_shared.tcp
uc->flags &= ~AVIO_FLAG_NONBLOCK;
uc->flags |= h->flags & AVIO_FLAG_NONBLOCK;
+
+ if (s->is_dtls) {
+ const size_t mtu_size = gnutls_dtls_get_data_mtu(c->session);
+ size = FFMIN(size, mtu_size);
+ }
+
ret = gnutls_record_send(c->session, buf, size);
if (ret > 0)
return ret;
--
2.52.0
>From f43cbb95d8fe12084a4d7a7ed1efd0708563a4ca Mon Sep 17 00:00:00 2001
From: Jack Lau <jacklau1222gm@gmail.com>
Date: Mon, 9 Feb 2026 17:01:20 +0800
Subject: [PATCH 2/2] avformat/tls_gnutls: update the comment since the
underlying socket can be tcp or udp
Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
---
libavformat/tls_gnutls.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 957831081e..778ca9cf40 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -689,7 +689,7 @@ static int tls_read(URLContext *h, uint8_t *buf, int size)
TLSShared *s = &c->tls_shared;
URLContext *uc = s->is_dtls ? s->udp : s->tcp;
int ret;
- // Set or clear the AVIO_FLAG_NONBLOCK on c->tls_shared.tcp
+ // Set or clear the AVIO_FLAG_NONBLOCK on the underlying socket
uc->flags &= ~AVIO_FLAG_NONBLOCK;
uc->flags |= h->flags & AVIO_FLAG_NONBLOCK;
ret = gnutls_record_recv(c->session, buf, size);
@@ -706,7 +706,7 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
TLSShared *s = &c->tls_shared;
URLContext *uc = s->is_dtls ? s->udp : s->tcp;
int ret;
- // Set or clear the AVIO_FLAG_NONBLOCK on c->tls_shared.tcp
+ // Set or clear the AVIO_FLAG_NONBLOCK on the underlying socket
uc->flags &= ~AVIO_FLAG_NONBLOCK;
uc->flags |= h->flags & AVIO_FLAG_NONBLOCK;
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-09 9:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-09 9:07 [FFmpeg-devel] [PR] avformat/tls_gnutls: limit the wirtten size to data mtu (PR #21696) Jack Lau via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git