On Wed, Sep 20, 2017 at 02:12:40AM +0200, Carl Eugen Hoyos wrote: > 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
> rtsp.c | 3 ++- > rtsp.h | 4 ++-- > rtspdec.c | 2 +- > 3 files changed, 5 insertions(+), 4 deletions(-) > 05df8d90263524c93e9565f1eed357f92d54af7b > 0001-lavf-rtsp-Allow-to-set-sdp-timeout.patch > 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; if you chnage it to 64bit then the existing "timeout" AVOption needs an update too [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "You are 36 times more likely to die in a bathtub than at the hands of a terrorist. Also, you are 2.5 times more likely to become a president and 2 times more likely to become an astronaut, than to die in a terrorist attack." -- Thoughty2
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel