diff options
author | Marton Balint <cus@passwd.hu> | 2020-02-14 23:32:14 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-02-24 00:02:45 +0100 |
commit | 86a7b77b60488758e0c080882899c32c4a5ee017 (patch) | |
tree | 5fbfc72b1e27e6cb0bb2b041f2be43f15046ae41 /libavformat | |
parent | c112fae6603f8be33cf1ee2ae390ec939812f473 (diff) | |
download | ffmpeg-86a7b77b60488758e0c080882899c32c4a5ee017.tar.gz |
avformat/libsrt: small fixes in libsrt_neterrno()
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>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/libsrt.c | 9 |
1 files changed, 5 insertions, 4 deletions
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) |