Commit 233f52fd authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

lavf/amr: Stricter heuristic for auto-detection.

Fixes ticket #7125.
parent 92fe0bf1
......@@ -178,7 +178,7 @@ AVInputFormat ff_amr_demuxer = {
#if CONFIG_AMRNB_DEMUXER
static int amrnb_probe(AVProbeData *p)
{
int mode, i = 0, valid = 0;
int mode, i = 0, valid = 0, invalid = 0;
const uint8_t *b = p->buf;
while (i < p->buf_size) {
......@@ -197,10 +197,11 @@ static int amrnb_probe(AVProbeData *p)
}
} else {
valid = 0;
invalid++;
i++;
}
}
if (valid > 100)
if (valid > 100 && valid > invalid)
return AVPROBE_SCORE_EXTENSION / 2 + 1;
return 0;
}
......@@ -234,7 +235,7 @@ AVInputFormat ff_amrnb_demuxer = {
#if CONFIG_AMRWB_DEMUXER
static int amrwb_probe(AVProbeData *p)
{
int mode, i = 0, valid = 0;
int mode, i = 0, valid = 0, invalid = 0;
const uint8_t *b = p->buf;
while (i < p->buf_size) {
......@@ -253,10 +254,11 @@ static int amrwb_probe(AVProbeData *p)
}
} else {
valid = 0;
invalid++;
i++;
}
}
if (valid > 100)
if (valid > 100 && valid > invalid)
return AVPROBE_SCORE_EXTENSION / 2 - 1;
return 0;
}
......
......@@ -33,7 +33,7 @@
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
#define LIBAVFORMAT_VERSION_MINOR 11
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment