changeset 1098:654694c101ad

2008-10-14 Ioana Ivan <iivand@redhat.com> * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java (open): startedListener only sends a START event when playback first starts and after an underflow (start): sends a START event if there's data on the line
author Ioana Ivan <iivan@redhat.com>
date Wed, 15 Oct 2008 01:36:05 -0400
parents 17eedb3bbfbd
children bcb125b39f86
files ChangeLog pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java
diffstat 2 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 14 17:08:32 2008 -0400
+++ b/ChangeLog	Wed Oct 15 01:36:05 2008 -0400
@@ -1,3 +1,10 @@
+2008-10-14 Ioana Ivan <iivand@redhat.com>
+
+        * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java
+	  (open): startedListener only sends a START event when playback first
+	  starts and after an underflow
+	  (start): sends a START event if there's data on the line
+
 2008-10-14 Ioana Ivan <iivan@redhat.com>
 
         * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
@@ -6,7 +13,7 @@
 
 2008-10-14 Omair Majid <omajid@redhat.com>
 
-	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java
+	* pulseaudio/src/java/org/classpat/icedtea/pulseaudio/PulseAudioDataLine.java
 	(connect): Removed debug output.
 
 2008-10-14 Omair Majid <omajid@redhat.com>
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java	Tue Oct 14 17:08:32 2008 -0400
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java	Wed Oct 15 01:36:05 2008 -0400
@@ -84,9 +84,9 @@
 		if (isOpen) {
 			throw new IllegalStateException("Line is already open");
 		}
-		
+
 		PulseAudioMixer mixer = PulseAudioMixer.getInstance();
-		if(!mixer.isOpen()) {
+		if (!mixer.isOpen()) {
 			mixer.open();
 		}
 
@@ -205,13 +205,14 @@
 		Stream.PlaybackStartedListener startedListener = new Stream.PlaybackStartedListener() {
 			@Override
 			public void update() {
-				fireLineEvent(new LineEvent(PulseAudioDataLine.this,
-						LineEvent.Type.START, framesSinceOpen));
-
+				if (!dataWritten) {
+					fireLineEvent(new LineEvent(PulseAudioDataLine.this,
+							LineEvent.Type.START, framesSinceOpen));
+					synchronized (this) {
+						this.notifyAll();
+					}
+				}
 				dataWritten = true;
-				synchronized (this) {
-					this.notifyAll();
-				}
 
 			}
 		};
@@ -343,6 +344,10 @@
 			return;
 
 		}
+		if (dataWritten && (!isStarted)) {
+			fireLineEvent(new LineEvent(PulseAudioDataLine.this,
+					LineEvent.Type.START, framesSinceOpen));
+		}
 
 		Operation op;
 		synchronized (eventLoop.threadLock) {
@@ -351,6 +356,9 @@
 
 		op.waitForCompletion();
 		op.releaseReference();
+		synchronized (this) {
+			this.notifyAll();
+		}
 		isStarted = true;
 
 	}