[FFmpeg-devel] [PATCH] libavformat/dashenc.c:add support to change mpd update interval

Siyuan Huang saber.huang at samsung.com
Fri May 29 10:18:42 EEST 2020


according iso 23009-1 , in live cases , mpd refresh period should be
changeable

and default 500 seconds is too long , in normal live cases , it should be
2~5 seconds

 

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

---

libavformat/dashenc.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)

mode change 100644 => 100755 libavformat/dashenc.c

 

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

old mode 100644

new mode 100755

index 0cf0df50ef..6f8de5762b

--- a/libavformat/dashenc.c

+++ b/libavformat/dashenc.c

@@ -196,6 +196,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 {

@@ -1177,7 +1178,9 @@ static int write_manifest(AVFormatContext *s, int
final)

         int64_t update_period = c->last_duration / AV_TIME_BASE;

         char now_str[100];

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

-            update_period = 500;

+            update_period = 5;

+        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);

@@ -2368,6 +2371,7 @@ static const AVOption options[] = {

     { "dvb_dash", "DVB-DASH profile", 0, AV_OPT_TYPE_CONST, {.i64 =
MPD_PROFILE_DVB }, 0, UINT_MAX, E, "mpd_profile"},

     { "http_opts", "HTTP protocol options", OFFSET(http_opts),
AV_OPT_TYPE_DICT, { .str = NULL }, 0, 0, E },

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

+    { "update_period", "Set the mpd update interval",
OFFSET(update_period),AV_OPT_TYPE_INT,{ .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
},

     { NULL },

-- 

2.17.1

 



More information about the ffmpeg-devel mailing list