summaryrefslogtreecommitdiff
path: root/libavformat/dashdec.c
diff options
context:
space:
mode:
authorsanil <raut.sanil@gmail.com>2018-08-13 16:53:59 +0800
committerSteven Liu <lq@chinaffmpeg.org>2018-08-13 16:53:59 +0800
commit551a029a181abe2b7b6f16e9631423a12e9fcae9 (patch)
treeded68c9f81166333eb75425c8da0eae9edab581b /libavformat/dashdec.c
parent5423fe29da6bbf28f5253800cace133ac8343a7e (diff)
libavformat/dashdec: Support negative value of the @r attrbute of S in SegmentTimeline element.
The following patch supports parsing negative value of the @r attribute of S in SegmentTimeline element. Example streams: 1. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd 2. http://dash.edgesuite.net/dash264/TestCases/1c/qualcomm/2/MultiRate.mpd
Diffstat (limited to 'libavformat/dashdec.c')
-rw-r--r--libavformat/dashdec.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 573025226e..f851bbf981 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -259,6 +259,12 @@ static int64_t get_segment_start_time_based_on_timeline(struct representation *p
goto finish;
start_time += pls->timelines[i]->duration;
+
+ if (pls->timelines[i]->repeat == -1) {
+ start_time = pls->timelines[i]->duration * cur_seq_no;
+ goto finish;
+ }
+
for (j = 0; j < pls->timelines[i]->repeat; j++) {
num++;
if (num == cur_seq_no)
@@ -1322,7 +1328,12 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
int i = 0;
num = pls->first_seq_no + pls->n_timelines - 1;
for (i = 0; i < pls->n_timelines; i++) {
- num += pls->timelines[i]->repeat;
+ if (pls->timelines[i]->repeat == -1) {
+ int length_of_each_segment = pls->timelines[i]->duration / pls->fragment_timescale;
+ num = c->period_duration / length_of_each_segment;
+ } else {
+ num += pls->timelines[i]->repeat;
+ }
}
} else if (c->is_live && pls->fragment_duration) {
num = pls->first_seq_no + (((get_current_time_in_sec() - c->availability_start_time)) * pls->fragment_timescale) / pls->fragment_duration;