From patchwork Sat Mar 10 19:37:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 7893 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp33306jaj; Sat, 10 Mar 2018 11:37:32 -0800 (PST) X-Google-Smtp-Source: AG47ELt0OnWYWHuwPT0jALae6BTjhYRQd/NixJIbSLIUAGH3NDg6j5djbIfphEirEy3V0q7Jltah X-Received: by 10.223.129.203 with SMTP id 69mr2330432wra.45.1520710652574; Sat, 10 Mar 2018 11:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520710652; cv=none; d=google.com; s=arc-20160816; b=Ez/10y+WDHGCN3dE6f1XSUkW3M7idS/OMvQ2b/f9W5IGnRp6jhkRz7cL/dD+wNDsIU fPa4DmtKefhnk26t+Qcdp91I10pPiPgQaneWxnwPMC1GBnzST0wTb+6NeQwCZU0PTBrE hTewMtTujmTNqvnV8rxsltMwH8ycY6v8aYGnIAoBW8FmMFNhRgUI3oz448gG2d7cSyR4 BBmZpKLqhv4R+hs1CE6a4p2jvnrYBqsreBhrKSuYSMLO8PlGusxfwBg0IsjsDcvPk4uZ jLMC+KuQ9CGCFeDT866VdTdEQqkIxThCFLawj0OdO6Z+jUJQmxAnWfRX3w60GoTzy7GO mSnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=jR3bxj2pCvfU+V4EH8Mjg+3K3JUhKqFtktC98+6mA0g=; b=znWkEDA0icGfZpkb8L775fFdgBf71sADCC7swlimwCqbGkHf1+OxFtFDjqotJkfNWs 281YxTSvhyZhNxMI021L2reQOLc+tf2jO85yHWK4lNl5KWoD+u/ekLJN3fcMWZ5vSbRB zdrFMAT3x3wSnP52YPENRla8UwOBh1QYIWcYsrD57kzla/HOArnlp3CKrogLVfypNdzl uSFK2foVsvQnsCNj+noghCsEorU6XFl+r8Ujr7QY/gUyf9aydbxXXxo2lOvfDNdqddch YVqKKyil2T1sAYD+h0/s+R/eP+2lEIdlX8J3gHyMECQaFTz8JJ7RioJ69n2itr/gebZO xGBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x18si982021wmc.57.2018.03.10.11.37.31; Sat, 10 Mar 2018 11:37:32 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43B1C68A31A; Sat, 10 Mar 2018 21:37:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 35DCF68A2AD for ; Sat, 10 Mar 2018 21:37:13 +0200 (EET) X-ENS-nef-client: 129.199.129.80 Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id w2AJbMpc047909 for ; Sat, 10 Mar 2018 20:37:22 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 156FEE00AB; Sat, 10 Mar 2018 20:37:22 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Mar 2018 20:37:20 +0100 Message-Id: <20180310193720.12708-1-george@nsup.org> X-Mailer: git-send-email 2.16.1 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Sat, 10 Mar 2018 20:37:22 +0100 (CET) Subject: [FFmpeg-devel] [PATCH] lavf/rtsp: fix the type of the timeout option. 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" A timeout is a duration of time, therefore the correct type for it is AV_OPT_TYPE_DURATION. It has the benefit of offering a better user interface, with units specification. Unfortunately, ff46124b0df17a1d35249e09ae8eae9a61f16e04 was pushed before that mistake could be corrected. Signed-off-by: Nicolas George --- libavformat/rtsp.c | 5 +++-- libavformat/rtsp.h | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index ceb770a3a4..1fbdcfcedd 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -98,7 +98,7 @@ const AVOption ff_rtsp_options[] = { { "timeout", "set maximum timeout (in seconds) to wait for incoming connections (-1 is infinite, imply flag listen) (deprecated, use listen_timeout)", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC }, { "stimeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, #else - { "timeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, + { "timeout", "set timeout of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, DEC }, #endif COMMON_OPTS(), { "user_agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, @@ -1818,7 +1818,8 @@ redirect: /* open the tcp connection */ ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, host, port, - "?timeout=%d", rt->stimeout); + /* cast necessary until FF_API_OLD_RTSP_OPTIONS removed */ + "?timeout=%"PRId64, (int64_t)rt->stimeout); if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL, s->protocol_whitelist, s->protocol_blacklist, NULL)) < 0) { err = ret; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 9a7f366b39..1524962e1b 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -395,7 +395,11 @@ typedef struct RTSPState { /** * timeout of socket i/o operations. */ +#if FF_API_OLD_RTSP_OPTIONS int stimeout; +#else + int64_t stimeout; +#endif /** * Size of RTP packet reordering queue.