From patchwork Wed Sep 20 00:12:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 5199 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp142064jaa; Tue, 19 Sep 2017 17:13:11 -0700 (PDT) X-Received: by 10.223.133.164 with SMTP id 33mr2782594wrt.179.1505866391221; Tue, 19 Sep 2017 17:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505866391; cv=none; d=google.com; s=arc-20160816; b=wTUtWfMKs7fKjzaM+GMPqp4p6YHvpXd/2wkvhKdV4iNHoHvlEjppvoIGFq+fVAsu2X mkRX7mBrVu5tZuE6DsmpKYgmqq7yrVRsVg0FUNo1XIE0NfHAA/8vV4PlmWW3f8c23P3q b+x7iR0NnPAB4G2QsqRD2fmmZcLeSxMNK5Je4mwlvAag4NGvWOAkCILKZ3GjmC4dyzgD C8cmNU9JSoMyJgsRIQpWZWEcZMs68MrLSoBA2xvWecvHddTQ3V3SSaXOJdy6yR2Qrfzj jBr5vM0M/TR8z7jlGjYaCmC5bCic5DqOJe4D6ZD6us0eTzwh/WhT7jifuUgjIF63tA5b d/vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=wLlrTqO1fXmHyMzLFTHDu4K3mMrWNDAEC0VGkiE7cpo=; b=UY1JI8KnaZDInBSNieaXnH5Sbtm8juDdOA67MVYOafuC8oV6bzeEYt6SazFXIGzlAh V/gyYAHceb7D2mCU6j2o/oWgYHfvjAb2sA72BSXvuXy0v8a7exGQOFGf1IRS5f3bQ3th q74UZXJNAPuIWFWc2wFFNWFgIx6jlqWqpP6IeWQNJNOXwZchJnxlc+1S2NAE6swtyCwg /XkeizH88UNEcqckqhlkIO1HsrAUJ7lY7/dVJU7CkBichVlfZZxB1Gmb40hIeEqsu1gp ogDAAd2vda77o3JLnWZjbUIzdQhcXbRH/OpGRdJUkjUuGq4Bfq9THJcvLmv/5xUytuX3 q2Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=P80Cm30V; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 29si416451wrz.280.2017.09.19.17.13.10; Tue, 19 Sep 2017 17:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=P80Cm30V; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2C38168971B; Wed, 20 Sep 2017 03:13:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f169.google.com (mail-io0-f169.google.com [209.85.223.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8F6EB6804A9 for ; Wed, 20 Sep 2017 03:12:53 +0300 (EEST) Received: by mail-io0-f169.google.com with SMTP id 21so2631438iof.6 for ; Tue, 19 Sep 2017 17:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Iyhkidk1CCg2N60TlKbXaseHIFXduTmpD3aLrEsoAd0=; b=P80Cm30VAFYrSRgN3LFEnRIRuJ4fXycrFyZjZNkH41SFMS3Tz3mK78cRzSpPq3Pl9p 3sPLo/29ErhDMtv6DKcdlSxro3v4dzn7ArZD3FX+dRMac1NJgZejM3o7GWxeIt7ApuNN SJY2awRhFh/7TpnYRbnc7WT81nGWaqhOWyizukba4GP7gRQAERlhjMPgSJjhzsZFxHQ7 TmFRIG58AoAjomKgDP0QR1wUpR+fSv021Zilbg1Ua7CEbKQi7LZjX2b6InUPesJeQGgl ptLCxs/MSL85d9awk28VEXzTjmYp8fHvDrQL6PLK124PZbs1H9ZPzcorC74CNjH+pVqH XCbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Iyhkidk1CCg2N60TlKbXaseHIFXduTmpD3aLrEsoAd0=; b=Nz8g/AH/zhyrwa9y+G58dpKVnkhpZq8iK1quraoXrbwMYivBQDgT73eKEdGAXlxDMs WonZ9z7qiFmh7GsurAAtr0FVlxiDZuUPVD8EwqjubDBN2UasnZiiSKgOSKnMLNG2HmP2 Hxc4IZK/+C+qEtvijEa/0EnS/O/tauYgSwE/oC4eP8ScoqR1LeaULSpVa4afCAI/+a76 5QbpreNdBdro6L09XUktvD4FjsfpmWu3n3a25vxxqHEv01qrPYqb+60rO2Qe6gyKhHa4 v/Inq8yqD4TM/Fk5HxrKU0zQB1ZkUhiaT5S6MbaRuWPw2guwhL7fI8XF1KaQCojjVzBK hlVA== X-Gm-Message-State: AHPjjUhu7v+Gr3ZAqbcCYRB8LJ9f1LkyIdz9fYTvhkqtllQkFSZXxlUh GevzEQvo0TCkAGweTCEgZN4Vs1X+kFBs0e7hcXg= X-Google-Smtp-Source: AOwi7QBy4KuiZQA9RLYV+Bz5zJjzxjhS8pn201nHldn7VUQqEsEE6VPHhusc696e3SmUgYxVEFoTE2KqSRFD0Z6ASQg= X-Received: by 10.107.10.141 with SMTP id 13mr4230814iok.302.1505866381208; Tue, 19 Sep 2017 17:13:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.139.4 with HTTP; Tue, 19 Sep 2017 17:12:40 -0700 (PDT) In-Reply-To: References: From: Carl Eugen Hoyos Date: Wed, 20 Sep 2017 02:12:40 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH]lavf/rtsp: Allow to set SDP timeout. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 2017-09-20 2:01 GMT+02:00 Marton Balint : > > > 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 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