Browse Source

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.8
Rodger Combs Michael Niedermayer 10 years ago
parent
commit
68f00fb40b
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      libavformat/brstm.c

+ 9
- 0
libavformat/brstm.c View File

@@ -369,6 +369,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
size = b->last_block_used_bytes;
samples = b->last_block_samples;
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) {
size = b->block_size;
samples = b->samples_per_block;


Loading…
Cancel
Save