X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=flacdec_filter.c;h=b51ac3bdee671dba91dc444fdd333126a912677a;hp=09b319a029a5c392a2d1616eb4fc5602be97d1cc;hb=a1beef4331994ddeb9fe0fd9fee363bfb91875e7;hpb=a28eef552dc779eac12c1df430522dc4e20ae428 diff --git a/flacdec_filter.c b/flacdec_filter.c index 09b319a0..b51ac3bd 100644 --- a/flacdec_filter.c +++ b/flacdec_filter.c @@ -25,7 +25,7 @@ struct private_flacdec_data { * We can not consume directly what was copied by the read callback * because we might need to feed unconsumend bytes to the decoder again * after the read callback ran out of data and returned ABORT. So we - * track how many bytes are unconsumed so far. + * track how many bytes have been fed to libflac but are unconsumed so far. */ size_t unconsumed; }; @@ -144,7 +144,7 @@ static FLAC__StreamDecoderWriteStatus write_cb( write_int16_host_endian(outbuffer + 4 * k + 2, right); } } - btr_add_output(outbuffer, n * 4, btrn); + btr_add_output(outbuffer, n * channels * 2, btrn); flac_consume(fn); return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } @@ -222,6 +222,7 @@ static int flacdec_post_select(__a_unused struct sched *s, struct task *t) struct private_flacdec_data *pfd = fn->private_data; struct btr_node *btrn = fn->btrn; int ret; + FLAC__StreamDecoderState state; if (output_queue_full(btrn)) return 0; @@ -240,7 +241,6 @@ static int flacdec_post_select(__a_unused struct sched *s, struct task *t) goto out; } pfd->have_more = false; - FLAC__StreamDecoderState state; FLAC__stream_decoder_process_single(pfd->decoder); state = FLAC__stream_decoder_get_state(pfd->decoder); ret = -E_FLACDEC_EOF;