shithub: choc

Download patch

ref: 52228a0b81e919879afdd23ae82794cdfe621f84
parent: 7859a115019d7311436fb540ad07bcfb933a7e30
author: Simon Howard <[email protected]>
date: Tue Feb 12 17:16:12 EST 2008

Add comment.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1084

--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -111,7 +111,9 @@
     src_data.input_frames = length;
     src_data.data_in = malloc(length * sizeof(float));
     src_data.src_ratio = (double)mixer_freq / samplerate;
-    src_data.output_frames = src_data.src_ratio * length + 48000;
+
+    // We include some extra space here in case of rounding-up.
+    src_data.output_frames = src_data.src_ratio * length + (mixer_freq / 4);
     src_data.data_out = malloc(src_data.output_frames * sizeof(float));
 
     assert(src_data.data_in != NULL && src_data.data_out != NULL);