summaryrefslogtreecommitdiff
path: root/libavformat/dashdec.c
diff options
context:
space:
mode:
authorMatt Robinson <git@nerdoftheherd.com>2021-04-05 18:45:04 +0100
committerSteven Liu <liuqi05@kuaishou.com>2021-04-14 15:28:04 +0800
commitc5ca18fd1b1f8437e52305a5c15226b6f67a2e10 (patch)
treebe9b1b344112fa07df82089ae5988bebac84fd97 /libavformat/dashdec.c
parent4e39cd67b7275dc525684e54d0bd651ef4ee149b (diff)
avformat/dashdec: Also fetch final partial segment
Currently, the DASH demuxer omits the final segment for a non-live stream (using SegmentTemplate) if it is shorter than the other segments. Correct calc_max_seg_no to round up when calulating the number of segments instead of rounding down to resolve this issue. Signed-off-by: Matt Robinson <git@nerdoftheherd.com>
Diffstat (limited to 'libavformat/dashdec.c')
-rw-r--r--libavformat/dashdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 6f3f28dcc7..73effd85db 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1445,7 +1445,7 @@ static int64_t calc_max_seg_no(struct representation *pls, DASHContext *c)
} 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;
} else if (pls->fragment_duration) {
- num = pls->first_seq_no + (c->media_presentation_duration * pls->fragment_timescale) / pls->fragment_duration;
+ num = pls->first_seq_no + av_rescale_rnd(1, c->media_presentation_duration * pls->fragment_timescale, pls->fragment_duration, AV_ROUND_UP);
}
return num;