mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-24 02:20:56 +01:00
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
This commit is contained in:
parent
a7c5005d7b
commit
573334da82
1 changed files with 7 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue