PulseAudio can stream audio to DLNA / UPnP devices using Rygel.
For Ubuntu 12.04 (Precise) and 12.10 (Quantal) install needed packages.
$ sudo apt-get install rygel pavucontrol paprefs
The following packages also contain useful tools.
$ sudo apt-get install gupnp-tools
Currently Rygel does not autostart on login because of Ubuntu bug #827030. Rygel can be started manually, though.
$ rygel
Load necessary PulseAudio modules.
$ pacmd load-module module-http-protocol-tcp
To make this happen automatically, add the line
load-module module-http-protocol-tcp
to /etc/pulse/default.pa.
Run paprefs, select the "Network Server" tab and enable "Make local sound devices available as DLNA/UPnP Media Server".
Enable the External plugin for Rygel and exporting of the PulseAudio media server by creating a file .config/rygel.conf with the following content:
[External] enabled=true [org.gnome.UPnP.MediaServer2.PulseAudio] enabled=true
Browse the DLNA network on a client device (Android phone, Smart TV, etc.). You will see "Audio on $hostname" -> Output Devices -> Built-in Audio Analogue Stereo (the device name will likely change depending on the audio hardware in your computer). You should hear on your client device whatever is currently being played via that sink.
gst-launch
If the preceding doesn't work then try using the gst-launch plugin. Install the plugin.
$ sudo apt-get install rygel-gst-launch
Run paprefs again and on the "Network Server" tab enable "Create separate audio device for DLNA/UPnP media streaming". This creates a new PulseAudio sink named "upnp" with a monitor named "upnp.monitor".
Enable the plugin by creating a file .config/rygel.conf with content like the following.
[GstLaunch] enabled=true launch-items=myaudioflac myaudioflac-title=FLAC audio on @HOSTNAME@ myaudioflac-mime=audio/flac myaudioflac-launch=pulsesrc device=upnp.monitor ! flacenc
You can specify another format instead, or in addition.
[GstLaunch] enabled=true launch-items=myaudioflac;myaudiompeg myaudioflac-title=FLAC audio on @HOSTNAME@ myaudioflac-mime=audio/flac myaudioflac-launch=pulsesrc device=upnp.monitor ! audio/x-raw,channels=2 ! flacenc myaudiompeg-title=MPEG audio on @HOSTNAME@ myaudiompeg-mime=audio/mpeg myaudiompeg-launch=pulsesrc device=upnp.monitor ! audio/x-raw,channels=2 ! lamemp3enc target=quality quality=6
Restart Rygel.
$ kill -HUP $(pidof rygel)
External DLNA devices should now be able to see "FLAC audio on <hostname>", etc.