wma: Defer decoding until two data blocks are available.
authorAndre Noll <maan@systemlinux.org>
Sat, 30 Jan 2010 13:07:03 +0000 (14:07 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 30 Jan 2010 13:07:03 +0000 (14:07 +0100)
This avoids buffer underruns caused by frames that span two blocks.

wmadec_filter.c

index d78c72b..96fb500 100644 (file)
@@ -1255,11 +1255,12 @@ next_buffer:
                        fn->min_iqs += 4096;
                        goto next_buffer;
                }
-               fn->min_iqs = WMA_FRAME_SKIP + pwd->ahi.block_align;
+               fn->min_iqs = 2 * (WMA_FRAME_SKIP + pwd->ahi.block_align);
                fn->private_data = pwd;
                converted = pwd->ahi.header_len;
                goto success;
        }
+       fn->min_iqs = WMA_FRAME_SKIP + pwd->ahi.block_align;
        for (;;) {
                char *out;
                int out_size = WMA_OUTPUT_BUFFER_SIZE;