]> git.sesse.net Git - ffmpeg/commitdiff
mov: fix seek to next root atom in fragmented mp4
authorJohn Stebbins <jstebbins@jetheaddev.com>
Sun, 29 Mar 2020 20:32:45 +0000 (13:32 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 11 Apr 2020 16:15:58 +0000 (18:15 +0200)
If some but not all moof's are referenced in an sidx, whole fragments
were being skipped.

Fixes tickets 7377, 7389, and 8502

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 32f51e6a4cd252ca2848d988c943d643cbf85ca6..eb9a8714a0415f94a8773054e29f41d126f2edbd 100644 (file)
@@ -7734,7 +7734,8 @@ static int mov_switch_root(AVFormatContext *s, int64_t target, int index)
     mov->next_root_atom = 0;
     if (index < 0 || index >= mov->frag_index.nb_items)
         index = search_frag_moof_offset(&mov->frag_index, target);
-    if (index < mov->frag_index.nb_items) {
+    if (index < mov->frag_index.nb_items &&
+        mov->frag_index.item[index].moof_offset == target) {
         if (index + 1 < mov->frag_index.nb_items)
             mov->next_root_atom = mov->frag_index.item[index + 1].moof_offset;
         if (mov->frag_index.item[index].headers_read)