Mercurial > hg > pulseaudio
changeset 162:fa7dd0d762f1
2008-10-06 Omair Majid <omajid@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.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Mon, 06 Oct 2008 15:36:55 -0400 |
parents | 86fab9e2bc64 |
children | 6695cbc7fe43 |
files | src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |
diffstat | 1 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ private PulseAudioVolumeControl volumeControl; private boolean muted; private float volume; - + boolean flushed = false; boolean drained = false; @@ -67,7 +67,7 @@ } @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 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 @@ return this.volume; } - public void setVolume(float value) { + synchronized public void setVolume(float value) { this.volume = value; } @@ -155,20 +157,22 @@ 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 @@ operation.waitForCompletion(); operation.releaseReference(); - + synchronized (this) { drained = true; } @@ -287,13 +291,13 @@ operation.releaseReference(); synchronized (this) { - flushed= true; + flushed = true; } - + } @Override - public void close() { + synchronized public void close() { if (!isOpen) { throw new IllegalStateException("not open so cant close"); }