Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-08 Thread Jeyapal, Karthick

On 3/5/20 9:02 PM, Alfred E. Heggestad wrote:
>
>
> On 05/03/2020 15:37, Carl Eugen Hoyos wrote:
>> Am Do., 5. März 2020 um 11:08 Uhr schrieb Alfred E. Heggestad
>> :
>>
>>> -int64_t update_period = c->last_duration / AV_TIME_BASE;
>>> +double update_period = (double)c->last_duration / AV_TIME_BASE; 
>>
>> Can't you instead do int64 update_period = last_duration * 1000 / 
>> AV_TIME_BASE
>> to avoid using doubles that will potentially break automatic testing?
>>
>
> in this case the update_period will be in [milliseconds] units.
> how should I print that ?
I guess in any case a . will be present that can break any automatic testing.
I would suggest having this feature of printing double(.3f) under an option 
with default as false.
In that way there anyone relying on the current behavior is not affected.
>
>
> or we can use write_time() to print it, in AV_TIME_BASE units:
>
>
> int64_t update_period = c->last_duration;
>
> avio_printf(out, "\tminimumUpdatePeriod=\"");
> write_time(out, update_period);
> avio_printf(out, "\"\n");
>
>
>
>
>
> /alfred
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Alfred E. Heggestad



On 05/03/2020 15:37, Carl Eugen Hoyos wrote:

Am Do., 5. März 2020 um 11:08 Uhr schrieb Alfred E. Heggestad
:


-int64_t update_period = c->last_duration / AV_TIME_BASE;
+double update_period = (double)c->last_duration / AV_TIME_BASE;


Can't you instead do int64 update_period = last_duration * 1000 / AV_TIME_BASE
to avoid using doubles that will potentially break automatic testing?



in this case the update_period will be in [milliseconds] units.
how should I print that ?


or we can use write_time() to print it, in AV_TIME_BASE units:


int64_t update_period = c->last_duration;

avio_printf(out, "\tminimumUpdatePeriod=\"");
write_time(out, update_period);
avio_printf(out, "\"\n");





/alfred
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Carl Eugen Hoyos
Am Do., 5. März 2020 um 11:08 Uhr schrieb Alfred E. Heggestad
:

> -int64_t update_period = c->last_duration / AV_TIME_BASE;
> +double update_period = (double)c->last_duration / AV_TIME_BASE;

Can't you instead do int64 update_period = last_duration * 1000 / AV_TIME_BASE
to avoid using doubles that will potentially break automatic testing?

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Alfred E. Heggestad

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

From c569a1d970d27e814f54dbacf5dac7a337efb0d6 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
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 
---
 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)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Moritz Barsnick
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,
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Alfred E. Heggestad

use 3 decimals for the following items:

- minBufferTime
- minimumUpdatePeriod
- timeShiftBufferDepth
- suggestedPresentationDelay

This improves buffering with shaka player

Signed-off-by: Alfred E. Heggestad 
---
 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)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".