You are not logged in.

#1 2013-01-14 06:01:08

PowerTap
Member
Registered: 2013-01-14
Posts: 5

[Solved] PulseAudio and AirPlay

BLUF: Issued is solved if not resolved.  Last poster notes that PulseAudio ROAP only support TCP connections and AppleTV does its magic through UDP.  There appear to be solutions in the works, but for now I'm not going to attempt implementation in order to spend my time on other things.  Thanks for the help and input.

----Original post----

I'm attempting to transmit sound from my laptop to my AppleTV so that I can output it through my sound system in the living room.  I understand that this is doable with PulseAudio and Avahi for discovery, but I have not been able to get it to work.

My setup is as follows:
Computer: Late 2010 Mac Book Air
AppleTV (works fine in when I boot to Mac or use my girlfriend's Mac to stream)

I'm using XFCE as my primary window manager and have Clementine and Banshee installed (not sure which I prefer).  I've also got Gnome installed (also testing the water on two fronts).

I've read through the PulseAudio, Sound wiki entries and have not found a solution.

Local audio works just fine, so I believe that I have my local audio configuration set up correctly.  I've run paprefs and checked the two network access boxes.  After restarting PulseAudio with

 pulseaudio -k

, I'm able to see the AppleTV as an output device in

pavucontrol

When I open Clementine for audio and then open the Pulse Audio Volume Control I can select the output sink for that program individually and set it for AppleTV, but I get no sound and Clementine stops playing.  When I stay it stops playing, I mean that not only does the sound stop but I stop seeing the equalizer visualization at the bottom of the screen stops moving, which indicates to me that the audio system knows that it is not successfully connected to the AppleTV and that no sound is being pushed.

When I open Banshee I get a similar behavior, but I don't have the fancy visualization to tell if sound is being pushed but not received.

There is clearly a problem with the RTSP system as my output from the pulseaudio command includes the following:

E: [pulseaudio] rtsp_client.c: Assertion 'c->url' failed at modules/rtp/rtsp_client.c:404, function rtsp_exec(). Aborting.

I'm not sure if that means that I'm missing something, have something misconfigured, or have found a genuine bug (I know, least likely case).

My /etc/pulse/default.pa file read like this:

#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.nofail

### Load something into the sample cache
#load-sample-lazy x11-bell /usr/share/sounds/gtk-events/activate.wav
#load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-access /usr/share/sounds/generic.wav

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
.nofail
load-module module-console-kit
.fail
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

### Load DBus protocol
.ifexists module-dbus-protocol.so
load-module module-dbus-protocol
.endif

# X11 modules should not be started from default.pa so that one daemon
# can be shared by multiple sessions.

### Load X11 bell module
#load-module module-x11-bell sample=bell-windowing-system

### Register ourselves in the X11 session manager
#load-module module-x11-xsmp

### Publish connection data in the X11 root window
#.ifexists module-x11-publish.so
#.nofail
#load-module module-x11-publish
#.fail
#.endif

load-module module-switch-on-port-available

### Make some devices default
#set-default-sink output
#set-default-source input
load-module module-equalizer-sink

Please tell me what other information I can provide to help figure this out.  I'm still figuring out the sound architecture so, it is quite possible I'm missing something obvious.

Thanks,
Andy

Last edited by PowerTap (2013-01-25 04:39:53)

Offline

#2 2013-01-14 07:36:41

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: [Solved] PulseAudio and AirPlay

I do not use AirPlay and hence can't answer your question, but the way in which this question was asked makes it unsuitable for the Newbie Corner, even if you ARE very recent to Arch. Lots of detail and trouble-shooting already done, so I'm moving to the Multimedia Forum.

Also, the pulseaudio mailing list would probably be a better place for this question, if noone answers you here.

EDIT: now I realize I forgot my pulseaudio troubleshooting 101 - please kill and restart pulseaudio with -vvvv

Last edited by ngoonee (2013-01-14 07:45:55)


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2013-01-14 19:31:45

PowerTap
Member
Registered: 2013-01-14
Posts: 5

Re: [Solved] PulseAudio and AirPlay

I did some more reading/working on this and I've found here and I've produced some more extensive logging in order to help figure things out.

I think probably the problem is related to these warnings:

(   0.419|   0.322) D: [pulseaudio] module-raop-discover.c: Found RAOP: Apple TV
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'txtvers' with value: '1'
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'ch' with value: '2'
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'cn' with value: '0,1,2,3'
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'da' with value: 'true'
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'et' with value: '0,3,5'
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'ft' with value: '0xA7FCA00'
(   0.419|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'md' with value: '0,1,2'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'pw' with value: 'false'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'pk' with value: 'd23d01bf7a1c392b6d15bb3a870a3624bd018f70c99ab44e00346651ca340a29'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'sv' with value: 'false'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'sr' with value: '44100'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'ss' with value: '16'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'tp' with value: 'UDP'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'vn' with value: '65537'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'vs' with value: '150.35'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'vv' with value: '1'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'am' with value: 'AppleTV2,1'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Found key: 'sf' with value: '0x4'
(   0.420|   0.000) D: [pulseaudio] module-raop-discover.c: Loading module-raop-sink with arguments 'server=[192.168.1.2]:5000 sink_name=raop.Apple-TV.local sink_properties='device.description="Apple TV"''
(   0.423|   0.003) I: [pulseaudio] sink.c: Created sink 2 "raop.Apple-TV.local" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
(   0.423|   0.003) I: [pulseaudio] sink.c:     device.string = "[192.168.1.2]:5000"
(   0.423|   0.003) I: [pulseaudio] sink.c:     device.intended_roles = "music"
(   0.423|   0.003) I: [pulseaudio] sink.c:     device.description = "Apple TV"
(   0.423|   0.003) I: [pulseaudio] sink.c:     device.icon_name = "audio-card"
(   0.424|   0.000) D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
(   0.424|   0.000) I: [pulseaudio] source.c: Created source 2 "raop.Apple-TV.local.monitor" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
(   0.424|   0.000) I: [pulseaudio] source.c:     device.description = "Monitor of Apple TV"
(   0.424|   0.000) I: [pulseaudio] source.c:     device.class = "monitor"
(   0.424|   0.000) I: [pulseaudio] source.c:     device.icon_name = "audio-input-microphone"
(   0.424|   0.000) D: [pulseaudio] rtsp_client.c: Attempting to connect to server '192.168.1.2:5000'
(   0.424|   0.000) D: [raop-sink] module-raop-sink.c: Thread starting up
(   0.425|   0.000) D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Device added for object /org/pulseaudio/core1/source2
(   0.425|   0.000) D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Source added for object /org/pulseaudio/core1/source2
(   0.425|   0.000) D: [pulseaudio] module-device-restore.c: Could not set format on sink raop.Apple-TV.local
(   0.425|   0.000) D: [pulseaudio] module-suspend-on-idle.c: Sink raop.Apple-TV.local becomes idle, timeout in 5 seconds.
(   0.425|   0.000) D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Device added for object /org/pulseaudio/core1/sink2
(   0.425|   0.000) D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Sink added for object /org/pulseaudio/core1/sink2
(   0.425|   0.000) I: [pulseaudio] module.c: Loaded "module-raop-sink" (index: #30; argument: "server=[192.168.1.2]:5000 sink_name=raop.Apple-TV.local sink_properties='device.description="Apple TV"'").
(   0.426|   0.000) D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Module added for object /org/pulseaudio/core1/module30
(   0.620|   0.194) D: [pulseaudio] rtsp_client.c: Established RTSP connection from local ip 192.168.1.12
(   0.620|   0.000) D: [pulseaudio] raop_client.c: RAOP: CONNECTED
(   0.621|   0.000) D: [pulseaudio] rtsp_client.c: Sending command: ANNOUNCE
(   0.629|   0.007) D: [pulseaudio] rtsp_client.c: Full response received. Dispatching
(   0.629|   0.000) D: [pulseaudio] raop_client.c: RAOP: ANNOUNCED
(   0.629|   0.000) D: [pulseaudio] rtsp_client.c: Sending command: SETUP
(   0.639|   0.010) W: [pulseaudio] rtsp_client.c: Unexpected response: RTSP/1.0 500 Internal Server Error
(   0.639|   0.000) W: [pulseaudio] rtsp_client.c: Unexpected response: Content-Length: 0
(   0.639|   0.000) W: [pulseaudio] rtsp_client.c: Unexpected response: Server: AirTunes/150.35
(   0.639|   0.000) W: [pulseaudio] rtsp_client.c: Unexpected response: CSeq: 2
(   0.639|   0.000) W: [pulseaudio] rtsp_client.c: Unexpected response: 
(   5.094|   4.454) I: [pulseaudio] module-suspend-on-idle.c: Sink combined.equalizer idle for too long, suspending ...
(   5.094|   0.000) D: [pulseaudio] sink.c: Suspend cause of sink combined.equalizer is 0x0004, suspending
(   5.094|   0.000) D: [combine] sink-input.c: Requesting rewind due to corking

Also the AppleTV is running version 5.1.1 if that helps at all.

Again thanks for any help that I can get.

Offline

#4 2013-01-20 15:21:02

Whatever
Member
Registered: 2013-01-20
Posts: 1

Re: [Solved] PulseAudio and AirPlay

The problem is that Pulseaudio's RAOP module only supports streaming over TCP, whereas the Apple TV (and most other AirPlay receivers) only supports UDP streams (see the AirTunes spec).

Since Pulseaudio doesn't send the expected header during the SETUP phase (instead, since it only supports TCP streams, it sends "Transport: RTP/AVP/TCP;..."), the AppleTV responds with a server error - which you can see in your log.

Unfortunately, until someone adds UDP support to Pulseaudio's RAOP module, you (and I tongue) are probably out of luck.

Edit: Just discovered RAOP Play, which seems to support UDP, might give this a try later.
Edit2: There's also pulseaudio-raop2, which is a Pulseaudio module for RAOP over UDP.

Last edited by Whatever (2013-01-20 15:34:18)

Offline

Board footer

Powered by FluxBB