diff options
author | Anthony Delannoy <anthony.2lannoy@gmail.com> | 2020-01-16 11:18:35 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-01-19 00:17:11 +0100 |
commit | f8990c5f414d4575415e2a3981c3b142222ca3d4 (patch) | |
tree | ab76e75d52b862124f42736ada6111ead90699a0 /libavformat/libsrt.c | |
parent | 3ffe3b1db0ccb79b4a7ef2ce112e83e6f07aa49e (diff) |
avformat/libsrt: fix enabling nonblocking mode
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.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/libsrt.c')
-rw-r--r-- | libavformat/libsrt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index 16975b6d94..443df5bee8 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -154,10 +154,12 @@ static int libsrt_neterrno(URLContext *h) static int libsrt_socket_nonblock(int socket, int enable) { - int ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &enable, sizeof(enable)); + int ret, blocking = enable ? 0 : 1; + /* Setting SRTO_{SND,RCV}SYN options to 1 enable blocking mode, setting them to 0 enable non-blocking mode. */ + ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &blocking, sizeof(blocking)); if (ret < 0) return ret; - return srt_setsockopt(socket, 0, SRTO_RCVSYN, &enable, sizeof(enable)); + return srt_setsockopt(socket, 0, SRTO_RCVSYN, &blocking, sizeof(blocking)); } static int libsrt_network_wait_fd(URLContext *h, int eid, int fd, int write) |