From patchwork Sun Nov 15 18:20:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 23653 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 EA98C44AEA4 for ; Sun, 15 Nov 2020 20:46:45 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE96E689F22; Sun, 15 Nov 2020 20:46:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0452968020A for ; Sun, 15 Nov 2020 20:46:40 +0200 (EET) Received: by mail-qt1-f178.google.com with SMTP id 7so11161486qtp.1 for ; Sun, 15 Nov 2020 10:46:39 -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=KRfGDJMlF68U9xCEReVYrEkKBrgljIINJztQcePQLsE=; b=Admx0BHXsC2WvSh26RhBm1A2SU2u2A3KSrguCtAm063UgzMVhHT3p9Yu1HKR1kLGTr XGDzxtn5xhrsBUeMnwF1dI0P3il9uUtmxR8C0TFAeWd6POQxw5RL4pnqklEhTOt/kLYm o63mw6EMoeMqF3QyynNd3+i/wi/ftp+nU7EMNiu80tMvgOdwbC8D3zmkPiYSZ8EjHV1l t4akadSTFuCSSF3thL45P5W4DFLKiYEdy0M8d1mfP4gaYpqiNbQPMnZJZyL8TUz6pOoY KLXAMgTFRrcPq7vQAzRsC8FQUKQRZ5bFkEe22Zx4/jBM0bVfqKkuzOv47hke1lvJRCbD vjpg== 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=KRfGDJMlF68U9xCEReVYrEkKBrgljIINJztQcePQLsE=; b=HVeIHXoRFJjbnOZG5kv0d0h/IJ3KpfFzZGz9KMO94jmjCR/tCw4RaOhPkMvUM8/4YC 85JCeRoofotGGbV6hfy7QYTov+1O/xK0/n7qf0KtLtGyfiiRLjYCPMmpoK29h4xGnGPw oHG+BaeseoxT/41R/9OtOZjLSF5ubfN/o09uQAmuBodxFFgJ5A3QNdxEN+0ELfz/U5Q+ 2MeNy5ZW3o36cV/ozjqJMIvypGZSQZAWkW2Blw3k74+16gRcJI4Jf4mpEHn6V3b6sOt5 JjQsyv0dEOwqkV2sQpq18F/u5e0/BSgl4Tq9cHN9NuSXKn3Pn30EL6SO2oNvZCwetWzJ ubyA== X-Gm-Message-State: AOAM530WPm7vhY35AiILjElVW5Tj/k08Xv/27ugLDYHsgw5+SU+grZhs L1y3lN/yXfKF2J4n2eIlKinqmNQYWBM= X-Google-Smtp-Source: ABdhPJxfpoPgGSNkKL0jagV5qonKK/l1aitZBBJNc0/PtxTFFkfBN7imChY7OtP/FL+ElAAvuxpnyw== X-Received: by 2002:ac8:1401:: with SMTP id k1mr11227970qtj.227.1605464417337; Sun, 15 Nov 2020 10:20:17 -0800 (PST) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id g19sm9305178qkl.86.2020.11.15.10.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 10:20:16 -0800 (PST) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Nov 2020 13:20:02 -0500 Message-Id: <20201115182005.24702-1-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] avformat/rtsp: set AV_OPT_FLAG_DEPRECATED on depracated options 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: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d9832bbf1f..2ef75f50e3 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -94,7 +94,7 @@ const AVOption ff_rtsp_options[] = { { "max_port", "set maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC }, { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections (-1 is infinite, imply flag listen)", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC }, #if FF_API_OLD_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 }, + { "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|AV_OPT_FLAG_DEPRECATED }, { "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 }, @@ -102,7 +102,7 @@ const AVOption ff_rtsp_options[] = { COMMON_OPTS(), { "user_agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, #if FF_API_OLD_RTSP_OPTIONS - { "user-agent", "override User-Agent header (deprecated, use user_agent)", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC }, + { "user-agent", "override User-Agent header (deprecated, use user_agent)", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC|AV_OPT_FLAG_DEPRECATED }, #endif { NULL }, }; From patchwork Sun Nov 15 18:20:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 23650 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 6EA62443D1A for ; Sun, 15 Nov 2020 20:27:11 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4869C68B7BB; Sun, 15 Nov 2020 20:27:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2613568B503 for ; Sun, 15 Nov 2020 20:27:04 +0200 (EET) Received: by mail-qk1-f194.google.com with SMTP id o66so1186722qkd.4 for ; Sun, 15 Nov 2020 10:27:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=TCpuWVcv3uaRLIgZKbbpfFNbZUUF1PBBEJtgnVI4/SY=; b=L2w9HKgxiBFNGSNcQUQs/faG7zZbAWanmHGdSjCpmEZl+TVLk5LYyiFi35tRdqZcXo C1R2St2wSoLOXeO56TLo2v/ohofztlOwhPUoYEU9Qs10FHNsNxXQBj7JLmhnBqfNG59a wzDwkzz69Fg7cSFQqLX1OZnexlDDfX5ORXWNrJcQwPXczZ21drwBP338w/couJ1J9pay GEW5+jzRFnsz0TCtWAFvwgWj/rxx/yjGAL0wtJw82a/q8N4ROoIKdSXppKGiYzGELR0B 6fUcMJRZk973SfV2063eEizpfi1Sx3P4TYvDxK369imZD90bErkYLEisKKDoKzhPUKFW 8ROQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=TCpuWVcv3uaRLIgZKbbpfFNbZUUF1PBBEJtgnVI4/SY=; b=U7pQw8QU6oeMh0u6DLftKVmsGfaro3NrT5lkJi7myCUo8oHvuU2jwaf3tNspYkiLcF Uki/pB/qHWgniOGAkvJz7q8GJcv154QTCDz+L3rnzh/zKr+vFTS/3mPnmXFIVgRr1Uah mctWHHK8bsOeAM4869A6gSi6utMeecbQpfd45Osp4+uLiMDkelx9tFndFaMMtPTKlrLR RvUmzex/MwyJwmzJQ4LjOwrPnCstC3an/KijBAalCRkOoPXEzRvv+wxHAgGi8kACQpUz rvYB0XGiGUeI/+JUVyHdKdYtd0NKuFD4qdWQaAt8qlj7DJ2uxIAtHYdWGrhQ9gpyq1Vf xgdg== X-Gm-Message-State: AOAM533kiVALkdZZnTrhbjVpmUxAAH78SN5neq+oXElyWn3DmcwZvY81 dNaRpikntXNuwpG+OU7PziT5SFIs3hU= X-Google-Smtp-Source: ABdhPJxfSJVqsT30T28x4oF5YJej4BgRj//9duchIa19Dpy3gb7eCuJXkbkoxgLeNRpGgDMXQwgc2A== X-Received: by 2002:a37:66d4:: with SMTP id a203mr10905422qkc.362.1605464427351; Sun, 15 Nov 2020 10:20:27 -0800 (PST) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id g19sm9305178qkl.86.2020.11.15.10.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 10:20:27 -0800 (PST) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Nov 2020 13:20:03 -0500 Message-Id: <20201115182005.24702-2-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201115182005.24702-1-andriy.gelman@gmail.com> References: <20201115182005.24702-1-andriy.gelman@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] doc/protocols: update options 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: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman Define listen_timeout. Set user-agent and timeout to deprecated. Signed-off-by: Andriy Gelman --- doc/protocols.texi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index b4efa14509..fd866f57a5 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1102,11 +1102,16 @@ Set minimum local UDP port. Default value is 5000. Set maximum local UDP port. Default value is 65000. @item timeout -Set maximum timeout (in seconds) to wait for incoming connections. +This option is deprecated. Use @option{listen_timeout} instead. Set maximum timeout (in seconds) to wait for incoming connections. A value of -1 means infinite (default). This option implies the @option{rtsp_flags} set to @samp{listen}. +@item listen_timeout +Set maximum timeout (in seconds) to establish an initial connection. Setting +@samp{listen_timeout} > 0 sets @option{rtsp_flags} to @samp{listen}. Default is -1 +which means an infinite timeout when @samp{listen} mode is set. + @item reorder_queue_size Set number of packets to buffer for handling of reordered packets. @@ -1114,7 +1119,11 @@ Set number of packets to buffer for handling of reordered packets. Set socket TCP I/O timeout in microseconds. @item user-agent -Override User-Agent header. If not specified, it defaults to the +This option is deprecated. Use @option{user_agent} instead. Override User-Agent header. If not specified, it defaults to the +libavformat identifier string. + +@item user_agent +User-Agent header. If not specified, it defaults to the libavformat identifier string. @end table From patchwork Sun Nov 15 18:20:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 23651 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 9A05844A79E for ; Sun, 15 Nov 2020 20:27:56 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7550A68B682; Sun, 15 Nov 2020 20:27:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E9D2568020A for ; Sun, 15 Nov 2020 20:27:49 +0200 (EET) Received: by mail-qt1-f195.google.com with SMTP id v11so11082535qtq.12 for ; Sun, 15 Nov 2020 10:27:49 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=vLEXUj7s7LP5d4WVRuXYFEn4rV0NUvGO+qTde9e6Oqk=; b=OgkxIhJqEd5oqeLV+nvJGQrKjAGqPQBFxe800hKJhmt4O3AYbQ3VZi6qXbmo1KjuVe 8qRz9OgujoYJXh/5F06SIUIbe+FXlw8YI08G1nVeq2lBPmd6B9AuxK/1Iz8rZJwBOyZF aoG5/BJ/Uasd9bsTEeVYohH99cAM/NSNDxv6DNofOyq7kgRg4twYhdroFu+fM7odhNH8 Us5RTMAzeKssIjRpOg6sWnfPyiRCje/4s+phFdG2iW4gBFnbGwS4b/50KGH6Z03qwJc+ UATslc0DBGOb7+oI+j7WRHLl/A6XJ2XH0sv0QCJ5D7erWynxZB2IHO1O4K59c8yjX2hP wXxA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vLEXUj7s7LP5d4WVRuXYFEn4rV0NUvGO+qTde9e6Oqk=; b=L3I0nt5GsUSB4UBW32lRRjy0ZCmDijz5U9jHcXXC9LD+rKcIBRAv4NCLoF/4eJtRaX 2hwPEmdr6kN77HSBc3mkGMb1vT+I9K71ImavTsuECi8oLODefReTHy7gMyrCsw5KiDPm +BZaIsZAoguBKdiRZhkuXLDphifJZX73apdQ3OyyB6siaO3OZ0M6l/9Lj8Iahp83kIZG zRZ4AxfMWPHG39bzC3i2ZB5Vt/e5+SiGcnOAoiruI2f5aQN93CPu7Ig1sEhjsFQwXTmm /19QjgR7fXDxfwwMqrBU9gW/UgxEDHOtlgJqJs5q8g8YPsd+77DUNq6fFKrciIyKik9p NJYw== X-Gm-Message-State: AOAM531k/HErYpDGdFvzFKYQ2WxGtMJ8iVyOTirJ96fDdVAEe0ekkpvT Le8Q1YEWvM3msBcYDcwisXmTyEc5I1A= X-Google-Smtp-Source: ABdhPJw06ZZhbuorHr6aKaz7NNub7Oehd2kf/1WS1l2nhRxFxWZxoF1+vtsBsNq7lU05kVENaaQQhw== X-Received: by 2002:a05:620a:15b4:: with SMTP id f20mr11273202qkk.486.1605464430837; Sun, 15 Nov 2020 10:20:30 -0800 (PST) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id g19sm9305178qkl.86.2020.11.15.10.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 10:20:30 -0800 (PST) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Nov 2020 13:20:04 -0500 Message-Id: <20201115182005.24702-3-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201115182005.24702-1-andriy.gelman@gmail.com> References: <20201115182005.24702-1-andriy.gelman@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] avformat/rtsp: fix 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 Cc: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman 92c40ef882be115e72d2aa02f9032b7ce88f8537 added a listen_timeout option for sdp. This allowed a user to set variable timeout in sdp which was originally hard coded to 10 seconds. The commit used the initial_timeout variable to store the value. However, in rtsp this variable is also used to infer a "listen" mode. Thus, the timeout value could not be set when connecting to an rtsp server. The default value of -1 would also result in a 100ms total timeout. This was attempted to be fixed in c8101aabee654f6d147a4d89f77fa73e18908610, which changed the meaning of initial_timeout = -1 to be an infinite timeout in rtsp. However, it did not address the issue that the timeout could still not be set. Being able to set the timeout is useful because it allows to automatically reconfigure from a udp to tcp connection in rtp. In this commit, this is fixed by using the stimeout variable/option to set the timeout. Signed-off-by: Andriy Gelman --- libavformat/rtsp.c | 14 +++++++------- libavformat/rtsp.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 2ef75f50e3..a20cde80a9 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -95,9 +95,9 @@ const AVOption ff_rtsp_options[] = { { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections (-1 is infinite, imply flag listen)", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC }, #if FF_API_OLD_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|AV_OPT_FLAG_DEPRECATED }, - { "stimeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, + { "stimeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = 0}, INT_MIN, INT64_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 (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = 0}, INT_MIN, 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 }, @@ -111,7 +111,7 @@ static const AVOption sdp_options[] = { RTSP_FLAG_OPTS("sdp_flags", "SDP flags"), { "custom_io", "use custom I/O", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_CUSTOM_IO}, 0, 0, DEC, "rtsp_flags" }, { "rtcp_to_source", "send RTCP packets to the source address of received packets", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_RTCP_TO_SOURCE}, 0, 0, DEC, "rtsp_flags" }, - { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = READ_PACKET_TIMEOUT_S}, INT_MIN, INT_MAX, DEC }, + { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections", OFFSET(stimeout), AV_OPT_TYPE_DURATION, {.i64 = READ_PACKET_TIMEOUT_S*1000000}, INT_MIN, INT64_MAX, DEC }, RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept from the server"), COMMON_OPTS(), { NULL }, @@ -119,7 +119,7 @@ static const AVOption sdp_options[] = { static const AVOption rtp_options[] = { RTSP_FLAG_OPTS("rtp_flags", "set RTP flags"), - { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = READ_PACKET_TIMEOUT_S}, INT_MIN, INT_MAX, DEC }, + { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections", OFFSET(stimeout), AV_OPT_TYPE_DURATION, {.i64 = READ_PACKET_TIMEOUT_S*1000000}, INT_MIN, INT64_MAX, DEC }, RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept from the server"), COMMON_OPTS(), { NULL }, @@ -1835,7 +1835,7 @@ redirect: /* open the tcp connection */ ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, host, port, - "?timeout=%d", rt->stimeout); + "?timeout=%"PRId64, 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; @@ -1980,7 +1980,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, int n, i, ret; struct pollfd *p = rt->p; int *fds = NULL, fdsnum, fdsidx; - int runs = rt->initial_timeout * 1000LL / POLLING_TIME; + int64_t runs = rt->stimeout / POLLING_TIME / 1000; if (!p) { p = rt->p = av_malloc_array(2 * rt->nb_rtsp_streams + 1, sizeof(*p)); @@ -2041,7 +2041,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, } } #endif - } else if (n == 0 && rt->initial_timeout > 0 && --runs <= 0) { + } else if (n == 0 && rt->stimeout > 0 && --runs <= 0) { return AVERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 251ed86d19..b44a183c4f 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -397,7 +397,7 @@ typedef struct RTSPState { /** * timeout of socket i/o operations. */ - int stimeout; + int64_t stimeout; /** * Size of RTP packet reordering queue. From patchwork Sun Nov 15 18:20:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 23649 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 083A1449207 for ; Sun, 15 Nov 2020 20:20:46 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CB52368B483; Sun, 15 Nov 2020 20:20:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AA2B688154 for ; Sun, 15 Nov 2020 20:20:39 +0200 (EET) Received: by mail-qk1-f195.google.com with SMTP id q22so14558369qkq.6 for ; Sun, 15 Nov 2020 10:20:39 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=/79FwKMZA91pelxPURZTq8sF2eStEC2IdfcyjGXtT1I=; b=YvQcbQigg7i4g8igjqSuXe1o+gUhi3IUWWRRgRv2Dz0kIin9FmAz0fSfnF98CPoMN9 KZlc1bUR0XFBE8EmadNMiGHXdWzvoJ9ZSu1/PvSEDU0k9y8SFYm8iojDYHK1FlaWBHSa uzIgRcdmSlVqdLn4L3q5woKmSSlRpaFnribiDZmgIp6n8tgpt2lHR965F4xb/LQCu4wy GKaeioATXWpGTFl5NEEgVr2HTzQB8u+xo4wxUAAQAT4OmdLQvSJ5nNe0i0p2Avzjpr9n 4yMpmFr25DwE0t/kCxa9ruVI9EVTh42JVZs52LsptFAD8JjS1A/z28/GXNMGWWO/x/Aq 6/KA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=/79FwKMZA91pelxPURZTq8sF2eStEC2IdfcyjGXtT1I=; b=MO7CYryqyFdZxSqJVhOdUNEnM18ILXmm05sv2POy+iR8didgP30lyrTUb6/kUOTTl6 sqEmtEXiLkBqPUEyame6/NAorB+wVsf68Qp0d1wiRlGKpnCzVAO6UfDXf2F7tEfFLwMA P+3RuEixWjfM8QxQfow502chImvru1hlRcKzFGW+Hafx4SbOnLTwilj/UC5OM0j3Cukt S7QRuHQceZRGpKznJZwf7/2eqiwjPgCefMlLSX0S8GvDNwf7GazNeziYyT+shH+x6iap oCgachLZwsxxeQT5tZY+u9jtK8Y1QcppMt5ZPjXF7pIM/P8Vgl6zRG8NuuxrszJgqnlQ ubhQ== X-Gm-Message-State: AOAM531A041G6IoYktnsPY0nE0ZSqAiI5gvzlnBSo7ZfNf53kfJkRUQ9 bpZLd/Ly8TaH4GoY0ZBdCMKp8lvKgG0= X-Google-Smtp-Source: ABdhPJwrGbWlax3n9I2UVT5y0bZVGw2rkWtoe1nNMhsZ124K9RyPj9proxozwiBGPnKKv7IUOSWwdg== X-Received: by 2002:a37:9481:: with SMTP id w123mr10822017qkd.3.1605464437742; Sun, 15 Nov 2020 10:20:37 -0800 (PST) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id g19sm9305178qkl.86.2020.11.15.10.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 10:20:37 -0800 (PST) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Nov 2020 13:20:05 -0500 Message-Id: <20201115182005.24702-4-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201115182005.24702-1-andriy.gelman@gmail.com> References: <20201115182005.24702-1-andriy.gelman@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avformat/rtsp: change to default stimeout to 10 seconds 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: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman This is to match the behaviour before commits: c8101aabee654f6d147a4d89f77fa73e18908610 92c40ef882be115e72d2aa02f9032b7ce88f8537 The only difference is that now a 10 second timeout will also be set when the rtsp session is being setup, whereas before this was an infinite timeout. Signed-off-by: Andriy Gelman --- doc/protocols.texi | 3 ++- libavformat/rtsp.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index fd866f57a5..0187da6c35 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1116,7 +1116,8 @@ which means an infinite timeout when @samp{listen} mode is set. Set number of packets to buffer for handling of reordered packets. @item stimeout -Set socket TCP I/O timeout in microseconds. +Set socket TCP I/O timeout in microseconds. Default is 10,000,000 microseconds +(10 seconds). @item user-agent This option is deprecated. Use @option{user_agent} instead. Override User-Agent header. If not specified, it defaults to the diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index a20cde80a9..3699d354f6 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -95,9 +95,9 @@ const AVOption ff_rtsp_options[] = { { "listen_timeout", "set maximum timeout (in seconds) to wait for incoming connections (-1 is infinite, imply flag listen)", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC }, #if FF_API_OLD_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|AV_OPT_FLAG_DEPRECATED }, - { "stimeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = 0}, INT_MIN, INT64_MAX, DEC }, + { "stimeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = READ_PACKET_TIMEOUT_S*1000000}, INT_MIN, INT64_MAX, DEC }, #else - { "timeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = 0}, INT_MIN, INT64_MAX, DEC }, + { "timeout", "set timeout (in microseconds) of socket TCP I/O operations", OFFSET(stimeout), AV_OPT_TYPE_INT64, {.i64 = READ_PACKET_TIMEOUT_S*1000000}, INT_MIN, 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 },