Speculative fix for resampler input/output array overlap error.
[dcpomatic.git] / src / lib / resampler.cc
index 4010390b8e663ebf413efe09ceb10498aace41a2..faf07e2a712d974c6d73da3247ab433c4edf6a8e 100644 (file)
@@ -93,7 +93,15 @@ Resampler::run (shared_ptr<const AudioBuffers> in)
                if (r) {
                        delete[] data.data_in;
                        delete[] data.data_out;
-                       throw EncodeError (String::compose (N_("could not run sample-rate converter (%1)"), src_strerror (r)));
+                       throw EncodeError (
+                               String::compose (
+                                       N_("could not run sample-rate converter (%1) [processing %2 to %3, %4 channels]"),
+                                       src_strerror (r),
+                                       in_frames,
+                                       max_resampled_frames,
+                                       _channels
+                                       )
+                               );
                }
 
                if (data.output_frames_gen == 0) {
@@ -131,7 +139,11 @@ Resampler::flush ()
        int out_offset = 0;
        int64_t const output_size = 65536;
 
-       float dummy[1];
+       /* 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];
 
        SRC_DATA data;