<Sound Dev> Opening multiple output lines
mark at klomp.org
Thu May 8 17:48:17 PDT 2008
On Sun, 2008-05-04 at 19:19 +0200, Mark Wielaard wrote:
> I had the same problem with a similar setup and with applications that
> forget to close a line they don't use anymore (unfortunately this seems
> very common). With the current directaudio backend I don't see how multiple
> lines for the same hardware device could work though. So I am using a
> trick to look for "sloppy" applications. If the last line opened in the
> directaudio device was for the same hardware format then we silence that
> one first so we can hand out a new one. This seems to work surprisingly
> well. And it doesn't seem to interfere with applications that handle the
> hardware formats they need explicitly.
> With gcjwebplugin and this patch we can happily play the vNES games :)
> Of course a real solution would be to import or write a better mixer
> that does share lines properly.
I updated the patch a little to make it all a bit more robust. It splits
the locks, so there is no longer one gaint static one (I shouldn't have
reused the lockNative one and made that static in the original patch).
And it makes sure that all methods that require the nativeLock check the
doIO inside their synchronized block and the lock around nStop() isn't
released before the flag is set. ALSA can actually hang when called on a
pcm you already stopped or closed. This race was already in the code,
since a DataSourceLine could be asynchronously stopped or closed at any
time. My patch just exposed it more easily, because DirectAudioDevice is
the mixer that is now always used by defailt.
2008-05-08 Mark Wielaard <mark at klomp.org>
* patches/icedtea-directaudio-close-trick.patch: Use new static
lockLast for nOpen/nClose guarding. Make lockNative non-static
again. Do all checks before native calls of doIO inside
lockNative guard. Set doIO to false after nClose before dropping
I do think we should write a new MixerProvider based on a modern
soundserver, like pulseaudio. The current DirectAudioDeviceProvider code
cannot easily be extended to provide true software sound mixing. And the
way it opens direct hardware alsa devices means it locks out other
Patch against original code (updated patch file in icedtea6).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7732 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20080509/6050cf18/icedtea-directaudio-close-trick.patch
More information about the distro-pkg-dev