static void wmadec_post_select(__a_unused struct sched *s, struct task *t)
{
struct filter_node *fn = container_of(t, struct filter_node, task);
- int ret, converted;
+ int ret, converted, out_size;
struct private_wmadec_data *pwd = fn->private_data;
struct btr_node *btrn = fn->btrn;
size_t len;
- char *in;
+ char *in, *out;
next_buffer:
converted = 0;
goto success;
}
fn->min_iqs = WMA_FRAME_SKIP + pwd->ahi.block_align;
- for (;;) {
- char *out;
- int out_size = WMA_OUTPUT_BUFFER_SIZE;
- if (converted + fn->min_iqs > len)
- break;
- out = para_malloc(WMA_OUTPUT_BUFFER_SIZE);
- ret = wma_decode_superframe(pwd, out,
- &out_size, (uint8_t *)in + converted + WMA_FRAME_SKIP,
- len - WMA_FRAME_SKIP);
- if (ret < 0) {
- free(out);
- goto err;
- }
- btr_add_output(out, out_size, btrn);
- converted += ret + WMA_FRAME_SKIP;
+ if (fn->min_iqs > len)
+ goto success;
+ out_size = WMA_OUTPUT_BUFFER_SIZE;
+ out = para_malloc(out_size);
+ ret = wma_decode_superframe(pwd, out, &out_size,
+ (uint8_t *)in + WMA_FRAME_SKIP, len - WMA_FRAME_SKIP);
+ if (ret < 0) {
+ free(out);
+ goto err;
}
+ out = para_realloc(out, out_size);
+ if (out_size > 0)
+ btr_add_output(out, out_size, btrn);
+ converted += ret + WMA_FRAME_SKIP;
success:
btr_consume(btrn, converted);
return;