[FFmpeg-cvslog] lavf/amr: Stricter heuristic for auto-detection.
Carl Eugen Hoyos
git at videolan.org
Fri Apr 6 01:22:18 EEST 2018
ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Thu Apr 5 00:41:55 2018 +0200| [233f52fd2534e6844fd5831e3a6c7ca3a1c8fc2d] | committer: Carl Eugen Hoyos
lavf/amr: Stricter heuristic for auto-detection.
Fixes ticket #7125.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=233f52fd2534e6844fd5831e3a6c7ca3a1c8fc2d
---
libavformat/amr.c | 10 ++++++----
libavformat/version.h | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 8b4d736d2f..f954803d46 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -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;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index b55d51c1b7..a96e13bc60 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -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, \
More information about the ffmpeg-cvslog
mailing list