[FFmpeg-devel] [PATCH 1/2] mov: fix decode of fragments that overlap in time
John Stebbins
jstebbins at jetheaddev.com
Fri Sep 29 18:54:08 EEST 2017
When keyframe intervals of dash segments are not perfectly aligned,
fragments in the stream can overlap in time. Append new "trun" index
entries to the end of the index instead of sorting by timestamp.
Sorting by timestamp causes packets to be read out of decode order and
results in decode errors.
---
libavformat/mov.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 899690d920..c7422cd9ed 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4340,8 +4340,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES));
if (keyframe)
distance = 0;
- ctts_index = av_add_index_entry(st, offset, dts, sample_size, distance,
- keyframe ? AVINDEX_KEYFRAME : 0);
+ ctts_index = add_index_entry(st, offset, dts, sample_size, distance,
+ keyframe ? AVINDEX_KEYFRAME : 0);
if (ctts_index >= 0 && old_nb_index_entries < st->nb_index_entries) {
unsigned int size_needed = st->nb_index_entries * sizeof(*sc->ctts_data);
unsigned int request_size = size_needed > sc->ctts_allocated_size ?
--
2.13.5
More information about the ffmpeg-devel
mailing list