avformat/libsrt: fix or simplify some function return values

Sometimes there was a confusion between srt_*() function return values and
libavformat-style return values.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2021-01-31 00:25:14 +01:00
parent d4e4ffd348
commit 5cf01ed5cd

View File

@ -219,12 +219,10 @@ static int libsrt_listen(int eid, int fd, const struct sockaddr *addr, socklen_t
if (srt_setsockopt(fd, SOL_SOCKET, SRTO_REUSEADDR, &reuse, sizeof(reuse))) {
av_log(h, AV_LOG_WARNING, "setsockopt(SRTO_REUSEADDR) failed\n");
}
ret = srt_bind(fd, addr, addrlen);
if (ret)
if (srt_bind(fd, addr, addrlen))
return libsrt_neterrno(h);
ret = srt_listen(fd, 1);
if (ret)
if (srt_listen(fd, 1))
return libsrt_neterrno(h);
ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback);
@ -244,8 +242,7 @@ static int libsrt_listen_connect(int eid, int fd, const struct sockaddr *addr, s
{
int ret;
ret = srt_connect(fd, addr, addrlen);
if (ret < 0)
if (srt_connect(fd, addr, addrlen) < 0)
return libsrt_neterrno(h);
ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback);
@ -443,10 +440,11 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
fd = ret;
} else {
if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
if (ret)
if (srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) {
ret = libsrt_neterrno(h);
goto fail1;
}
}
if ((ret = libsrt_listen_connect(s->eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
open_timeout, h, !!cur_ai->ai_next)) < 0) {