From paul@sladen.org Mon Sep 25 18:26:02 2006 +0100 Return-Path: From: Fabian Franz To: Pete Wyckoff Subject: Re: [PATCH] Audio Forward Rewrite Date: Mon, 25 Sep 2006 19:25:38 +0200 Cc: Paul Sladen , Gian Filippo Pinzari , Kurt Pfeifle , Kor Nielsen , Ken@Freespire.org Am Montag, 25. September 2006 17:34 schrieben Sie: > FabianFranz@gmx.de wrote on Sat, 23 Sep 2006 05:24 +0200: > > Pete, could you take a quick view on the new code? > > > > And what are the next steps about going for integration into the > > mainstream kernel? > > > > Send a message to kernel mailinglist? Or should I find someone to > > review/discuss it first? > > Looks like a good first start. There are many code issues that will > scare the kernel developers, however, so I suggest you find some > friendly audio developers first who will help you along. That is a great idea! I have some friends at Novell and know some audio developers from there yearly conference. > > Expect > them not to understand what you're talking about at first. They > will want clear answers to the same questions I raised a while back > (and that Paul gave his thoughts on): > > - What is the point of this code? Forward a device to userspace and FUSE is already in the kernel. > - Why not just directly do: esddsp legacy_app? Because it does not work with all applications and is considered a HACK. Because a user might be running jack instead of esd, or another might be using and it should all be transparent. > - Can you fix the existing in-kernel OSS emulator instead? Nope, that is absolutely impossible. Alsa does software mixing on a library-level. This means different users can't access the soundcard through the dmix level at the same time. That were good questions though. > > Feel free to repackage and rename this into your own thing (it's not > so much a remote-machine forwarder anymore, as was the original > design). Sure, I'll use the name fakeaudio as that is what it is. > Such legacy may confuse others. There's no need to work > in diffs on my old tree, as you don't need most of what's in there > and have rewritten the kernel module. Okay. > You can credit me somewhere > with the initial idea and implementation, but it's really all yours > now. Sure, I'll do. I still use parts of your protocol. :-) To keep this on topic, I attached the new tarball fakeaudio-0.1 and put the author of oss2jack into the cc, which does use fusd.o another inofficial kernel module, which can forward devices to userspace. What has changed since the first release: - I've measured latency and found out that it is very _slow_: * I've changed from socketpair() to pipe() and the time was cut in half. * I've used a separate channel for data and I'm now down to the latency of a fifo / pipe. - Latency will be even more improved with kernel >= 2.6.17, because of the new zero-copy implementation of pipes()! I've found a way to fork() processes on demand using the select system call, but it is not yet implemented. (So you only have to pre-fork 2 processes) - I've made another esd patch, which adds blocking support to esddsp * This means frozen-bubble for example works without the problematic esd delay and almost have 0 latency! * While non-blocking applications like mplayer can benefit from the implementation of the ODELAY ioctl. -> Improved ESD support is important for the nxfwd implementation. - I've patched oss2jack to a oss2jackdsp so it can be used with fakeaudio as well. * Latency is best with that. And even much better than with jackdsp. * mplayer for example, which is very sensitive to latency, works perfectly I've attached a new tarball, the patches to esd and my communication with oss2jack author including oss2jack patch. There are simple usage instructions in the README in the tarball. cu Fabian -- *** Consulting - Training - Workshops - Troubleshooting *** @@@ LiveCDs (Knoppix), Debian, Remote Desktop Access (FreeNX) @@@ --- Fabian Franz --- www.fabian-franz.de --- consulting@fabian-franz.de To: Kor Nielsen Subject: [PATCH] oss2jack dsp wrapper - aka LD_PRELOAD Date: Sun, 24 Sep 2006 15:28:43 +0200 Hi, I was working on my own implementation of a very simple fusd like device (before ever hearing of oss2jack and fusd), when I stumbled across it, while searching for applications I need to support. As I wanted to measure performance against esddsp, artsdsp, jackdsp, fusd and oss2jack, I needed oss2jack to work in a LD_PRELOAD like mode. Done now. Performance (best measured with frozen-bubble, lol) is best with oss2jack.so. Congratulations on a very fine program. (jackdsp has a slightly worse latency) My kernel module at the moment sucks (1 sec of latency), because it uses sockets for communication, while fusd uses in-kernel-memory. I however am trying a new attempt with pipes, which should be very fast and even faster with 2.6.18 (using the splice() mechanism). Why a new kernel module? Uhm, I started working on it, and it was fun, so its my toy ;-). And the module is so simple (currently 609 lines) that I want to try inclusion into the kernel ... or get flamed away ... ;-) Anyway as a side-effect you can strike one item off your TODO list. ;-) Here are instructions how to build it: - Apply patch gcc -DOSS2JACK_WRAPPER -DHAVE_CONFIG_H -I. -I. -I../.. -g -O2 -c oss2jack.c -o oss2jacko.o # Use another name for the .o file build with the wrapper gcc -DHAVE_CONFIG_H -I. -I. -I../.. -g -O2 -c oss2jackdsp.c gcc -shared -g -O2 -o oss2jack.so -ljack oss2jacko.o mixer.o dsp.o \ cb.o oss.o oss2jackdsp.o -lsamplerate # build a shared library with oss2jackdsp.o and oss2jacko.o LD_PRELOAD=./oss2jack.so mpg123 -o oss enjoy.mp3 That's all. Development: All I had to do was wrap the fusd_return functions in my .o file and add some simple fusd compatibility layer using the pthread functionality. Limitations: - Single threaded apps only for now -> Doing two writes from different threads to the same fd will fail. - No mmap support yet, as I could not find out how to map the syscall to the do_mmap_open function and it has low priority. - I have no idea how to put the above commands into a Makefile ... Enjoy! cu Fabian PS: I am a quite frequent contributor to esddsp, so I know that stuff and used it as a basis for oss2jackdsp.c. -- *** Consulting - Training - Workshops - Troubleshooting *** @@@ LiveCDs (Knoppix), Debian, Remote Desktop Access (FreeNX) @@@ --- Fabian Franz --- www.fabian-franz.de --- consulting@fabian-franz.de