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))) { if (srt_setsockopt(fd, SOL_SOCKET, SRTO_REUSEADDR, &reuse, sizeof(reuse))) {
av_log(h, AV_LOG_WARNING, "setsockopt(SRTO_REUSEADDR) failed\n"); av_log(h, AV_LOG_WARNING, "setsockopt(SRTO_REUSEADDR) failed\n");
} }
ret = srt_bind(fd, addr, addrlen); if (srt_bind(fd, addr, addrlen))
if (ret)
return libsrt_neterrno(h); return libsrt_neterrno(h);
ret = srt_listen(fd, 1); if (srt_listen(fd, 1))
if (ret)
return libsrt_neterrno(h); return libsrt_neterrno(h);
ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback); 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; int ret;
ret = srt_connect(fd, addr, addrlen); if (srt_connect(fd, addr, addrlen) < 0)
if (ret < 0)
return libsrt_neterrno(h); return libsrt_neterrno(h);
ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback); ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback);
@ -443,9 +440,10 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
fd = ret; fd = ret;
} else { } else {
if (s->mode == SRT_MODE_RENDEZVOUS) { if (s->mode == SRT_MODE_RENDEZVOUS) {
ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen); if (srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) {
if (ret) ret = libsrt_neterrno(h);
goto fail1; goto fail1;
}
} }
if ((ret = libsrt_listen_connect(s->eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, if ((ret = libsrt_listen_connect(s->eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen,