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(-)
@@ -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