[FFmpeg-devel] [PATCH 04/14] avformat/tls_openssl: initialize DTLS context with correct method

Timo Rothenpieler timo at rothenpieler.org
Sun Jul 13 22:24:38 EEST 2025


---
 libavformat/tls_openssl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 81b2f066c9..f116b5eac6 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -786,7 +786,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
     /* Refer to the test cases regarding these curves in the WebRTC code. */
     const char* curves = "X25519:P-256:P-384:P-521";
 
-    p->ctx = SSL_CTX_new(DTLS_method());
+    p->ctx = SSL_CTX_new(c->listen ? DTLS_server_method() : DTLS_client_method());
     if (!p->ctx) {
         ret = AVERROR(ENOMEM);
         goto fail;
@@ -810,6 +810,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
         ret = AVERROR(EINVAL);
         return ret;
     }
+
     ret = openssl_init_ca_key_cert(h);
     if (ret < 0) goto fail;
 
-- 
2.49.0



More information about the ffmpeg-devel mailing list