From patchwork Wed Apr 11 07:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dixit, Vishwanath" X-Patchwork-Id: 8392 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp369374jad; Wed, 11 Apr 2018 00:01:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx48+wLjBnxfDINS48/cuUWbmOAZJtlInjzNxyG50RRD/MZzwGWxKx9fo9N4YOSD69tmpWRzv X-Received: by 10.223.138.246 with SMTP id z51mr2272688wrz.150.1523430113080; Wed, 11 Apr 2018 00:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523430113; cv=none; d=google.com; s=arc-20160816; b=JVzfKwLixyYSLwcVS0yGiShys7fWZfVPQNzNiLCe8oqgDIrsLJwbO2gsELpwW8rRYD rf/WLUZbFqu2v+Z/bYkAgs7vKyHAx1eLb4Tsi7+X5R2RsQvhrwJaY83eNTBtLqpPDAca nLzvPbrLjRzmgvvkmi0M4/OtDnnLZT0h47h2Cm/ELLXnjJxb00iBD+/eIxKxFP04uub2 wKUGmD7I/kymTPgnPhH932Jk6bnHRpNVcGM75NTtw4e8hZdQYzlRmJ7ipW+IQu/Xd9wV f7DbMBDm3LyvzELMYtr8O2cwjbMbOQ/UnPcy2eYmWIBy+EGoBr+awAz/4kp+FpBVDBem F0EQ== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=v8rRYqL1zpdAc7O9cxzfCngC45DFKISzfv3+64BZuiA=; b=xAUNHxSsETKfKf0d9zAgQJozqaVG60yn5w/3F1zf4ywK1Q+WLAFzJszggjxNTbyzTC n3pLzdAk9ClTWuYfJMg/yTe6IujXpDO6ubPCwi1Fcm8mr5ng0G1hcVIY0hSZPDSNxLlo w+q97ZtEd1uhEmRWDZvR5/WomsoHtaDAla2iHRq3HZygkVG4ERMY+5K7U6FoIAyRsIDE L+sIC0D8P++d/Pm73zSEm87FVFiV29WLJwr3Rv5ExvK2i60HgF45XswoDt8XGuq2ZMsu +g8oV3EMvLSLPkQ5lMfhgoPM+hi15x5jD6h/fwJ6NkMHjlDtOHJvOxrdPG2+NxIKbnI8 /HRw== 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=hog15iii; 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 k27si345248wrf.541.2018.04.11.00.01.52; Wed, 11 Apr 2018 00:01:53 -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=@smtpservice.net header.s=m78bu0.a1-4.dyn header.b=hog15iii; 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 3EBBE68A24E; Wed, 11 Apr 2018 10:01:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a1i318.smtp2go.com (a1i318.smtp2go.com [43.228.185.62]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 41D9068A1DE for ; Wed, 11 Apr 2018 10:01:21 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1523431010; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=X30Sy81uEgqAVRK/VLjc5spKOSoo1Obea6obhK9X3Hg=; b=hog15iii pY8atPQ2wdUzionK8Lha1fDppJPRmmFpjv9JM3kan0RY/UAM9uF9aukIWZN7kfeYc3ivL3sj9JWoo IU1H8uuJoliBk0QiYxCsldOKuruerOoQpY51rmmDf/E1hR5mGe6hDbTfeXD0NXsvky59w1D3uxvvD B7F0S9+Vwi6i7GhoTMj28QlrFWZfnYGP01SGVzokes4Q5dWrj90h/tAQvdWvxWKGx0HnU3dURajN4 2tCqn2u6NJR/5s8UwhoVTGMHAOyHyt+IW55MTgGZ5GY6PlapufiI5sCUPp8si7GobAFMRhD5iBTo6 35jFh5pZ2UmfoJcPjOZVbx/pOA==; From: vdixit@akamai.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Apr 2018 12:31:36 +0530 Message-Id: <1523430096-17187-1-git-send-email-vdixit@akamai.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522831048-7163-1-git-send-email-vdixit@akamai.com> References: <1522831048-7163-1-git-send-email-vdixit@akamai.com> X-Smtpcorp-Track: 1f69_ERyIKehR1.zfLVEkZIy Feedback-ID: 337386m:337386asVRLGB:337386sSXHbMOkpx:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH v3 05/11] avformat/dashenc: setting @availabilityStartTime when the first frame is ready 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: Vishwanath Dixit MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Vishwanath Dixit @availabilityStartTime specifies the anchor for the computation of the earliest availability time (in UTC) for any Segment in the Media Presentation. As per this requirement, the @AvailabilityStartTime should be set to the wallclock time at which the first frame of the first segment begins encoding. But, it was getting set only when the first segment was completely ready. Making the required correction in this patch. This correction is mainly needed to reduce the latency in live streaming use cases. --- libavformat/dashenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index bf06a7b..5d5310d 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -743,9 +743,6 @@ static int write_manifest(AVFormatContext *s, int final) update_period = 500; avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period); avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE); - if (!c->availability_start_time[0] && s->nb_streams > 0 && c->streams[0].nb_segments > 0) { - format_date_now(c->availability_start_time, sizeof(c->availability_start_time)); - } if (c->availability_start_time[0]) avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", c->availability_start_time); format_date_now(now_str, sizeof(now_str)); @@ -1292,6 +1289,10 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt) if (os->first_pts == AV_NOPTS_VALUE) os->first_pts = pkt->pts; + if (!c->availability_start_time[0]) + format_date_now(c->availability_start_time, + sizeof(c->availability_start_time)); + if (c->use_template && !c->use_timeline) { elapsed_duration = pkt->pts - os->first_pts; seg_end_duration = (int64_t) os->segment_index * c->seg_duration;