[FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets

Rodger Combs rodger.combs at gmail.com
Sat Mar 16 12:24:46 EET 2019


Fixes some files misdetecting as MPEG PS
---
 libavformat/mp3dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index ef884934e1..81da0c6090 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -100,13 +100,13 @@ static int mp3_read_probe(AVProbeData *p)
         max_framesizes = FFMAX(max_framesizes, framesizes);
         if(buf == buf0) {
             first_frames= frames;
-            if (buf2 == end + sizeof(uint32_t))
+            if (buf2 >= end + sizeof(uint32_t))
                 whole_used = 1;
         }
     }
     // keep this in sync with ac3 probe, both need to avoid
     // issues with MPEG-files!
-    if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
+    if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1 + whole_used * FFMIN(first_frames / 2, 5);
     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)
-- 
2.20.1



More information about the ffmpeg-devel mailing list