diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-10-23 04:22:43 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-10-23 12:01:43 +0300 |
commit | 573334da8242a9d1e80572b7bf0979200899565f (patch) | |
tree | 1ef70787c1b829e108c018cd651476c4b1c23d40 | |
parent | a7c5005d7becc3e9b5016af5334ca0f85b2be0b1 (diff) |
avformat/mov: Autodetect mp3s which need parsing
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.
If this autodetection fails for some case then please contact us
and provide a testcase.
Fixes Ticket4938
-rw-r--r-- | libavformat/mov.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 7c90d40f20..487fe0cbe7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3105,6 +3105,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) break; } + // If the duration of the mp3 packets is not constant, then 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); |