summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2018-09-05 14:20:52 +0800
committerSteven Liu <lq@chinaffmpeg.org>2018-09-05 14:20:52 +0800
commit8eac027cd14eb507d7d1bddf2606a01e1d118d38 (patch)
treed8c92a988563fe562cf0728b7a6dd7e61067f61e
parente35e91546551a236a1db6266c8e91b6049220337 (diff)
avformat/dashdec: add min_buffer_time process logic
if there have min_buffer_time in playlist, use the min_buffer_time value for realtime. Signed-off-by: Steven Liu <lq@onvideo.cn>
-rw-r--r--libavformat/dashdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index adcdd51dae..91d4e36432 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1343,7 +1343,11 @@ static int64_t calc_cur_seg_no(AVFormatContext *s, struct representation *pls)
if (pls->presentation_timeoffset) {
num = pls->presentation_timeoffset * pls->fragment_timescale / pls->fragment_duration;
} else if (c->publish_time > 0 && !c->availability_start_time) {
+ if (c->min_buffer_time) {
+ num = pls->first_seq_no + (((c->publish_time + pls->fragment_duration) - c->suggested_presentation_delay) * pls->fragment_timescale) / pls->fragment_duration - c->min_buffer_time;
+ } else {
num = pls->first_seq_no + (((c->publish_time - c->time_shift_buffer_depth + pls->fragment_duration) - c->suggested_presentation_delay) * pls->fragment_timescale) / pls->fragment_duration;
+ }
} else {
num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time) - c->suggested_presentation_delay) * pls->fragment_timescale) / pls->fragment_duration;
}