diff mbox series

[FFmpeg-devel,v2,5/9] avformat/libsrt: small fixes in libsrt_neterrno()

Message ID 20200217003653.20027-5-cus@passwd.hu
State Accepted
Headers show
Series [FFmpeg-devel,v2,1/9] avformat/libsrt: fix timeout unit confusion between milisec and microsec
Related show


Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Marton Balint Feb. 17, 2020, 12:36 a.m. UTC
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

Signed-off-by: Marton Balint <cus@passwd.hu>
 libavformat/libsrt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series


diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 38d047ca88..c3c96b35e0 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -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)