aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/tls_openssl.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2025-07-01 18:07:24 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2025-07-11 17:49:57 +0200
commit6af099522e591dd093a344f076da1983e88eb9f8 (patch)
tree12882d505eeb4bcedba1586583cbb0bb981bbe55 /libavformat/tls_openssl.c
parent2604c86c1f8e6a07840054ad51cb26a99d06b640 (diff)
downloadffmpeg-6af099522e591dd093a344f076da1983e88eb9f8.tar.gz
avformat/tls: make passing an external socket universal
Diffstat (limited to 'libavformat/tls_openssl.c')
-rw-r--r--libavformat/tls_openssl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index c126c87af4..2a01fb387d 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -486,10 +486,16 @@ static const char* openssl_get_error(TLSContext *ctx)
return ctx->error_message;
}
-int ff_dtls_set_udp(URLContext *h, URLContext *udp)
+int ff_tls_set_external_socket(URLContext *h, URLContext *sock)
{
TLSContext *c = h->priv_data;
- c->tls_shared.udp = udp;
+ TLSShared *s = &c->tls_shared;
+
+ if (s->is_dtls)
+ c->tls_shared.udp = sock;
+ else
+ c->tls_shared.tcp = sock;
+
return 0;
}
@@ -829,7 +835,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
if (ret < 0)
goto fail;
- if (p->tls_shared.use_external_udp != 1) {
+ if (p->tls_shared.external_sock != 1) {
if ((ret = ff_tls_open_underlying(&p->tls_shared, h, url, options)) < 0) {
av_log(p, AV_LOG_ERROR, "Failed to connect %s\n", url);
return ret;
@@ -850,7 +856,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
*
* The SSL_do_handshake can't be called if DTLS hasn't prepare for udp.
*/
- if (p->tls_shared.use_external_udp != 1) {
+ if (p->tls_shared.external_sock != 1) {
ret = dtls_handshake(h);
// Fatal SSL error, for example, no available suite when peer is DTLS 1.0 while we are DTLS 1.2.
if (ret < 0) {