From cf4d96bb59878c3406ece5d9d6110b35f6c4f15c Mon Sep 17 00:00:00 2001 From: waker Date: Tue, 29 May 2012 22:14:03 +0200 Subject: fixed converter crash on resampling --- plugins/converter/converter.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/converter') diff --git a/plugins/converter/converter.c b/plugins/converter/converter.c index ed276f20..25774bc7 100644 --- a/plugins/converter/converter.c +++ b/plugins/converter/converter.c @@ -940,10 +940,14 @@ convert (DB_playItem_t *it, const char *out, int output_bps, int output_is_float uint16_t outch = fileinfo->fmt.channels; int samplesize = fileinfo->fmt.channels * fileinfo->fmt.bps / 8; - int bs = 10250 * samplesize; - char buffer[bs * 4]; - int dspsize = bs / samplesize * sizeof (float) * fileinfo->fmt.channels; - char dspbuffer[dspsize * 4]; + + // block size + int bs = 2000 * samplesize; + // expected buffer size after worst-case dsp + int dspsize = bs/samplesize*sizeof(float)*8*48; + char buffer[dspsize]; + // account for up to float32 7.1 resampled to 48x ratio + char dspbuffer[dspsize]; int eof = 0; for (;;) { if (eof) { -- cgit v1.2.3