avformat/mp3dec: Require 50% of the file to be mp3 frames in the maxframes>200 probin...
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 12 May 2018 16:33:28 +0000 (18:33 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 20 May 2018 11:17:36 +0000 (13:17 +0200)
This corrects several misdetections of large files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mp3dec.c

index a26714e..d419f8c 100644 (file)
@@ -107,7 +107,7 @@ static int mp3_read_probe(AVProbeData *p)
     // keep this in sync with ac3 probe, both need to avoid
     // issues with MPEG-files!
     if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
-    else if(max_frames>200)return AVPROBE_SCORE_EXTENSION;
+    else if(max_frames>200 && p->buf_size < 2*max_framesizes)return AVPROBE_SCORE_EXTENSION;
     else if(max_frames>=4 && p->buf_size < 2*max_framesizes) return AVPROBE_SCORE_EXTENSION / 2;
     else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size)
                            return p->buf_size < PROBE_BUF_MAX ? AVPROBE_SCORE_EXTENSION / 4 : AVPROBE_SCORE_EXTENSION - 2;