summaryrefslogtreecommitdiff
path: root/src/lib/resampler.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-14 20:54:49 +0100
committerCarl Hetherington <cth@carlh.net>2016-04-14 20:54:49 +0100
commitcf06e41c179b7aafc6815500c0ec2588eee3a784 (patch)
treef71bff9ecbdad234eb6f4902f12bbedc9a6c2e83 /src/lib/resampler.cc
parent77a0c8bc0f2fb4de080a3301205bb385b0ebddf1 (diff)
On second thoughts, this is a more likely fix for the strange overlap error from the resampler on OS X.
Diffstat (limited to 'src/lib/resampler.cc')
-rw-r--r--src/lib/resampler.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc
index faf07e2a7..39b6cd89d 100644
--- a/src/lib/resampler.cc
+++ b/src/lib/resampler.cc
@@ -139,12 +139,8 @@ Resampler::flush ()
int out_offset = 0;
int64_t const output_size = 65536;
- /* I think this should only need to be 1 long, but I have seen
- src_process error with "input and output data arrays overlap"
- with dummy[1] (on OS X). I've added a few more for luck.
- */
- float dummy[16];
- float buffer[output_size];
+ float dummy[1];
+ float* buffer = new float[output_size];
SRC_DATA data;
data.data_in = dummy;
@@ -156,6 +152,7 @@ Resampler::flush ()
int const r = src_process (_src, &data);
if (r) {
+ delete[] buffer;
throw EncodeError (String::compose (N_("could not run sample-rate converter (%1)"), src_strerror (r)));
}
@@ -172,5 +169,6 @@ Resampler::flush ()
out_offset += data.output_frames_gen;
out->set_frames (out_offset);
+ delete[] buffer;
return out;
}