From: Michael Niedermayer <[email protected]>

mp3 packets all have the same duration and number of samples
if their duration indicated in the container varies then thats an
indication that they are not 1 mp3 packet each.

Bug-id: ffmpeg ticket #4938 / bugzilla 899

Signed-off-by: Vittorio Giovara <[email protected]>
---
 libavformat/mov.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 95dc1ee..d9183f7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2513,6 +2513,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
         break;
     }
 
+    // If mp3 packets have a non constant duration, they could need a parser
+    if (st->codec->codec_id == AV_CODEC_ID_MP3 &&
+        sc->stts_count > 3 &&
+        sc->stts_count * 10 > st->nb_frames &&
+        sc->time_scale == st->codec->sample_rate) {
+        st->need_parsing = AVSTREAM_PARSE_FULL;
+    }
     /* Do not need those anymore. */
     av_freep(&sc->chunk_offsets);
     av_freep(&sc->stsc_data);
-- 
1.9.5 (Apple Git-50.3)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to