<Sound Dev> SourceDataLine behavior on Linux and Windows

cyberGn0m cy6ergn0m at gmail.com
Thu Oct 15 15:18:20 PDT 2009

DataLine has a different behavior on Linux and Windows. I do not know, it it
a bug or feature... may be documentation is not a full?

So, steps to reproduce:
1. Create and open data line and start() on it.
2. Write data to line in a separate thread.
3. Stop line with a stop() method but do not stop thread from (2).

On Windows:
Thread that writes data to data line will fill line's buffer and then blocks
(sleeps) when buffer reaches full.

On Linux:
Thread that writes data to line will spin around method write and eat CPU,
because stopped line can't be written and write method returns 0  (no bytes
written). This happens before line's buffer reaches full (available() > 0).

Of course workaround present, but this behavior looks strange...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20091016/3013f3d3/attachment.html 

More information about the sound-dev mailing list