changeset in /hg/icedtea: 2008-12-02 Omair Majid <omajid at redha...

Omair Majid omajid at redhat.com
Thu Dec 4 06:11:29 PST 2008


changeset 8bf089d06e19 in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=8bf089d06e19
description:
	2008-12-02  Omair Majid  <omajid at redhat.com>

	    This patch reduces visibility of classes and prevents inheritance to
	    reduce any potential security issues. Also adds a few security checks.

	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextEvent.java:
	    Change scope of class and functions from public to package-private.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextListener.java:
	    Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Debug.java:
	    Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java:
	    Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Operation.java:
	    Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java:
	    Change class to be final. Change clip name to 'Audio Clip' and add some
	    documentation and annotations.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java:
	    Change class scope to package-private. Add annoatations to functions.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioLine.java:
	    Add override annotations to functions.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java:
	    Change class to final.
	    (getLine): Check for audio permissions before returning Ports.
	    (openRemote): Check for permissions to connect before connecting to a
	    remote PulseAudio server.
	    (openImpl): New function. Connect to the PulseAudio server.
	    (debug): Removed.
	    (main): Removed
	    (ThreadWriter): Removed.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixerInfo.java:
	    Change class to final. Bump version.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixerProvider.java:
	    (PulseAudioMixerProvider): Removed.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMuteControl.java:
	    Change class to final. Formatting fixes.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java:
	    Change class scope to package private. Make constructor package-private.
	    Add override annotations.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java:
	    Change class to final. Make constructor package-private. Add override
	    annotations.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java:
	    Make class final. Make constructor package-private.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java:
	    Make class final. Add override annotations
	    (PulseAudioTargetDataLine): Make constructor package-private.
	    (fragmentBuffer): Make variable private.
	    (drained): Likewise.
	    (flushed): Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java:
	    Make class final. Constructor now pacakge-private.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java:
	    Make class final.
	    (MIN_VOLUME),
	    (MAX_VOLUME): Make variables pacakge-private.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/SecurityWrapper.java:
	    Make class final.
	    (loadNativeLibrary): Make package-private.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Stream.java:
	    Make class final. Change scope of as many functions from public to
	    package-private as possible.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java:
	    Make class and all functions package-private.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/StreamSampleSpecification.java:
	    Make class package-private.

diffstat:

23 files changed, 517 insertions(+), 411 deletions(-)
ChangeLog                                                                           |   65 ++
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextEvent.java              |   14 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextListener.java           |   10 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Debug.java                     |   22 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java                 |   57 +-
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Operation.java                 |   39 +
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java            |   30 -
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java        |   51 +-
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioLine.java            |    4 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java           |  241 +++-------
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixerInfo.java       |    6 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixerProvider.java   |    4 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMuteControl.java     |   41 -
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java            |   19 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java  |   32 +
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java      |    9 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java  |   37 -
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java      |   12 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java   |    7 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/SecurityWrapper.java           |    8 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Stream.java                    |  204 ++++----
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java    |   14 
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/StreamSampleSpecification.java |    2 

diffs (truncated from 2245 to 500 lines):

diff -r a59dccb92ae7 -r 8bf089d06e19 ChangeLog
--- a/ChangeLog	Wed Dec 03 14:31:01 2008 +0000
+++ b/ChangeLog	Wed Dec 03 10:07:38 2008 -0500
@@ -1,3 +1,68 @@ 2008-12-03  Andrew John Hughes  <gnu_and
+2008-12-02  Omair Majid  <omajid at redhat.com>
+
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextEvent.java:
+	Change scope of class and functions from public to package-private.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextListener.java:
+	Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Debug.java:
+	Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java:
+	Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Operation.java:
+	Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java:
+	Change class to be final. Change clip name to 'Audio Clip' and add some
+	documentation and annotations.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioDataLine.java:
+	Change class scope to package-private. Add annoatations to functions.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioLine.java:
+	Add override annotations to functions.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java:
+	Change class to final.
+	(getLine): Check for audio permissions before returning Ports.
+	(openRemote): Check for permissions to connect before connecting to a
+	remote PulseAudio server.
+	(openImpl): New function. Connect to the PulseAudio server.
+	(debug): Removed.
+	(main): Removed
+	(ThreadWriter): Removed.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixerInfo.java:
+	Change class to final. Bump version.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixerProvider.java:
+	(PulseAudioMixerProvider): Removed.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMuteControl.java:
+	Change class to final. Formatting fixes.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java:
+	Change class scope to package private. Make constructor package-private. 
+	Add override annotations.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java:
+	Change class to final. Make constructor package-private. Add override
+	annotations.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java:
+	Make class final. Make constructor package-private.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java:
+	Make class final. Add override annotations
+	(PulseAudioTargetDataLine): Make constructor package-private.
+	(fragmentBuffer): Make variable private.
+	(drained): Likewise.
+	(flushed): Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java:
+	Make class final. Constructor now pacakge-private.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java:
+	Make class final.
+	(MIN_VOLUME),
+	(MAX_VOLUME): Make variables pacakge-private.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/SecurityWrapper.java:
+	Make class final.
+	(loadNativeLibrary): Make package-private.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Stream.java:
+	Make class final. Change scope of as many functions from public to
+	package-private as possible.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java:
+	Make class and all functions package-private.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/StreamSampleSpecification.java:
+	Make class package-private.
+
 2008-12-03  Andrew John Hughes  <gnu_andrew at member.fsf.org>
 
 	Create hierarchical patch space.
diff -r a59dccb92ae7 -r 8bf089d06e19 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextEvent.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextEvent.java	Wed Dec 03 14:31:01 2008 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextEvent.java	Wed Dec 03 10:07:38 2008 -0500
@@ -37,8 +37,20 @@ exception statement from your version.
 
 package org.classpath.icedtea.pulseaudio;
 
-public class ContextEvent {
+/**
+ * This class encapsulates a change in the PulseAudio's connection context.
+ * 
+ * When this event is fired, something has happened to the connection of this
+ * program to the PulseAudio server.
+ * 
+ */
 
+class ContextEvent {
+
+	/**
+	 *  Basically, what is the new state of the context
+	 * 
+	 */
 	public static enum Type {
 		UNCONNECTED, CONNECTING, AUTHORIZING, SETTING_NAME, READY, FAILED, TERMINATED
 	}
diff -r a59dccb92ae7 -r 8bf089d06e19 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextListener.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextListener.java	Wed Dec 03 14:31:01 2008 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/ContextListener.java	Wed Dec 03 10:07:38 2008 -0500
@@ -37,8 +37,14 @@ exception statement from your version.
 
 package org.classpath.icedtea.pulseaudio;
 
-public interface ContextListener {
+/**
+ * This interface specifies a listener for a change in PulseAudio's context state
+ * eg: the connection to the server becomes ready, fails or ends.
+ *
+ */
 
-	public void update(ContextEvent e);
+interface ContextListener {
+
+	void update(ContextEvent e);
 
 }
diff -r a59dccb92ae7 -r 8bf089d06e19 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Debug.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Debug.java	Wed Dec 03 14:31:01 2008 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Debug.java	Wed Dec 03 10:07:38 2008 -0500
@@ -37,15 +37,25 @@ exception statement from your version.
 
 package org.classpath.icedtea.pulseaudio;
 
-public class Debug {
+/**
+ * 
+ * A simple debugging class. Set the debugging level through the system property
+ * pulseaudio.debugLevel=<Level>. Level is one of Verbose, Debug, Info, Warning,
+ * Error or None
+ * 
+ * and then do DebugLevel.println(level, string) and so on
+ * 
+ */
 
-	public enum DebugLevel {
+class Debug {
+
+	enum DebugLevel {
 		Verbose, Debug, Info, Warning, Error, None
 	}
 
 	private static DebugLevel currentDebugLevel = DebugLevel.None;
 
-	public static void initialize() {
+	static {
 		// System.out.println("PulseAudio: initializing Debug");
 
 		String systemSetting;
@@ -70,11 +80,11 @@ public class Debug {
 		println(DebugLevel.Info, "Using debug level: " + currentDebugLevel);
 	}
 
-	public static void println(String string) {
+	static void println(String string) {
 		println(DebugLevel.Info, string);
 	}
 
-	public static void print(DebugLevel level, String string) {
+	static void print(DebugLevel level, String string) {
 		int result = level.compareTo(currentDebugLevel);
 		if (result >= 0) {
 			if (level.compareTo(DebugLevel.Error) >= 0) {
@@ -87,7 +97,7 @@ public class Debug {
 		}
 	}
 
-	public static void println(DebugLevel level, String string) {
+	static void println(DebugLevel level, String string) {
 
 		int result = level.compareTo(currentDebugLevel);
 		if (result >= 0) {
diff -r a59dccb92ae7 -r 8bf089d06e19 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java	Wed Dec 03 14:31:01 2008 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java	Wed Dec 03 10:07:38 2008 -0500
@@ -39,37 +39,39 @@ package org.classpath.icedtea.pulseaudio
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.Semaphore;
 
 import org.classpath.icedtea.pulseaudio.ContextEvent.Type;
 import org.classpath.icedtea.pulseaudio.Debug.DebugLevel;
 
-/*
- * any methods that can obstruct the behaviour of pa_mainloop should run
- * synchronized
+/**
+ * This class wraps pulseaudio's event loop. It also holds the lock used in the
+ * rest of pulse-java
  * 
  * 
  */
 
-public class EventLoop implements Runnable {
+final class EventLoop implements Runnable {
+
+	/*
+	 * any methods that can obstruct the behaviour of pa_mainloop should run
+	 * synchronized
+	 */
 
 	/*
 	 * the threadLock object is the object used for synchronizing the
 	 * non-thread-safe operations of pulseaudio's c api
 	 */
-	public Object threadLock = new Object();
+	final Object threadLock = new Object();
 
 	private static EventLoop instance = null;
 
 	private List<ContextListener> contextListeners;
 	// private List<SourceDataLine> lines;
-	private String name;
+	private String appName;
 	private String serverString;
 
 	private int status;
 	// private boolean eventLoopIsRunning = false;
-
-	public Semaphore finished = new Semaphore(0);
 
 	private List<String> targetPortNameList = new ArrayList<String>();
 	private List<String> sourcePortNameList = new ArrayList<String>();
@@ -105,27 +107,26 @@ public class EventLoop implements Runnab
 
 	private EventLoop() {
 		contextListeners = new ArrayList<ContextListener>();
-		threadLock = new Object();
-	}
-
-	synchronized public static EventLoop getEventLoop() {
+	}
+
+	synchronized static EventLoop getEventLoop() {
 		if (instance == null) {
 			instance = new EventLoop();
 		}
 		return instance;
 	}
 
-	public void setAppName(String name) {
-		this.name = name;
-	}
-
-	public void setServer(String serverString) {
+	void setAppName(String appName) {
+		this.appName = appName;
+	}
+
+	void setServer(String serverString) {
 		this.serverString = serverString;
 	}
 
 	@Override
 	public void run() {
-		native_setup(this.name, this.serverString);
+		native_setup(this.appName, this.serverString);
 
 		Debug.println(DebugLevel.Info, "Eventloop.run(): eventloop starting");
 
@@ -158,23 +159,23 @@ public class EventLoop implements Runnab
 
 	}
 
-	public void addContextListener(ContextListener contextListener) {
+	void addContextListener(ContextListener contextListener) {
 		synchronized (contextListeners) {
 			contextListeners.add(contextListener);
 		}
 	}
 
-	public void removeContextListener(ContextListener contextListener) {
+	void removeContextListener(ContextListener contextListener) {
 		synchronized (contextListeners) {
 			contextListeners.remove(contextListener);
 		}
 	}
 
-	public int getStatus() {
+	int getStatus() {
 		return this.status;
 	}
 
-	public void update(int status) {
+	void update(int status) {
 		synchronized (threadLock) {
 			// System.out.println(this.getClass().getName()
 			// + ".update() called! status = " + status);
@@ -187,8 +188,10 @@ public class EventLoop implements Runnab
 				fireEvent(new ContextEvent(Type.CONNECTING));
 				break;
 			case 2:
+				// no op
 				break;
 			case 3:
+				// no op
 				break;
 			case 4:
 				fireEvent(new ContextEvent(Type.READY));
@@ -220,17 +223,17 @@ public class EventLoop implements Runnab
 
 	}
 
-	public void setVolume(byte[] streamPointer, int volume) {
+	void setVolume(byte[] streamPointer, int volume) {
 		synchronized (threadLock) {
 			native_set_sink_volume(streamPointer, volume);
 		}
 	}
 
-	public byte[] getContextPointer() {
+	byte[] getContextPointer() {
 		return contextPointer;
 	}
 
-	public byte[] getMainLoopPointer() {
+	byte[] getMainLoopPointer() {
 		return mainloopPointer;
 	}
 
@@ -238,7 +241,7 @@ public class EventLoop implements Runnab
 
 	private native byte[] nativeUpdateSourcePortNameList();
 
-	protected synchronized List<String> updateTargetPortNameList() {
+	synchronized List<String> updateTargetPortNameList() {
 		targetPortNameList = new ArrayList<String>();
 		Operation op;
 		synchronized (this.threadLock) {
diff -r a59dccb92ae7 -r 8bf089d06e19 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Operation.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Operation.java	Wed Dec 03 14:31:01 2008 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/Operation.java	Wed Dec 03 10:07:38 2008 -0500
@@ -37,21 +37,25 @@ exception statement from your version.
 
 package org.classpath.icedtea.pulseaudio;
 
-
-/*
+/**
  * Encapsulates a pa_operation object
  * 
+ * This is really needed only so that we can deallocate the reference counted
+ * object. Any time a function returns an Operation object, the reference has
+ * been incremented. The object wont be freed unless a releaseReference() is
+ * done.
  * 
- * This is really needed only so that we can deallocate the reference counted
+ * Please see the pulseaudio api docs for more information on a pa_opreation
  * object
+ * 
  * 
  * 
  */
 
-public class Operation {
+class Operation {
 
-	byte[] operationPointer;
-	EventLoop eventLoop;
+	private byte[] operationPointer;
+	private EventLoop eventLoop;
 
 	public enum State {
 		Running, Done, Cancelled,
@@ -67,7 +71,7 @@ public class Operation {
 
 	private native int native_get_state();
 
-	public Operation(byte[] operationPointer) {
+	Operation(byte[] operationPointer) {
 		assert (operationPointer != null);
 		this.operationPointer = operationPointer;
 		this.eventLoop = EventLoop.getEventLoop();
@@ -80,14 +84,20 @@ public class Operation {
 		super.finalize();
 	}
 
-	public void addReference() {
+	/**
+	 * Increase reference count by 1
+	 */
+	void addReference() {
 		assert (operationPointer != null);
 		synchronized (eventLoop.threadLock) {
 			native_ref();
 		}
 	}
 
-	public void releaseReference() {
+	/**
+	 * Decrease reference count by 1. If the count reaches 0, object will be freed
+	 */
+	void releaseReference() {
 		assert (operationPointer != null);
 		synchronized (eventLoop.threadLock) {
 			native_unref();
@@ -95,14 +105,15 @@ public class Operation {
 		operationPointer = null;
 	}
 
-	public boolean isNull() {
+	// FIXME broken function
+	boolean isNull() {
 		if (operationPointer == null) {
 			return true;
 		}
 		return false;
 	}
 
-	public State getState() {
+	State getState() {
 		assert (operationPointer != null);
 		int state;
 		synchronized (eventLoop.threadLock) {
@@ -121,7 +132,11 @@ public class Operation {
 
 	}
 
-	public void waitForCompletion() {
+	/**
+	 * Block until the operation has completed
+	 * 
+	 */
+	void waitForCompletion() {
 		assert (operationPointer != null);
 
 		boolean interrupted = false;
diff -r a59dccb92ae7 -r 8bf089d06e19 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Wed Dec 03 14:31:01 2008 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Wed Dec 03 10:07:38 2008 -0500
@@ -44,12 +44,13 @@ import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.Clip;
 import javax.sound.sampled.DataLine;
+import javax.sound.sampled.Line;
 import javax.sound.sampled.LineUnavailableException;
 
 import org.classpath.icedtea.pulseaudio.Debug.DebugLevel;
 import org.classpath.icedtea.pulseaudio.Stream.WriteListener;
 
-public class PulseAudioClip extends PulseAudioDataLine implements Clip,
+public final class PulseAudioClip extends PulseAudioDataLine implements Clip,
 		PulseAudioPlaybackLine {
 
 	private byte[] data = null;
@@ -69,14 +70,18 @@ public class PulseAudioClip extends Puls
 	// the ending frame of the loop
 	private int endFrame = 0;
 
-	public static final String DEFAULT_CLIP_NAME = "Clip";
+	public static final String DEFAULT_CLIP_NAME = "Audio Clip";
 
 	private Object clipLock = new Object();
 	private int loopsLeft = 0;
 
 	// private Semaphore clipSemaphore = new Semaphore(1);
 
-	private class ClipThread extends Thread {
+	/**
+	 * This thread runs
+	 * 
+	 */
+	private final class ClipThread extends Thread {
 		@Override
 		public void run() {
 
@@ -197,16 +202,18 @@ public class PulseAudioClip extends Puls
 		stream.removeWriteListener(writeListener);
 	}
 
-	public PulseAudioClip(AudioFormat[] formats, AudioFormat defaultFormat) {
-		supportedFormats = formats;
+	PulseAudioClip(AudioFormat[] formats, AudioFormat defaultFormat) {
+		this.supportedFormats = formats;
 		this.defaultFormat = defaultFormat;
 		this.currentFormat = defaultFormat;
 		this.volume = PulseAudioVolumeControl.MAX_VOLUME;
+		this.streamName = DEFAULT_CLIP_NAME;
 
 		clipThread = new ClipThread();
 
 	}
 
+	@Override
 	protected void connectLine(int bufferSize, Stream masterStream)
 			throws LineUnavailableException {
 		StreamBufferAttributes bufferAttributes = new StreamBufferAttributes(
@@ -263,9 +270,6 @@ public class PulseAudioClip extends Puls
 	 * 
 	 * drain() on a Clip should block until the entire clip has finished playing
 	 * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4732218
-	 * 
-	 * 
-	 * @see org.classpath.icedtea.pulseaudio.PulseAudioDataLine#drain()
 	 */
 	@Override
 	public void drain() {
@@ -427,22 +431,28 @@ public class PulseAudioClip extends Puls
 



More information about the distro-pkg-dev mailing list