diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java | 22 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java | 5 |
2 files changed, 8 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java index a24e77b7d..117be5489 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java @@ -186,28 +186,22 @@ public class JavaSoundAudioSink implements AudioSink { } @Override - public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) { - int byteSize = audioDataFrame.getByteSize(); - final ByteBuffer byteBuffer = audioDataFrame.getData(); - final byte[] bytes = new byte[byteSize]; + public AudioFrame enqueueData(final int pts, final ByteBuffer byteBuffer, final int byteCount) { + final byte[] bytes = new byte[byteCount]; final int p = byteBuffer.position(); - byteBuffer.get(bytes, 0, byteSize); + byteBuffer.get(bytes, 0, byteCount); byteBuffer.position(p); int written = 0; int len; - while (byteSize > 0) { - len = auline.write(bytes, written, byteSize); - byteSize -= len; + int bytesLeft = byteCount; + while (bytesLeft > 0) { + len = auline.write(bytes, written, byteCount); + bytesLeft -= len; written += len; } playImpl(); - return audioDataFrame; - } - - @Override - public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) { - return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount)); + return new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), byteBuffer, byteCount); } @Override diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java index 3aa9d7ab6..7e27f17c3 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java @@ -171,11 +171,6 @@ public class NullAudioSink implements AudioSink { } @Override - public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) { - return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize()); - } - - @Override public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) { if( !initialized || null == chosenFormat ) { return null; |