From patchwork Mon Feb 17 00:36:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17811 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1E83644AC15 for ; Mon, 17 Feb 2020 02:37:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 03649689E33; Mon, 17 Feb 2020 02:37:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B4F0F689DC8 for ; Mon, 17 Feb 2020 02:37:26 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 85D7EE36B4; Mon, 17 Feb 2020 01:37:26 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 60u8oY-Y2RWw; Mon, 17 Feb 2020 01:37:25 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 24127E39F2; Mon, 17 Feb 2020 01:37:25 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Feb 2020 01:36:49 +0100 Message-Id: <20200217003653.20027-5-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200217003653.20027-1-cus@passwd.hu> References: <20200213231624.28373-1-cus@passwd.hu> <20200217003653.20027-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH v2 5/9] avformat/libsrt: small fixes in libsrt_neterrno() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --- libavformat/libsrt.c | 9 +++++---- 1 file 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)