aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/wavdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-09 21:43:06 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-10-24 11:01:33 +0200
commit970109deaf470dae691a90c7e0d65a652a1a2da4 (patch)
treeeddb831129384267d95385eddf6492a113cc7609 /libavformat/wavdec.c
parenteff0bf7defdf36574ad6670643ee032099ec5b71 (diff)
downloadffmpeg-970109deaf470dae691a90c7e0d65a652a1a2da4.tar.gz
avformat/wavdec: Dont trust the fact chunk for PCM
Fixes Ticket3033 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 83fc6c822b06688e572333299927d93eb3c6c426) Conflicts: libavformat/wavdec.c
Diffstat (limited to 'libavformat/wavdec.c')
-rw-r--r--libavformat/wavdec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 87d369912b..2c6b15eeb0 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -368,8 +368,15 @@ break_loop:
avio_seek(pb, data_ofs, SEEK_SET);
- if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id) && wav->data_end <= avio_size(pb))
- sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
+ if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0)
+ if ( st->codec->channels
+ && data_size
+ && av_get_bits_per_sample(st->codec->codec_id)
+ && wav->data_end <= avio_size(pb))
+ sample_count = (data_size << 3)
+ /
+ (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
+
if (sample_count)
st->duration = sample_count;