[FFmpeg-devel] [PATCH] lavf/libsrt: nonblock enabling correction

Anthony Delannoy anthony.2lannoy at gmail.com
Wed Jan 15 18:54:34 EET 2020


As written in https://github.com/Haivision/srt/blob/v1.4.1/docs/API.md,
the nonblock mode is activated if SRTO_SNDSYN and SRTO_RCVSYN, for
sending and receiving respectively, are set to 0.
---
 libavformat/libsrt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 16975b6d94..60b1dd8e9c 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -152,12 +152,12 @@ static int libsrt_neterrno(URLContext *h)
     return AVERROR_UNKNOWN;
 }
 
-static int libsrt_socket_nonblock(int socket, int enable)
+static int libsrt_socket_nonblock(int socket, int disable)
 {
-    int ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &enable, sizeof(enable));
+    int ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &disable, sizeof(disable));
     if (ret < 0)
         return ret;
-    return srt_setsockopt(socket, 0, SRTO_RCVSYN, &enable, sizeof(enable));
+    return srt_setsockopt(socket, 0, SRTO_RCVSYN, &disable, sizeof(disable));
 }
 
 static int libsrt_network_wait_fd(URLContext *h, int eid, int fd, int write)
@@ -235,7 +235,7 @@ static int libsrt_listen(int eid, int fd, const struct sockaddr *addr, socklen_t
     ret = srt_accept(fd, NULL, NULL);
     if (ret < 0)
         return libsrt_neterrno(h);
-    if (libsrt_socket_nonblock(ret, 1) < 0)
+    if (libsrt_socket_nonblock(ret, 0) < 0)
         av_log(h, AV_LOG_DEBUG, "libsrt_socket_nonblock failed\n");
 
     return ret;
@@ -245,7 +245,7 @@ static int libsrt_listen_connect(int eid, int fd, const struct sockaddr *addr, s
 {
     int ret;
 
-    if (libsrt_socket_nonblock(fd, 1) < 0)
+    if (libsrt_socket_nonblock(fd, 0) < 0)
         av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
 
     while ((ret = srt_connect(fd, addr, addrlen))) {
-- 
2.24.1



More information about the ffmpeg-devel mailing list