[FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd
Alfred E. Heggestad
alfred.heggestad at gmail.com
Thu Mar 5 12:43:53 EET 2020
On 05/03/2020 11:40, Moritz Barsnick wrote:
> On Thu, Mar 05, 2020 at 11:01:19 +0100, Alfred E. Heggestad wrote:
>> - 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);
>
> Your patch is corrupted by newlines, which makes it impossible to apply
> it easily (or even automatically). Please resend it as an attachment,
> or using "git send-email".
>
thanks,
here is the patch attached.
/alfred
-------------- next part --------------
From c569a1d970d27e814f54dbacf5dac7a337efb0d6 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" <alfred.heggestad at gmail.com>
Date: Thu, 5 Mar 2020 10:52:29 +0100
Subject: [PATCH] dashenc: more accurate time values in playlist.mpd
use 3 decimals for the following items:
- minBufferTime
- minimumUpdatePeriod
- timeShiftBufferDepth
- suggestedPresentationDelay
This improves buffering with shaka player
Signed-off-by: Alfred E. Heggestad <alfred.heggestad at gmail.com>
---
libavformat/dashenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
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);
}
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());
--
2.20.1 (Apple Git-117)
More information about the ffmpeg-devel
mailing list