On Wed, 6 Dec 2017 17:27:43 +0800 "tiejun.peng" <tiejun.p...@foxmail.com> wrote:
> fix #6895: https://trac.ffmpeg.org/ticket/6895 > stream:https://trac.ffmpeg.org/attachment/ticket/6895/music_mp3 > > Signed-off-by: tiejun.peng <tiejun.p...@foxmail.com> > --- > libavformat/mp3dec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > index a76fe32..286eb68 100644 > --- a/libavformat/mp3dec.c > +++ b/libavformat/mp3dec.c > @@ -73,6 +73,7 @@ static int mp3_read_probe(AVProbeData *p) > int frames, ret; > uint32_t header; > const uint8_t *buf, *buf0, *buf2, *end; > + int match_size = 0; > > buf0 = p->buf; > end = p->buf + p->buf_size - sizeof(uint32_t); > @@ -92,6 +93,7 @@ static int mp3_read_probe(AVProbeData *p) > if (ret != 0) > break; > buf2 += h.frame_size; > + match_size += h.frame_size; > } > max_frames = FFMAX(max_frames, frames); > if(buf == buf0) { > @@ -104,6 +106,8 @@ static int mp3_read_probe(AVProbeData *p) > // issues with MPEG-files! > if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1; > else if(max_frames>200)return AVPROBE_SCORE_EXTENSION; > + // over 50% of probe size is valid > + else if (p->buf_size > 10000 && match_size > (p->buf_size/2)) return > AVPROBE_SCORE_EXTENSION; > else if(max_frames>=4 && max_frames >= p->buf_size/10000) 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; That doesn't necessarily affect whether this patch should be applied, but: I think this mp4 probe should really be cleaned up. It's one of the most complex probe functions, and it doesn't even work correctly. It still detects some ELF files as mp3 (or mp1/2), for example. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel