From patchwork Thu Mar 5 10:01:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alfred E. Heggestad" X-Patchwork-Id: 18054 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B288744ADD2 for ; Thu, 5 Mar 2020 12:08:30 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 82225689E53; Thu, 5 Mar 2020 12:08:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 66ECF689E53 for ; Thu, 5 Mar 2020 12:08:23 +0200 (EET) Received: by mail-wm1-f65.google.com with SMTP id j1so5020206wmi.4 for ; Thu, 05 Mar 2020 02:08:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=fkwsMgLLWxtaWPq92CbTcyXd6oOxnsATOhf8NkxyoV8=; b=qsyCCnljezCjl8NW8WPvaZ9h3OF3lzU2698QCKoL7SqApa46Y8A0AHoCr1Qo/t1HgR QQFsWfozU7kiDnwTVab7tLXsbZOW3lnOoJtunJ6QSE1tnGhMZSDcNjT+4YteVIPAFPlD NIzFAc8jEAJIn/e3tPxp1YoRZzeeBbi1sdJ0+CG7DVDmEMJsG1TrClaDT9AH3ZXWNmcc 6hx2LRiogrJ6j802bCT5CPBRxs9nJS+YDB/mY7vyXBXs1kE5aiRZVhEBL0VDhhj9pg2F fxxWoTmJpPfXftOnP3f9QPsyCky0keEDBEU1HZImtua0PzOsrGjnGmkXEh0r6RSmhjDy scBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=fkwsMgLLWxtaWPq92CbTcyXd6oOxnsATOhf8NkxyoV8=; b=EqUQ1oyjlfJcCvIBaLAHIQ/judutOd5qDxRJ4ZE6ncszfquvNM1rrzq5/G/oZgN+QL 7Yx80CnM8C5qldZh9HUYnYLcIjbLjnjL/fURjxpyL3EYsro4YMc7IpdNTxQNtm6UC+zR WOF79oOU9yV4ut0x7qmn6c/+1747eoiG6NLMjrP51yuItxgV13iytXcB9CkN0cE6gkOK md9/uCI3O7oDOVf2OCWL6aPp/OCvJWeLyjxCvkDRVN9927kFxEbP5I3hFyiPpX+MWdnr 0m/GCTZoqgfTB/ah49+RS0lpaX9HSYrmWCF32zEVMq6dGuxOJHmbL8zu+9kRfN9Gqpcl VVkQ== X-Gm-Message-State: ANhLgQ2DBjxKyDVXUl3uWc2hN/i56/mttshfypdBTlvAbPnNDoTPDLnn vtowR7vvxtTTkPFSuMFoSURMs6Y7 X-Google-Smtp-Source: ADFU+vtdk2MRPNBG9hNRd6YyysEZTpjWg7ypspDJiU1xTCSnUwmrDVCc+Cp6OuqTtYko5Fre12zjVA== X-Received: by 2002:a05:600c:21c6:: with SMTP id x6mr8636043wmj.177.1583402482120; Thu, 05 Mar 2020 02:01:22 -0800 (PST) Received: from Alfreds-MacBook-Pro.local ([2a02:d8:0:9:4d9d:15e7:1f2e:815b]) by smtp.gmail.com with ESMTPSA id z135sm8592720wmc.20.2020.03.05.02.01.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Mar 2020 02:01:21 -0800 (PST) To: ffmpeg-devel@ffmpeg.org From: "Alfred E. Heggestad" Message-ID: <50e536e2-ca80-85fe-ecf7-8526643ac617@gmail.com> Date: Thu, 5 Mar 2020 11:01:19 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd 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" use 3 decimals for the following items: - minBufferTime - minimumUpdatePeriod - timeShiftBufferDepth - suggestedPresentationDelay This improves buffering with shaka player Signed-off-by: Alfred E. Heggestad Signed-off-by: Alfred E. Heggestad --- libavformat/dashenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) static void format_date(char *buf, int size, int64_t time_us) @@ -1171,13 +1171,13 @@ static int write_manifest(AVFormatContext *s, int final) write_time(out, c->total_duration); avio_printf(out, "\"\n"); } else { - int64_t update_period = c->last_duration / AV_TIME_BASE; + double update_period = (double)c->last_duration / AV_TIME_BASE; char now_str[100]; if (c->use_template && !c->use_timeline) update_period = 500; - avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period); + avio_printf(out, "\tminimumUpdatePeriod=\"PT%.3fS\"\n", update_period); if (!c->ldash) - avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE); + avio_printf(out, "\tsuggestedPresentationDelay=\"PT%.3fS\"\n", (double)c->last_duration / AV_TIME_BASE); if (c->availability_start_time[0]) avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", c->availability_start_time); format_date(now_str, sizeof(now_str), av_gettime()); diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 94d463972a..37fbbbc1d2 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -774,7 +774,7 @@ static void write_time(AVIOContext *out, int64_t time) avio_printf(out, "%dH", hours); if (hours || minutes) avio_printf(out, "%dM", minutes); - avio_printf(out, "%d.%dS", seconds, fractions / (AV_TIME_BASE / 10)); + avio_printf(out, "%d.%03dS", seconds, (fractions * 1000) / AV_TIME_BASE); }