[FFmpeg-devel] [PATCH 4/4] avformat/rtsp: change to default stimeout to 10 seconds

Andriy Gelman andriy.gelman at gmail.com
Sun Nov 15 20:20:05 EET 2020


From: Andriy Gelman <andriy.gelman at gmail.com>

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 <andriy.gelman at gmail.com>
---
 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 },
-- 
2.28.0



More information about the ffmpeg-devel mailing list