lavf/amr: Stricter heuristic for auto-detection.

Fixes ticket #7125.
This commit is contained in:
Carl Eugen Hoyos 2018-04-05 00:41:55 +02:00
parent 92fe0bf1e8
commit 233f52fd25
2 changed files with 7 additions and 5 deletions

View File

@ -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;
}

View File

@ -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, \