# HG changeset patch # User Omair Majid # Date 1223402902 14400 # Node ID c080309b8eddb18897a4604c1f65e9830ce7dfc3 # Parent d7c213ee671729159d3df7eaa879e0e3224b5ab6 2008-10-07 Omair Majid * src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java (writeFrames): Synchronized the call to notifyAll. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java (addStreamListeners): Likewise. diff -r d7c213ee6717 -r c080309b8edd src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java --- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Tue Oct 07 12:06:29 2008 -0400 +++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Tue Oct 07 14:08:22 2008 -0400 @@ -125,7 +125,9 @@ WriteListener writeListener = new WriteListener() { @Override public void update() { - eventLoop.threadLock.notifyAll(); + synchronized (eventLoop.threadLock) { + eventLoop.threadLock.notifyAll(); + } } }; diff -r d7c213ee6717 -r c080309b8edd src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java --- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java Tue Oct 07 12:06:29 2008 -0400 +++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java Tue Oct 07 14:08:22 2008 -0400 @@ -58,9 +58,8 @@ // true between start() and stop() protected boolean isStarted = false; - //true between a started and an underflow callback + // true between a started and an underflow callback protected boolean dataWritten = false; - // true if a stream has been paused // protected boolean isPaused = false; @@ -161,10 +160,9 @@ Stream.UnderflowListener stoppedListener = new Stream.UnderflowListener() { @Override - public void update() { dataWritten = false; - System.out.println("underflow"); + // always send a STOP event on an underflow (assumption: // an underflow can't happen while the stream is corked) fireLineEvent(new LineEvent(PulseAudioDataLine.this, @@ -176,10 +174,9 @@ Stream.PlaybackStartedListener startedListener = new Stream.PlaybackStartedListener() { @Override public void update() { - System.out.println("started callback"); - - //only send a START event in the beginning and following - //an underflow + + // only send a START event in the beginning and following + // an underflow if (!dataWritten) { fireLineEvent(new LineEvent(PulseAudioDataLine.this, LineEvent.Type.START, framesSinceOpen)); @@ -196,8 +193,9 @@ @Override public void update() { - // System.out.println("can write"); - eventLoop.threadLock.notifyAll(); + synchronized (eventLoop.threadLock) { + eventLoop.threadLock.notifyAll(); + } } }; @@ -207,8 +205,9 @@ @Override public void update() { - - eventLoop.threadLock.notifyAll(); + synchronized (eventLoop.threadLock) { + eventLoop.threadLock.notifyAll(); + } } }; @@ -314,10 +313,9 @@ if (isStarted) { return; - + } - Operation op; synchronized (eventLoop.threadLock) { op = stream.unCork(); @@ -331,7 +329,6 @@ op.releaseReference(); isStarted = true; - } public synchronized void stop() { @@ -427,11 +424,6 @@ public void setName(String streamName) { if (isOpen) { - /* - * Note: setting the name of the stream after it's created wont - * work. In fact, it sets the name of the application! This is a bug - * in PulseAudio 0.9.12 but fixed in git. - */ Operation o; synchronized (eventLoop.threadLock) {