diff mbox

[FFmpeg-devel] lavf/rtsp: Allow to set SDP timeout.

Message ID CAB0OVGp2g7wH0g+dt-tSenYFr4gud9+t444fyZRWVnyn+OxSpg@mail.gmail.com
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos Sept. 19, 2017, 11:40 p.m. UTC
Hi!

Attached patch fixes part of ticket #2415.

Please comment, Carl Eugen
diff mbox

Patch

From 6da40f03df782a5b230026c7732095700e55f73a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 20 Sep 2017 01:38:46 +0200
Subject: [PATCH] lavf/rtsp: Allow to set sdp timeout.

Fixes part of ticket #2415.
---
 libavformat/rtsp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 0bd72dc..c8fa26a 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -104,6 +104,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" },
+    { "timeout", "set timeout (in tenths of a seconds)", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = MAX_TIMEOUTS}, 0, 1000000, DEC },
     RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept from the server"),
     COMMON_OPTS(),
     { NULL },
@@ -2003,7 +2004,7 @@  static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
                 }
             }
 #endif
-        } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
+        } else if (n == 0 && ++timeout_cnt >= rt->initial_timeout) {
             return AVERROR(ETIMEDOUT);
         } else if (n < 0 && errno != EINTR)
             return AVERROR(errno);
-- 
1.7.10.4