2017-09-20 2:01 GMT+02:00 Marton Balint <c...@passwd.hu>: > > > On Wed, 20 Sep 2017, Carl Eugen Hoyos wrote: > >> Hi! >> >> Attached patch fixes part of ticket #2415. >> >> Please comment, Carl Eugen >> > > 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 }, > > I'd prefer AV_OPT_TYPE_DURATION for every new duration-like option
New patch attached. Thank you, Carl Eugen
From 94f133e86c318282564d5cc3cfac3ae8e451d7d4 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffm...@gmail.com> Date: Wed, 20 Sep 2017 02:11:42 +0200 Subject: [PATCH] lavf/rtsp: Allow to set sdp timeout. Fixes part of ticket #2415. --- libavformat/rtsp.c | 3 ++- libavformat/rtsp.h | 4 ++-- libavformat/rtspdec.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 0bd72dc..b659031 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", OFFSET(initial_timeout), AV_OPT_TYPE_DURATION, {.i64 = MAX_TIMEOUTS * 100000}, 0, INT64_MAX, 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 / 100000) { return AVERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 852fd67..458ec5c 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -387,9 +387,9 @@ typedef struct RTSPState { int rtp_port_min, rtp_port_max; /** - * Timeout to wait for incoming connections. + * Timeout to wait for connections. */ - int initial_timeout; + int64_t initial_timeout; /** * timeout of socket i/o operations. diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index fdf75a0..7d3b859 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -660,7 +660,7 @@ static int rtsp_listen(AVFormatContext *s) /* Create TCP connection */ ff_url_join(tcpname, sizeof(tcpname), lower_proto, NULL, host, port, - "?listen&listen_timeout=%d", rt->initial_timeout * 1000); + "?listen&listen_timeout=%d", (int)rt->initial_timeout * 1000); if (ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL, -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel