From patchwork Mon Feb 17 00:36:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17810 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 E487A44AC15 for ; Mon, 17 Feb 2020 02:37:30 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D0D93689C96; Mon, 17 Feb 2020 02:37:30 +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 CDB6D689C6C for ; Mon, 17 Feb 2020 02:37:24 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B6039E3A16; Mon, 17 Feb 2020 01:37:24 +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 00MKFqQ6UxvP; Mon, 17 Feb 2020 01:37:23 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 512F3E3A04; Mon, 17 Feb 2020 01:37:23 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Feb 2020 01:36:48 +0100 Message-Id: <20200217003653.20027-4-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 4/9] avformat/libsrt: poll for error conditions as well 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" Signed-off-by: Marton Balint --- libavformat/libsrt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index 1ab6c1ddb3..38d047ca88 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -164,16 +164,17 @@ static int libsrt_socket_nonblock(int socket, int enable) static int libsrt_network_wait_fd(URLContext *h, int eid, int fd, int write) { - int ret, len = 1; - int modes = write ? SRT_EPOLL_OUT : SRT_EPOLL_IN; + int ret, len = 1, errlen = 1; + int modes = SRT_EPOLL_ERR | (write ? SRT_EPOLL_OUT : SRT_EPOLL_IN); SRTSOCKET ready[1]; + SRTSOCKET error[1]; if (srt_epoll_add_usock(eid, fd, &modes) < 0) return libsrt_neterrno(h); if (write) { - ret = srt_epoll_wait(eid, 0, 0, ready, &len, POLLING_TIME, 0, 0, 0, 0); + ret = srt_epoll_wait(eid, error, &errlen, ready, &len, POLLING_TIME, 0, 0, 0, 0); } else { - ret = srt_epoll_wait(eid, ready, &len, 0, 0, POLLING_TIME, 0, 0, 0, 0); + ret = srt_epoll_wait(eid, ready, &len, error, &errlen, POLLING_TIME, 0, 0, 0, 0); } if (ret < 0) { if (srt_getlasterror(NULL) == SRT_ETIMEOUT) @@ -181,7 +182,7 @@ static int libsrt_network_wait_fd(URLContext *h, int eid, int fd, int write) else ret = libsrt_neterrno(h); } else { - ret = 0; + ret = errlen ? AVERROR(EIO) : 0; } if (srt_epoll_remove_usock(eid, fd) < 0) return libsrt_neterrno(h);