summaryrefslogtreecommitdiff
path: root/libavformat/wavdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-09 21:43:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-10-09 22:18:19 +0200
commit83fc6c822b06688e572333299927d93eb3c6c426 (patch)
tree3b8afdf30c70ffc434a44a55746e4a0087a50e4e /libavformat/wavdec.c
parent3aa576513b3173abcd3c5094f90c2a4400647cb9 (diff)
downloadffmpeg-83fc6c822b06688e572333299927d93eb3c6c426.tar.gz
avformat/wavdec: Dont trust the fact chunk for PCM
Fixes Ticket3033 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wavdec.c')
-rw-r--r--libavformat/wavdec.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 9e247e3bb7..ef28349fec 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -403,11 +403,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;