From: Jack Lau <jacklau1222gm@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v5 12/15] avformat/tls_openssl: directly use mtu in TLSShared Date: Wed, 23 Jul 2025 21:42:55 +0800 Message-ID: <954CC9B2-F090-4147-99BA-B6EB9A38C79E@gmail.com> (raw) In-Reply-To: <fb22b08c-200a-47ff-b3c3-b13d67733b56@rothenpieler.org> > On Jul 22, 2025, at 20:43, Timo Rothenpieler <timo@rothenpieler.org> wrote: > > On 22/07/2025 14:36, Jack Lau wrote: >> Openssl 1.1.0 version haven't DTLS_get_data_mtu API >> Signed-off-by: Jack Lau <jacklau1222@qq.com> >> --- >> libavformat/tls_openssl.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c >> index fa852aac18..54860857c0 100644 >> --- a/libavformat/tls_openssl.c >> +++ b/libavformat/tls_openssl.c >> @@ -1013,7 +1013,7 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) >> uc->flags |= h->flags & AVIO_FLAG_NONBLOCK; >> if (c->tls_shared.is_dtls) >> - size = FFMIN(size, DTLS_get_data_mtu(c->ssl)); >> + size = FFMIN(size, c->tls_shared.mtu); > > This is not the same value, no. > DTLS_get_data_mtu returns the mtu minus the size of the DTLS header and footer, i.e. the maximum amount of data it can consume. > Which is exactly what it's used for here. You’re right. I think compute the real overhead(DTLS header + cipher tag) for openssl 1.1.0 version is no necessary, so I use a conservative overhead covers all cases How about this one? diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index d42c5c95cf2c1..255e2f8a2e12c 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -1007,13 +1007,17 @@ 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; - +#if OPENSSL_VERSION_NUMBER >= 0x10101000L // OpenSSL 1.1.1 + int data_mtu = DTLS_get_data_mtu(c->ssl); +#else + int data_mtu = s->mtu - 64; // Conservative overhead covers all cases +#endif // Set or clear the AVIO_FLAG_NONBLOCK on the underlying socket uc->flags &= ~AVIO_FLAG_NONBLOCK; uc->flags |= h->flags & AVIO_FLAG_NONBLOCK; if (s->is_dtls) - size = FFMIN(size, s->mtu); + size = FFMIN(size, data_mtu); ret = SSL_write(c->ssl, buf, size); if (ret > 0) > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-07-23 13:43 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-07-22 12:36 [FFmpeg-devel] [PATCH v5 00/15] avformat/whip: Add NACK, RTX, DTLS active support Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 01/15] avformat/whip: add whip_flags ignore_ipv6 to skip IPv6 ICE candidates Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 02/15] avformat/whip: fix typos Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 03/15] avformat/whip: fix H264 profile_iop bit map for SDP Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 04/15] WHIP: X509 cert serial number should be positive Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 05/15] avformat/whip: implement NACK and RTX suppport Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 06/15] avformat/whip: reindent whip options Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 07/15] avformat/whip: add support for active dtls role Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 08/15] avformat/whip: remove DTLSState enum Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 09/15] avformat/whip: check the peer whether is ice lite Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 10/15] avformat/whip: remove WHIP_STATE_DTLS_CONNECTING Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 11/15] avformat/whip: simplify and modularize the ICE and DTLS Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 12/15] avformat/tls_openssl: directly use mtu in TLSShared Jack Lau 2025-07-22 12:43 ` Timo Rothenpieler 2025-07-23 13:42 ` Jack Lau [this message] 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 13/15] avformat/tls: add new option use_srtp to control whether enable it Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 14/15] avformat/tls_openssl: cleanup the pointer name of TLSContext and TLSShared Jack Lau 2025-07-22 12:36 ` [FFmpeg-devel] [PATCH v5 15/15] doc: add doc for dtls and whip Jack Lau
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=954CC9B2-F090-4147-99BA-B6EB9A38C79E@gmail.com \ --to=jacklau1222gm@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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