[FFmpeg-devel] [PATCH 08/18] avformat/tls: move openssl specific init out of generic code

Timo Rothenpieler timo at rothenpieler.org
Wed Jul 2 19:56:36 EEST 2025


---
 libavformat/tls.c         | 9 ---------
 libavformat/tls_openssl.c | 3 +++
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index 5ec4cca58a..f888970969 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -135,15 +135,6 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV
     ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf, AVIO_FLAG_READ_WRITE,
                                &parent->interrupt_callback, options,
                                parent->protocol_whitelist, parent->protocol_blacklist, parent);
-    if (c->is_dtls) {
-        if (ret < 0) {
-            av_log(c, AV_LOG_ERROR, "Failed to open udp://%s:%d\n", c->underlying_host, port);
-            return ret;
-        }
-        /* Make the socket non-blocking, set to READ and WRITE mode after connected */
-        ff_socket_nonblock(ffurl_get_file_handle(c->udp), 1);
-        c->udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_NONBLOCK;
-    }
     return ret;
 }
 
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 2a3905891d..d83fe602d5 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -985,6 +985,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
             av_log(p, AV_LOG_ERROR, "Failed to connect %s\n", url);
             return ret;
         }
+        /* Make the socket non-blocking, set to READ and WRITE mode after connected */
+        ff_socket_nonblock(ffurl_get_file_handle(p->tls_shared.udp), 1);
+        p->tls_shared.udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_NONBLOCK;
     }
 
     /* Setup DTLS as passive, which is server role. */
-- 
2.49.0



More information about the ffmpeg-devel mailing list