Both the audio and video sidx boxes at the end point to a range corresponding 
to the final mdat atom. Since there is no mfra following the final mdat when 
recording crashes, current logic sets the flag frag_index.complete flag on the 
penultimate sidx atom since it points to the end of the file. Results in 
underreporting duration by ffprobe and libavformat for one of the streams.

Signed-off-by: Anthony Bajoua 
<anthonybaj...@meta.com<mailto:anthonybaj...@meta.com>>
---
libavformat/mov.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 452690090c..36a60cab65 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6150,7 +6150,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
             }
         }

-        c->frag_index.complete = 1;
+        if (offset == 0)
+            c->frag_index.complete = 1;
     }

     return 0;
--
2.49.0


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to