changeset in /hg/pulseaudio: 2008-10-06 Omair Majid <omajid at redh...

Omair Majid omajid at redhat.com
Mon Oct 6 12:42:18 PDT 2008


changeset fa7dd0d762f1 in /hg/pulseaudio
details: http://icedtea.classpath.org/hg/pulseaudio?cmd=changeset;node=fa7dd0d762f1
description:
	2008-10-06 Omair Majid <omajid at redhat.com>

	    * src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
	    (open): Synchronized method.
	    (native_setVolume): Synchronized native method on eventLoop.
	    (setVolume): Synchronized method.
	    (write): Set flushed to false on initialization, and false when handling
	    the flush.
	    (close): Synchronized method.

diffstat:

1 file changed, 20 insertions(+), 16 deletions(-)
src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |   36 +++++-----

diffs (98 lines):

diff -r 86fab9e2bc64 -r fa7dd0d762f1 src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Mon Oct 06 15:30:33 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Mon Oct 06 15:36:55 2008 -0400
@@ -51,7 +51,7 @@ public class PulseAudioSourceDataLine ex
 	private PulseAudioVolumeControl volumeControl;
 	private boolean muted;
 	private float volume;
-	
+
 	boolean flushed = false;
 	boolean drained = false;
 
@@ -67,7 +67,7 @@ public class PulseAudioSourceDataLine ex
 	}
 
 	@Override
-	public void open(AudioFormat format, int bufferSize)
+	synchronized public void open(AudioFormat format, int bufferSize)
 			throws LineUnavailableException {
 
 		super.open(format, bufferSize);
@@ -88,7 +88,9 @@ public class PulseAudioSourceDataLine ex
 	}
 
 	public byte[] native_setVolume(float value) {
-		return stream.native_setVolume(value);
+		synchronized (eventLoop.threadLock) {
+			return stream.native_setVolume(value);
+		}
 	}
 
 	public boolean isMuted() {
@@ -103,7 +105,7 @@ public class PulseAudioSourceDataLine ex
 		return this.volume;
 	}
 
-	public void setVolume(float value) {
+	synchronized public void setVolume(float value) {
 		this.volume = value;
 
 	}
@@ -155,20 +157,22 @@ public class PulseAudioSourceDataLine ex
 
 		int sizeWritten = 0;
 
+		flushed = false;
+
 		boolean interrupted = false;
 
 		while (remainingLength != 0) {
 
 			synchronized (this) {
-				
-				if (!isStarted  || !isOpen) {
+
+				if (!isStarted || !isOpen) {
 					return sizeWritten;
 				}
-				
+
 				if (flushed) {
+					flushed = false;
 					return sizeWritten;
 				}
-				
 
 				synchronized (eventLoop.threadLock) {
 
@@ -264,7 +268,7 @@ public class PulseAudioSourceDataLine ex
 
 		operation.waitForCompletion();
 		operation.releaseReference();
-		
+
 		synchronized (this) {
 			drained = true;
 		}
@@ -287,13 +291,13 @@ public class PulseAudioSourceDataLine ex
 		operation.releaseReference();
 
 		synchronized (this) {
-			flushed= true;
-		}
-		
-	}
-
-	@Override
-	public void close() {
+			flushed = true;
+		}
+
+	}
+
+	@Override
+	synchronized public void close() {
 		if (!isOpen) {
 			throw new IllegalStateException("not open so cant close");
 		}



More information about the distro-pkg-dev mailing list