From patchwork Fri Mar 2 06:56:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patagar, Ravindra" X-Patchwork-Id: 7790 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp5920838jaj; Thu, 1 Mar 2018 22:56:58 -0800 (PST) X-Google-Smtp-Source: AG47ELtM1arw4KZbjTxmYjaHnO053VxUQDCsBZA+uPxwNAV6ZuFfPXIGcFsIzcC7/jPswPCgNydJ X-Received: by 10.223.171.88 with SMTP id r24mr3988124wrc.194.1519973818448; Thu, 01 Mar 2018 22:56:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519973818; cv=none; d=google.com; s=arc-20160816; b=YSSmWukWAn7VEzVMEFNs7p1QBMrEfRpEsZXl/SRf5mveITZagFJkTJXCSbCdU1Ky21 RKrl1kG/5arV/qAh/1I4MDhDQTgFetk5LQwvpTttG2EYcJY+yu7IaAOtB5mo7RazR+N7 uAtaE9jmZaQdAx5gG0SvBTLSb6VKrC5eGO3B6Kq08p/oX6UBJXAVYirJcLMkXC+7XdvZ U4VsuB13b0gbznbO3ZNWasQ/INi2GXnsDDomeDks7ZWzpuNEBZ5nXnh/3Tpc4+1sFarc kW/84ZB/gxdQUHyZj3m1FPYs8Or7lz4raR7K9jXcB6SfPZm1cvc6y/vSDuKknrlNLWX8 qvKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:date:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=98VXNLVzVexD2h3jcQ1QFf1+I3u5QT6iIaGN/UGbQSQ=; b=IGVwy9C/LZThISj79wqpPVWLmBIxGnkd7dLERUVkW8/MbPUUZTEDvLcG21H/GY0MDx BhZ9d/5bfJoJeJsah0th/z5fGV3nHOSML3BLDvl/EZa+fc61oeEeRwR12u4JkjzYv46x gK0/5lR5P+n/+OVwNlj1dzzqRo5SkaXfvntYOGe+TGSm9nIN4S8bCsomPa68JuxM44Qy SfA19hQO1dq+GiRu2JE1d6trGombtdyUcbdl57oUTGTpB2Ch720y1k0sW8/bsLrErk+K hOvQOx7tRSCRKx+zbyQ81mJhytJlHjswj+xlftM8JBQYfnpwRX3sFgTFEo8IB2Gqjk5k Jlnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=zQBW0Olq; 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=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z62si421721wmc.205.2018.03.01.22.56.57; Thu, 01 Mar 2018 22:56:58 -0800 (PST) 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=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=zQBW0Olq; 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=QUARANTINE sp=NONE dis=NONE) header.from=akamai.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 88CD4689FF3; Fri, 2 Mar 2018 08:56:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a2i831.smtp2go.com (a2i831.smtp2go.com [103.47.207.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F34ED689E29 for ; Fri, 2 Mar 2018 08:56:42 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1519974714; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=K2rZkShELlBA4cu0sykVmCdlAsLYWoExjMzk96SUnEE=; b=zQBW0Olq 5vhxsnXzETaqNbAkX+kkB0rB7AsnannZL6lWK8LzR5CLYiwBeze3EahQ8b78I7op+xtA7PUqKqzOO 2ZFNWPiRuaKD7REOE2vwiZeNVTf/h7V1CrZIogNlvbU6HU0KwkeBaDsKpye+10WIO9QzuDiiAsxmU RwQ4UKi7C0d9Bec4G6+KFmXiI/Lb1IU4PR5sRupbBaL2YfU2h1koESjn3Q5cztqeXbeEtADRdgSTa VY/5kPANfDixTJE5hW8ToYNxJrwfwCJY5BoqH0e9eWX0oL8rmtnQ9KBp8x7fexkA2QwbPOcuEKjTW eWR5VBWNvgp2BDzv3Y9yRxO5Ig==; From: rpatagar@akamai.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 2 Mar 2018 12:26:39 +0530 Message-Id: <1519973799-24744-1-git-send-email-rpatagar@akamai.com> X-Mailer: git-send-email 1.9.1 X-Smtpcorp-Track: 1-r-cb4baj-k5V.XLWsTmObk Feedback-ID: 337386m:337386asVRLGB:337386sxb_XKpBHO:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH 1/1] libavformat/hlsenc: Option to set timeout for socket I/O operation 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 Cc: Ravindra Patagar MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Ravindra Patagar Signed-off-by: Ravindra --- doc/muxers.texi | 3 +++ libavformat/hlsenc.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index c156ec0..e41f8c6 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -964,6 +964,9 @@ publishing it repeatedly every after 30 segments i.e. every after 60s. @item http_persistent Use persistent HTTP connections. Applicable only for HTTP output. +@item timeout +Set timeout (in microseconds) for socket I/O operations. Applicable only for HTTP output. + @end table @anchor{ico} diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 08fe0aa..e69985a 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -224,6 +224,7 @@ typedef struct HLSContext { int http_persistent; AVIOContext *m3u8_out; AVIOContext *sub_m3u8_out; + int timeout; } HLSContext; static int mkdir_p(const char *path) { @@ -305,7 +306,8 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont av_dict_set(options, "user_agent", c->user_agent, 0); if (c->http_persistent) av_dict_set_int(options, "multiple_requests", 1, 0); - + if (c->timeout >= 0) + av_dict_set_int(options, "timeout", c->timeout, 0); } static void write_codec_attr(AVStream *st, VariantStream *vs) { @@ -2792,6 +2794,7 @@ static const AVOption options[] = { {"master_pl_name", "Create HLS master playlist with this name", OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, {"master_pl_publish_rate", "Publish master play list every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, E}, {"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, + {"timeout", "set timeout (in microseconds) for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = E }, { NULL }, };