[FFmpeg-cvslog] avformat/tls_openssl: initialize DTLS context with correct method

Timo Rothenpieler git at videolan.org
Wed Jul 16 20:07:12 EEST 2025


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sat Jul 12 22:08:24 2025 +0200| [b6e808d28b784422aee5868583ee6c5239fab3d3] | committer: Timo Rothenpieler

avformat/tls_openssl: initialize DTLS context with correct method

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6e808d28b784422aee5868583ee6c5239fab3d3
---

 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;
 



More information about the ffmpeg-cvslog mailing list