From patchwork Wed Apr 4 08:37:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dixit, Vishwanath" X-Patchwork-Id: 8315 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp4619156jad; Wed, 4 Apr 2018 01:37:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+jdk79o5I+7AK0Aj/xpufeGvnPvRi/pArtqmlyVvcBssMqo3U7YTstwwqw9u0sjT3Ds8Oj X-Received: by 10.28.105.19 with SMTP id e19mr6941845wmc.3.1522831059417; Wed, 04 Apr 2018 01:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522831059; cv=none; d=google.com; s=arc-20160816; b=m/RYGSVSuY2B32ZSVKYj2maNyFzyHHSWN5iT2pV5sT4At7QISzAkzdPfuOXumwydq7 Wbx7jelxo9OmSNttRlimVVnaJHHTQDnVXgOnN+/GzGHPK97VEVclZZltOv6UBs6Z61rD UfD5V9EFbW5EqZ1PBKOeLvmVBiEm7pdQKRieW3ZHkSWExUIcCpZSz0s//fa4w1uk29wT 1vuRV6XrTssjPTE0pPnOE3MbhIMQS5UALDef5gqL+buNsiTv5yRjTsnusTnHWQxxmed2 BmDUcc+2rOVR/AUnzZ/uoJEM7HzjST4+Xhcz/ewROjcbUhasIyHWC0YLV0LWig1lApVz LMdw== 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=tfPaStqCXrCseEmkJNvUw56Yyn5myy5uoKESKCR1avM=; b=Kmk1VRkbCUCVuHDZAogpoOy+AphGjmwgNN/9Up9iSol3jASoQYuRpnMU4olKr3XJZZ Ks/RyJ/J+guZy2grC3v8gfZxuo4+RHtweac3+XtI6B7Ughk4SGH/82OCb6QgPPpt0L25 ulRyskdo4p0dJq6p48Ghut9rZXcFhLfvRpvIa5Mqw3l3jhHAz7l4yGDaYXIQPFbQliel 1WPaeYe5eCsJDgWg9iUmT76vLBWNO/oubsXDdZUxE893o3FoWvuPjVysDxtIr/Z/2KOi Vx3koPz/68l2feD4jtTmi/gTC427tiBXUkYc0AIMVGdjWXnuxCND1N7aL4KV1HS++I87 6XGg== 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=IzuRf2Zk; 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 184si1887317wmz.52.2018.04.04.01.37.39; Wed, 04 Apr 2018 01:37:39 -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=IzuRf2Zk; 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 9E045689A70; Wed, 4 Apr 2018 11:37:15 +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 CFB8468067F for ; Wed, 4 Apr 2018 11:37:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=m78bu0.a1-4.dyn; x=1522831955; h=Feedback-ID: X-Smtpcorp-Track:Message-Id:Date:Subject:To:From:Reply-To:Sender: List-Unsubscribe; bh=9Xnmyu3c7ISmUmjRY8FcVMUaCiigEOHU92JJfYTgbMQ=; b=IzuRf2Zk vIO8DfQSmE8JWCmmSWUijr65VqkDY9C4XplzhoA4pjj4sOhdkPF1gJAmZ0Gmk0FYHHEMvpP/MYdai VCUWwot7vJ4K1yBJ8wrSV8nTpHYM8gK4ony5CKiZY99YFToIKvD550GS9ugsMkHG5dtWqO0oDpitZ o9lJ4xT5r3aod8gV3zSbjnnAkgbu7i7ATSU7sN6Y9WyYivzfgIK4T2t+JXNkFgb+Sqx87Drz4gXZv SGVGwMMPccX9Gfb0bnsXKTRl+QkcDXR3Vei6k275eQNY4XPu0EcUSJjuDbmxeX4+IvDE8vAyEk4GN USoX08rmIipkk16lBuzl9+zmHA==; From: vdixit@akamai.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Apr 2018 14:07:28 +0530 Message-Id: <1522831048-7163-1-git-send-email-vdixit@akamai.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <48A9BF1F-86E1-4442-A25F-190E5C0CDEC1@akamai.com> References: <48A9BF1F-86E1-4442-A25F-190E5C0CDEC1@akamai.com> X-Smtpcorp-Track: 1f3dv8NmF9I5mr.xu7LjfrW5 Feedback-ID: 337386m:337386asVRLGB:337386sViLShJIfS:SMTPCORP X-Report-Abuse: Please forward a copy of this message, including all headers, to Subject: [FFmpeg-devel] [PATCH v2 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 1bac2c9..9e7a374 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -741,9 +741,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)); @@ -1288,6 +1285,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;