aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/sound
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2005-12-04 20:56:26 +0000
committerCarsten Weisse <[email protected]>2005-12-04 20:56:26 +0000
commit8878d362d774a1ac1be66ee20a753132b1c0ebe2 (patch)
tree0a1282c1b7a8ac2143fa23b544b2a5b36d8ca84c /src/jake2/sound
parentee4966164662c9d95d067c0635cae2c5c39e59d8 (diff)
avoid stream queue overrun
Diffstat (limited to 'src/jake2/sound')
-rw-r--r--src/jake2/sound/joal/Channel.java4
-rw-r--r--src/jake2/sound/lwjgl/Channel.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/jake2/sound/joal/Channel.java b/src/jake2/sound/joal/Channel.java
index 8a26587..20d9d83 100644
--- a/src/jake2/sound/joal/Channel.java
+++ b/src/jake2/sound/joal/Channel.java
@@ -3,7 +3,7 @@
*
* Copyright (C) 2003
*
- * $Id: Channel.java,v 1.5 2005-12-04 17:28:48 cawe Exp $
+ * $Id: Channel.java,v 1.6 2005-12-04 20:56:26 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -202,6 +202,8 @@ public class Channel {
buffer[0] = buffers[Sound.MAX_SFX + streamQueue++];
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
} else if (processed < 2) {
+ // check queue overrun
+ if (streamQueue >= Sound.STREAM_QUEUE) return;
buffer[0] = buffers[Sound.MAX_SFX + streamQueue++];
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
} else {
diff --git a/src/jake2/sound/lwjgl/Channel.java b/src/jake2/sound/lwjgl/Channel.java
index 8601aec..c4ab42d 100644
--- a/src/jake2/sound/lwjgl/Channel.java
+++ b/src/jake2/sound/lwjgl/Channel.java
@@ -3,7 +3,7 @@
*
* Copyright (C) 2003
*
- * $Id: Channel.java,v 1.7 2005-12-04 17:27:34 cawe Exp $
+ * $Id: Channel.java,v 1.8 2005-12-04 20:56:26 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -204,6 +204,8 @@ public class Channel {
buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++));
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
} else if (processed < 2) {
+ // check queue overrun
+ if (streamQueue >= Sound.STREAM_QUEUE) return;
buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++));
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
} else {