aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-06-11 02:41:45 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-13 13:08:57 +0200
commit280587b4ab1044529fd99754b928d52a21046802 (patch)
treecd01cc7a3ff05f0a35c84aac323661780c47ae47
parent5bf11223dd8eaee21d0230a285420abc2e248ecf (diff)
downloadandroid_external_ffmpeg-280587b4ab1044529fd99754b928d52a21046802.tar.gz
android_external_ffmpeg-280587b4ab1044529fd99754b928d52a21046802.tar.bz2
android_external_ffmpeg-280587b4ab1044529fd99754b928d52a21046802.zip
avformat/mp3dec: Increase probe score slightly when the whole data from begin to end is mp3
Improves score for 1000-frames-of-noise-encoded-with-lame.mp3 without file extension Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 5fd73948bb684efcadc1f95fd2028b58d675f3ff) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mp3dec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index c76b21ebd6..50bf52cf27 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -64,6 +64,7 @@ static int check(AVIOContext *pb, int64_t pos, uint32_t *header);
static int mp3_read_probe(AVProbeData *p)
{
int max_frames, first_frames = 0;
+ int whole_used = 0;
int frames, ret;
uint32_t header;
const uint8_t *buf, *buf0, *buf2, *end;
@@ -88,8 +89,11 @@ static int mp3_read_probe(AVProbeData *p)
buf2 += h.frame_size;
}
max_frames = FFMAX(max_frames, frames);
- if(buf == buf0)
+ if(buf == buf0) {
first_frames= frames;
+ if (buf2 == end + sizeof(uint32_t))
+ whole_used = 1;
+ }
}
// keep this in sync with ac3 probe, both need to avoid
// issues with MPEG-files!
@@ -98,6 +102,7 @@ static int mp3_read_probe(AVProbeData *p)
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;
+ else if(first_frames > 1 && whole_used) return 5;
else if(max_frames>=1 && max_frames >= p->buf_size/10000) return 1;
else return 0;
//mpegps_mp3_unrecognized_format.mpg has max_frames=3