Browse Source

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>
tags/n4.3
Marton Balint 6 years ago
parent
commit
86a7b77b60
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      libavformat/libsrt.c

+ 5
- 4
libavformat/libsrt.c View 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)


Loading…
Cancel
Save