aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/wavdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-08-13 12:14:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-13 12:38:31 +0200
commitacbd78a001e137d37139295ae68753886cea0a04 (patch)
treeefb7779a5948d5f23bfe3af24cb230fe7ba0eb16 /libavformat/wavdec.c
parent4ec4454ccf72ceca06393b4b3759e3412cf885da (diff)
downloadffmpeg-acbd78a001e137d37139295ae68753886cea0a04.tar.gz
avformat/wavdec: Detect wrongly interpreted specification about the sample value in the fact chunk
Fixes Ticket703 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/wavdec.c')
-rw-r--r--libavformat/wavdec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 85e7da6788..666fa31f1a 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -434,6 +434,15 @@ break_loop:
data_size = 0;
}
+ if ( st->codec->bit_rate > 0 && data_size > 0
+ && st->codec->sample_rate > 0
+ && sample_count > 0 && st->codec->channels > 1
+ && sample_count % st->codec->channels == 0) {
+ if (fabs(8.0 * data_size * st->codec->channels * st->codec->sample_rate /
+ sample_count /st->codec->bit_rate - 1.0) < 0.3)
+ sample_count /= st->codec->channels;
+ }
+
if ( data_size > 0 && sample_count && st->codec->channels
&& (data_size << 3) / sample_count / st->codec->channels > st->codec->bits_per_coded_sample + 1) {
av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count);