[FFmpeg-cvslog] avformat/mov: Set duration to zero if the duration is UINT_MAX

Sasi Inguva git at videolan.org
Tue Nov 29 13:40:12 EET 2022


ffmpeg | branch: master | Sasi Inguva <isasi at google.com> | Wed Oct 26 12:40:13 2016 -0700| [9d8d7bdffb0e0e229b7d896c2df04a0237e9a243] | committer: James Almer

avformat/mov: Set duration to zero if the duration is UINT_MAX

Fixes some MP4F files which have duration in mdhd set to UINT_MAX instead of zero.

Signed-off-by: Sasi Inguva <isasi at google.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d8d7bdffb0e0e229b7d896c2df04a0237e9a243
---

 libavformat/mov.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1f436e21d6..29bd3103e3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1489,6 +1489,11 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     }
     st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
 
+    if ((version == 1 && st->duration == UINT64_MAX) ||
+        (version != 1 && st->duration == UINT32_MAX)) {
+        st->duration = 0;
+    }
+
     lang = avio_rb16(pb); /* language */
     if (ff_mov_lang_to_iso639(lang, language))
         av_dict_set(&st->metadata, "language", language, 0);



More information about the ffmpeg-cvslog mailing list