foxygit / doom Log in
commit 52228a0b81e919879afdd23ae82794cdfe621f84
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Tue Feb 12 22:16:12 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Tue Feb 12 22:16:12 2008 +0000

    Add comment.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1084
---
 src/i_sdlsound.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index 923b5df0..54799ac3 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -111,7 +111,9 @@ static void ExpandSoundData_SRC(byte *data,
     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);