PR #23055 opened by RossWang
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23055
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23055.patch

For now it fails on srt://[::]:1234?mode=listener

This fix makes it bind on both v4 and v6 by setting SRTO_IPV6ONLY to 0

Reference
https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#SRTO_IPV6ONLY


>From 98ea063108a5843de846598145d47db377ee1e14 Mon Sep 17 00:00:00 2001
From: RossWang <[email protected]>
Date: Sat, 9 May 2026 07:18:49 +0000
Subject: [PATCH] avformat/libsrt: fix ipv6 wildcard listener

For now it fails on srt://[::]:1234?mode=listener

This fix make it bind on both v4 and v6 by setting SRTO_IPV6ONLY to 0

Reference
https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#SRTO_IPV6ONLY
---
 libavformat/libsrt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 12a7ad6a52..71e02613a3 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -243,6 +243,12 @@ static int libsrt_listen(int eid, int fd, const struct 
sockaddr *addr, socklen_t
     /* Max streamid length plus an extra space for the terminating null 
character */
     char streamid[513];
     int streamid_len = sizeof(streamid);
+#if SRT_VERSION_VALUE >= 0x010400
+    int ipv6only = 0;
+    if (srt_setsockopt(fd, SOL_SOCKET, SRTO_IPV6ONLY, &ipv6only, 
sizeof(ipv6only))) {
+        av_log(h, AV_LOG_WARNING, "setsockopt(SRTO_IPV6ONLY) failed\n");
+    }
+#endif
     if (srt_setsockopt(fd, SOL_SOCKET, SRTO_REUSEADDR, &reuse, sizeof(reuse))) 
{
         av_log(h, AV_LOG_WARNING, "setsockopt(SRTO_REUSEADDR) failed\n");
     }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to