changeset 142:4e1873a3f88f

2008-09-25 Omair Majid <omajid@redhat.com> * src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java (ClipThread.run): Dont let loopsLeft wrap around when looping continuously.
author Omair Majid <omajid@redhat.com>
date Thu, 25 Sep 2008 11:44:25 -0400
parents e29a9eb84a4e
children 9c11cbf114f3
files src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Wed Sep 24 10:51:53 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Thu Sep 25 11:44:25 2008 -0400
@@ -100,7 +100,9 @@
 				} else {
 					synchronized (clipLock) {
 						currentFrame = startFrame;
-						loopsLeft--;
+						if (loopsLeft != Integer.MIN_VALUE) {
+							loopsLeft--;
+						}
 					}
 				}
 
@@ -192,17 +194,20 @@
 
 	}
 
-	protected void connectLine(int bufferSize, Stream masterStream) throws LineUnavailableException{
+	protected void connectLine(int bufferSize, Stream masterStream)
+			throws LineUnavailableException {
 		StreamBufferAttributes bufferAttributes = new StreamBufferAttributes(
 				bufferSize, bufferSize / 2, bufferSize / 2, bufferSize / 2, 0);
 
-		if(masterStream != null) {
+		if (masterStream != null) {
 			synchronized (eventLoop.threadLock) {
-				stream.connectForPlayback(Stream.DEFAULT_DEVICE, bufferAttributes, masterStream.getStreamPointer());
+				stream.connectForPlayback(Stream.DEFAULT_DEVICE,
+						bufferAttributes, masterStream.getStreamPointer());
 			}
 		} else {
 			synchronized (eventLoop.threadLock) {
-				stream.connectForPlayback(Stream.DEFAULT_DEVICE, bufferAttributes, null);
+				stream.connectForPlayback(Stream.DEFAULT_DEVICE,
+						bufferAttributes, null);
 			}
 		}
 	}