From patchwork Wed Jan 15 16:54:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Delannoy X-Patchwork-Id: 17373 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 597F944BD0B for ; Wed, 15 Jan 2020 18:54:51 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 384A068AC26; Wed, 15 Jan 2020 18:54:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 53BA468AAA5 for ; Wed, 15 Jan 2020 18:54:45 +0200 (EET) Received: by mail-wm1-f66.google.com with SMTP id u2so671855wmc.3 for ; Wed, 15 Jan 2020 08:54:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d6AtdErvBQqtMzmdY9EXmFdxOBoaAthdfffWAKys8w4=; b=hMspilK/A7savz7q2qMUr0CflZyEgTXSsNGQYMWVZ6DnLIm94mhe0QmiEexbLErAZT ltQPJ8AWSyAW9+ItxY96ZHQVDYDcterMMVkPaR3LTF98c1Gp6SokSqFi62MOL+btZwre zCw+q/+7EpK2DsQRlMEBnkptNbVFGpvP/98b6esl5+EEHyzE2mmJEg+qAIEXRBSTCMn2 /EZ/qNNSpNiAfRZm7r2EvOJt9ObeP17zLd7eZK/CZwbQ+6r3rTUaGd4T3itU+orBmTM8 JPu6xGFaTCUJHszme2njyYYaP4ePdjsKZLFPeCOoOHILjS5SkCUg6B8NgS4pr3ekrGWx 08wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d6AtdErvBQqtMzmdY9EXmFdxOBoaAthdfffWAKys8w4=; b=ind8mO9CN9Vg38bSN5C/aGF+SZnwuavcPrEVuRzyK9qu3wC/ZmypvU60kJ697SeWOJ rBhG7fnW6+uBVzdksWVICEQGDh3SBG++iCRur2gtKGEzupR7h1ujc0CmC+fCBFauE9Ss 27sbGhioL7ZGMGE13NCNmN0owm3qhP/oFAwsIVdfVUZ8wJuZvU5+yyNfx3p/MJloIk++ iqPTf04PYg2eS5i3yfb6dlBxHRFz6BHe1DZQC9/75rC/OQbjHxB0aUeficrCowoqZ46A po/IuMWEMYFhyMPuxS91rEuxbf9bGFACFpO72UYeJvLxuRtyq7KzlOqGlCdC8KlA/PUC King== X-Gm-Message-State: APjAAAUWBZHvQh06ssaH8aIGw3ORziJZx/J4NShmRVIqYbwINJ5ZPjES 9w0uO3oeKOXzUPa9Qok2NwX51H7dioY= X-Google-Smtp-Source: APXvYqyZA+p3cgFxFRb8RTiIwQz9SAE8JrycxcVQPjkn4MwCEmYNCZP76gljMB/CeQ7uu6AmFjPhRw== X-Received: by 2002:a1c:96c4:: with SMTP id y187mr861048wmd.112.1579107283931; Wed, 15 Jan 2020 08:54:43 -0800 (PST) Received: from tvty-lt-28.localdomain (host.251.54.23.62.rev.coltfrance.com. [62.23.54.251]) by smtp.gmail.com with ESMTPSA id m3sm24469446wrs.53.2020.01.15.08.54.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jan 2020 08:54:43 -0800 (PST) Received: by tvty-lt-28.localdomain (Postfix, from userid 1001) id E294AB6000A; Wed, 15 Jan 2020 17:54:42 +0100 (CET) From: Anthony Delannoy To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Jan 2020 17:54:34 +0100 Message-Id: <20200115165434.14282-1-anthony.2lannoy@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavf/libsrt: nonblock enabling correction 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: Anthony Delannoy Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" As written in https://github.com/Haivision/srt/blob/v1.4.1/docs/API.md, the nonblock mode is activated if SRTO_SNDSYN and SRTO_RCVSYN, for sending and receiving respectively, are set to 0. --- libavformat/libsrt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index 16975b6d94..60b1dd8e9c 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -152,12 +152,12 @@ static int libsrt_neterrno(URLContext *h) return AVERROR_UNKNOWN; } -static int libsrt_socket_nonblock(int socket, int enable) +static int libsrt_socket_nonblock(int socket, int disable) { - int ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &enable, sizeof(enable)); + int ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &disable, sizeof(disable)); if (ret < 0) return ret; - return srt_setsockopt(socket, 0, SRTO_RCVSYN, &enable, sizeof(enable)); + return srt_setsockopt(socket, 0, SRTO_RCVSYN, &disable, sizeof(disable)); } static int libsrt_network_wait_fd(URLContext *h, int eid, int fd, int write) @@ -235,7 +235,7 @@ static int libsrt_listen(int eid, int fd, const struct sockaddr *addr, socklen_t ret = srt_accept(fd, NULL, NULL); if (ret < 0) return libsrt_neterrno(h); - if (libsrt_socket_nonblock(ret, 1) < 0) + if (libsrt_socket_nonblock(ret, 0) < 0) av_log(h, AV_LOG_DEBUG, "libsrt_socket_nonblock failed\n"); return ret; @@ -245,7 +245,7 @@ static int libsrt_listen_connect(int eid, int fd, const struct sockaddr *addr, s { int ret; - if (libsrt_socket_nonblock(fd, 1) < 0) + if (libsrt_socket_nonblock(fd, 0) < 0) av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n"); while ((ret = srt_connect(fd, addr, addrlen))) {