On second thoughts, this is a more likely fix for the strange overlap error from...
authorCarl Hetherington <cth@carlh.net>
Thu, 14 Apr 2016 19:54:49 +0000 (20:54 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 14 Apr 2016 19:54:49 +0000 (20:54 +0100)
src/lib/resampler.cc

index faf07e2a712d974c6d73da3247ab433c4edf6a8e..39b6cd89d05f103735886d7d51256adfb82e761d 100644 (file)
@@ -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;
 }