summaryrefslogtreecommitdiff
path: root/plugins/converter
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-05-29 22:14:03 +0200
committerGravatar waker <wakeroid@gmail.com>2012-05-29 22:14:03 +0200
commitcf4d96bb59878c3406ece5d9d6110b35f6c4f15c (patch)
tree580402b38463d4b09224780d565d7fe6b28543dc /plugins/converter
parentf105f91a9194758b43048d4211a5cf4eec3cdf93 (diff)
fixed converter crash on resampling
Diffstat (limited to 'plugins/converter')
-rw-r--r--plugins/converter/converter.c12
1 files changed, 8 insertions, 4 deletions
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) {