diff mbox

[FFmpeg-devel,4/5] avformat/mp3dec: Require 50% of the file to be mp3 frames in the maxframes>200 probing test

Message ID 20180512163329.18380-4-michael@niedermayer.cc
State Accepted
Commit 81b3e7c9c3ad0cb81c49ad7557041e4cd04bab58
Headers show

Commit Message

Michael Niedermayer May 12, 2018, 4:33 p.m. UTC
This corrects several misdetections of large files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mp3dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer May 19, 2018, 8:18 p.m. UTC | #1
On Sat, May 12, 2018 at 06:33:28PM +0200, Michael Niedermayer wrote:
> This corrects several misdetections of large files
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mp3dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply
please report any cases with CC to me that this makes worse

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index a26714ebaf..d419f8c9fe 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -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;