From Fedora Project Wiki


OSS Proxy

Summary

OSS Proxy emulates the legacy OSS API for playing sound. It uses CUSE to create device nodes /dev/dsp, /dev/adsp and /dev/mixer, which emulate the legacy OSS API. It then redirects audio sent to these devices to PulseAudio, with a user-mode client.

Owner

  • email: smcnam@gmail.com

Current status

  • Targeted release: Fedora 13
  • Last updated: 09/30/2009
  • Percentage of completion: 5%


Detailed Description

OSS Proxy supports many more legacy OSS applications out of the box than any other OSS emulation solution, such as padsp and aoss. OSS Proxy also supports mmap() based audio I/O on /dev/dsp, which is apparently impossible to emulate purely in userspace. Since /dev/dsp, etc. are real character devices, there is no need to LD_PRELOAD and intercept libc calls, like padsp and aoss do. This is beneficial for performance and compatibility. In addition, some applications claim support for ALSA, but are incompatible with PulseAudio's ALSA<->Pulse plugin. We may not be able to fix all of these, especially proprietary applications. As a workaround, if one of these applications supports OSS as well, then OSS Proxy may enable an audio application that did not work before. It also has the advantage of cooperating with PulseAudio, rather than conflicting with PulseAudio as the in-kernel ALSA snd-pcm-oss module does.

Benefit to Fedora

Existing compatibility packages indicate that Fedora users and developers place value in the ability to support legacy software as Fedora evolves. However, with the evolution of the sound stack, support for legacy OSS applications is limited on Fedora today. CUSE and OSS Proxy are new technologies; this feature asks us to reach forward so that we might better reach back and continue to support these applications.

Scope

1. CUSE support is enabled by default in Fedora 12's kernel, so all changes will be in userspace.

2. We will need to integrate a custom version of libfuse, maintained by Tejun Heo, for CUSE support in userspace. We might rename it libfuse-cuse until CUSE support is merged to upstream libfuse.

3. The build of OSS Proxy itself is fairly straightforward, and produces only two resulting files: the osspd binary, and the ossp-padsp binary. These should go in /usr/bin.

4. osspd, pulseaudio, and the OSS-using client app must all run with the same effective user ID. To provide this functionality out of the box, osspd should run as the user currently logged in.

5. The character devices /dev/cuse, /dev/dsp, /dev/adsp and /dev/mixer need their permissions modified: they should all be chmod 660; /dev/cuse should be chown root:cuse; and the rest should be chown root:audio.

6. Desktop users should belong to the cuse and audio groups to obtain permission to use the devices. Whether we can/should do this automatically is up for discussion.

7. The CUSE module (cuse.ko) must be loaded into the kernel when osspd is first launched.

How To Test

1. Prerequisite: Fedora Rawhide or Fedora 12, and a PulseAudio that can play sound (you can test with e.g. Rhythmbox or paplay)

2. Fedora Packages are not yet available; install osspd from the sources at http://www.kernel.org/pub/linux/kernel/people/tj/ossp/

3. Run modprobe cuse as root

4. Optionally, configure libfuse-cuse (Tejun Heo's custom libfuse 2.8.0-pre2) with a different prefix, such as /opt/ossp.

5. Optionally, create a wrapper script in /usr/bin (and make it executable) like this:

#!/bin/bash
#This file is /usr/bin/osspd, and the real osspd binary is /usr/bin/osspd.bin
export LD_LIBRARY_PATH=/opt/ossp/lib
/usr/bin/osspd.bin ${@}

6. Note: If you do not take both of the above options, your system's libfuse will be overwritten. This results in a downgrade of libfuse's version vs. upstream; Fedora Rawhide currently has libfuse 2.8.1 stable, but Tejun Heo's sources are written against libfuse-2.8.0-pre2.

7. Create groups and add your user to them (you only have to do this once, and run it as root):

groupadd cuse
groupadd audio #The group might already exist; this is OK
usermod -aG cuse YOUR_USER
usermod -aG audio YOUR_USER

8. Now load CUSE, set permissions, and launch osspd by running this:

chmod 660 /dev/dsp /dev/adsp /dev/mixer /dev/cuse  #Run this as root
chown root:cuse /dev/cuse #Run this as root
chown root:audio /dev/adsp /dev/dsp /dev/mixer #Run this as root
osspd #Run this as any user that has an active PulseAudio daemon

9. At this point, /dev/dsp, /dev/adsp and /dev/mixer should exist. If they don't, something went wrong.

10. Now try any application that uses the OSS API. One example would be gst-launch-0.10; install gstreamer-tools and gstreamer-plugins-good, then try this (you should hear sound):

gst-launch-0.10 filesrc location=/path/to/some/audio/file.wav ! decodebin2 ! audioconvert ! audioresample ! osssink device=/dev/dsp

User Experience

Users who choose to enable OSS Proxy using a to-be-determined mechanism will be able to use legacy OSS applications that would not play or record sound before. Additionally, some applications that do not work with ALSA<->Pulse may automatically detect and fallback to using the /dev/dsp device.

Dependencies

Nothing else depends on OSS Proxy, as it is a new package. Installing OSS Proxy does not introduce any conflicting configuration changes to existing packages or files.

Contingency Plan

If OSS Proxy is not integrated, legacy OSS applications will continue to not work. But since OSS Proxy is purely additive, there are no other consequences to omitting this feature.

Documentation

Release Notes

  • OSS Proxy is now included, improving compatibility with legacy applications that use the OSS (Open Sound System) API.

Comments and Discussion