[FFmpeg-devel] [PATCH 2/3] avformat/libsrt: fix or simplify some function return values
Marton Balint
cus at passwd.hu
Sun Jan 31 20:32:18 EET 2021
Sometimes there was a confusion between srt_*() function return values and
libavformat-style return values.
Signed-off-by: Marton Balint <cus at passwd.hu>
---
libavformat/libsrt.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 28c06f130e..f10b043c36 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -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,9 +440,10 @@ 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,
--
2.26.2
More information about the ffmpeg-devel
mailing list