Commit 68f00fb4 authored by Rodger Combs's avatar Rodger Combs Committed by Michael Niedermayer

lavf/brstm: if the file lies about the last block's size, correct it

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f4be604f
...@@ -369,6 +369,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -369,6 +369,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
size = b->last_block_used_bytes; size = b->last_block_used_bytes;
samples = b->last_block_samples; samples = b->last_block_samples;
skip = b->last_block_size - b->last_block_used_bytes; skip = b->last_block_size - b->last_block_used_bytes;
if (samples < size * 14 / 8) {
uint32_t adjusted_size = samples / 14 * 8;
if (samples % 14)
adjusted_size += (samples % 14 + 1) / 2 + 1;
skip += size - adjusted_size;
size = adjusted_size;
}
} else if (b->current_block < b->block_count) { } else if (b->current_block < b->block_count) {
size = b->block_size; size = b->block_size;
samples = b->samples_per_block; samples = b->samples_per_block;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment