]> git.sesse.net Git - ffmpeg/commitdiff
avformat/libsrt: small fixes in libsrt_neterrno()
authorMarton Balint <cus@passwd.hu>
Fri, 14 Feb 2020 22:32:14 +0000 (23:32 +0100)
committerMarton Balint <cus@passwd.hu>
Sun, 23 Feb 2020 23:02:45 +0000 (00:02 +0100)
Return os error code if available, check for both SRT_EASYNCRCV and
SRT_EASYNCSND when transforming them to EAGAIN and only display error if it is
not EAGAIN.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/libsrt.c

index 38d047ca88d12c6bc67ee3df29c816054c81778a..c3c96b35e0e75a0594ed12d61ed8b48f27989a3c 100644 (file)
@@ -145,11 +145,12 @@ static const AVOption libsrt_options[] = {
 
 static int libsrt_neterrno(URLContext *h)
 {
-    int err = srt_getlasterror(NULL);
-    av_log(h, AV_LOG_ERROR, "%s\n", srt_getlasterror_str());
-    if (err == SRT_EASYNCRCV)
+    int os_errno;
+    int err = srt_getlasterror(&os_errno);
+    if (err == SRT_EASYNCRCV || err == SRT_EASYNCSND)
         return AVERROR(EAGAIN);
-    return AVERROR_UNKNOWN;
+    av_log(h, AV_LOG_ERROR, "%s\n", srt_getlasterror_str());
+    return os_errno ? AVERROR(os_errno) : AVERROR_UNKNOWN;
 }
 
 static int libsrt_socket_nonblock(int socket, int enable)