From: Andre Noll Date: Fri, 18 Apr 2014 00:13:08 +0000 (+0000) Subject: aacdec: Decode only one frame per iteration. X-Git-Tag: v0.6.0~7^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=b88ffaddf05d7f4dae85d118a58029ce683c5b3d;p=paraslash.git aacdec: Decode only one frame per iteration. This improves latency and helps to avoid buffer underruns on slow machines. --- diff --git a/aacdec_filter.c b/aacdec_filter.c index 7e3ed80a..e1cf802c 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -86,7 +86,7 @@ static int aacdec_post_select(__a_unused struct sched *s, void *context) struct private_aacdec_data *padd = fn->private_data; int i, ret; char *inbuf, *outbuf, *btrbuf; - size_t len, consumed, loaded; + size_t len, consumed, loaded = 0; NeAACDecFrameInfo frame_info; next_buffer: @@ -142,7 +142,6 @@ next_buffer: if (!frame_info.samples) goto success; btrbuf = para_malloc(2 * frame_info.samples); - loaded = 0; for (i = 0; i < frame_info.samples; i++) { short sh = ((short *)outbuf)[i]; write_int16_host_endian(btrbuf + loaded, sh); @@ -152,7 +151,9 @@ next_buffer: success: btr_consume(btrn, consumed); padd->consumed_total += consumed; - goto next_buffer; + if (loaded == 0) + goto next_buffer; + return 1; err: assert(ret < 0); btr_remove_node(&fn->btrn);