[FFmpeg-devel] [PATCH] libavformat/dashenc.c:support mpd update period

Siyuan Huang saber.huang at samsung.com
Tue Jun 30 08:44:37 EEST 2020


Update with no file mode changes :

 

From 818095d4f0aa50dfee3cb0622146a2180801c5fe Mon Sep 17 00:00:00 2001

From: Siyuan Huang <saber.huang at samsung.com>

Date: Tue, 30 Jun 2020 13:41:46 +0800

Subject: [PATCH] libavformat/dashenc.c:support mpd update period v3

 

according iso 23009-1 , in live cases , mpd refresh

period should be changeable

 

Signed-off-by: Siyuan Huang <saber.huang at samsung.com>

---

doc/muxers.texi       | 4 ++++

libavformat/dashenc.c | 4 ++++

2 files changed, 8 insertions(+)

 

diff --git a/doc/muxers.texi b/doc/muxers.texi

index b1389a3227..86976f4f61 100644

--- a/doc/muxers.texi

+++ b/doc/muxers.texi

@@ -366,6 +366,10 @@ adjusting playback latency and buffer occupancy during
normal playback by client

Set the maximum playback rate indicated as appropriate for the purposes of
automatically

adjusting playback latency and buffer occupancy during normal playback by
clients.

+ at item update_period @var{update_period}

+ Set the mpd update period ,for dynamic content.

+ The unit is second.

+

@end table

 @anchor{framecrc}

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c

index 62193058d7..dc3306a56a 100644

--- a/libavformat/dashenc.c

+++ b/libavformat/dashenc.c

@@ -198,6 +198,7 @@ typedef struct DASHContext {

     int target_latency_refid;

     AVRational min_playback_rate;

     AVRational max_playback_rate;

+    int64_t update_period;

} DASHContext;

 static struct codec_string {

@@ -1184,6 +1185,8 @@ static int write_manifest(AVFormatContext *s, int
final)

         char now_str[100];

         if (c->use_template && !c->use_timeline)

             update_period = 500;

+        if (c->update_period)

+            update_period = c->update_period;

         avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n",
update_period);

         if (!c->ldash)

             avio_printf(out,
"\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration /
AV_TIME_BASE);

@@ -2380,6 +2383,7 @@ static const AVOption options[] = {

     { "target_latency", "Set desired target latency for Low-latency dash",
OFFSET(target_latency), AV_OPT_TYPE_DURATION, { .i64 = 0 }, 0, INT_MAX, E },

     { "min_playback_rate", "Set desired minimum playback rate",
OFFSET(min_playback_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 1.0 }, 0.5, 1.5, E
},

     { "max_playback_rate", "Set desired maximum playback rate",
OFFSET(max_playback_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 1.0 }, 0.5, 1.5, E
},

+    { "update_period", "Set the mpd update interval",
OFFSET(update_period), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, E},

     { NULL },

};

-- 

2.17.1

 

From: Siyuan Huang <saber.huang at samsung.com> 
Sent: 2020年6月30日 11:59
To: 'ffmpeg-devel at ffmpeg.org' <ffmpeg-devel at ffmpeg.org>
Subject: RE: [PATCH] libavformat/dashenc.c:support mpd update period

 

Add patch file 

 

From: Siyuan Huang < <mailto:saber.huang at samsung.com>
saber.huang at samsung.com> 
Sent: 2020年6月30日 11:34
To: 'ffmpeg-devel at ffmpeg.org' < <mailto:ffmpeg-devel at ffmpeg.org>
ffmpeg-devel at ffmpeg.org>
Subject: [PATCH] libavformat/dashenc.c:support mpd update period

 

From: Siyuan Huang < <mailto:saber.huang at samsung.com>
saber.huang at samsung.com>

 

according iso 23009-1 , in live cases , mpd refresh

period should be changeable

 

Signed-off-by: Siyuan Huang < <mailto:saber.huang at samsung.com>
saber.huang at samsung.com>

---

doc/muxers.texi       | 4 ++++

libavformat/dashenc.c | 4 ++++

2 files changed, 8 insertions(+)

mode change 100644 => 100755 doc/muxers.texi

 

diff --git a/doc/muxers.texi b/doc/muxers.texi

old mode 100644

new mode 100755

index b1389a3227..babbcb16af

--- a/doc/muxers.texi

+++ b/doc/muxers.texi

@@ -366,6 +366,10 @@ adjusting playback latency and buffer occupancy during
normal playback by client

Set the maximum playback rate indicated as appropriate for the purposes of
automatically

adjusting playback latency and buffer occupancy during normal playback by
clients.

 

+ at item update_period @var{update_period}

+ Set the mpd update period ,for dynamic content.

+ The unit is second.

+

@end table

 

 @anchor{framecrc}

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c

index 66a8a62294..ef6e3d29c6 100755

--- a/libavformat/dashenc.c

+++ b/libavformat/dashenc.c

@@ -198,6 +198,7 @@ typedef struct DASHContext {

     int target_latency_refid;

     AVRational min_playback_rate;

     AVRational max_playback_rate;

+    int64_t update_period;

} DASHContext;

 

 static struct codec_string {

@@ -1184,6 +1185,8 @@ static int write_manifest(AVFormatContext *s, int
final)

         char now_str[100];

         if (c->use_template && !c->use_timeline)

             update_period = 500;

+        if (c->update_period)

+            update_period = c->update_period;

         avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n",
update_period);

         if (!c->ldash)

             avio_printf(out,
"\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration /
AV_TIME_BASE);

@@ -2382,6 +2385,7 @@ static const AVOption options[] = {

     { "target_latency", "Set desired target latency for Low-latency dash",
OFFSET(target_latency), AV_OPT_TYPE_DURATION, { .i64 = 0 }, 0, INT_MAX, E },

     { "min_playback_rate", "Set desired minimum playback rate",
OFFSET(min_playback_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 1.0 }, 0.5, 1.5, E
},

     { "max_playback_rate", "Set desired maximum playback rate",
OFFSET(max_playback_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 1.0 }, 0.5, 1.5, E
},

+    { "update_period", "Set the mpd update interval",
OFFSET(update_period), AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, E},

     { NULL },

};

 

-- 

2.17.1

 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavformat-dashenc.c-support-mpd-update-period-v3.patch
Type: application/octet-stream
Size: 2546 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200630/972d0858/attachment.obj>


More information about the ffmpeg-devel mailing list