Closed lowfier closed 9 years ago
Thanks for the report – I'm intrigued by it. If you're willing to do a little bit of detective work, I will modify the code slightly to log the actual ANNOUNCE packet, so you can run it agains Whaale and see what's wrong/different about it. I [think I] inherited the code from the original shairport, but it seems I've made Shairport Sync a bit stricter about handling unusual conditions. It will take me a couple of days to get a modified version out, if that's okay.
Sure, if you send me a patch or similar, I'd be happy to recompile and look for differences. Thanks!
Hi there. I've pushed a very small mod in a new branch called "whaale". It won't fix the problem but should help identify what's missing from the whaale ANNOUNCE packet.
Would you be kind enough to download, compile and install it and let me see the output similar to what you showed above with the -vv
option?
Edit: I've just updated the branch to tell me a little more. Could you give it a try please?
Hi Mike, thanks for the modifications. I had very little time to test, but the first thing that was interesting is that it now worked sometimes, and sometimes it didn't. Maybe I should have mentioned that I was using the master branch before (not the development branch). There I nevery had any success. Might just be a coincidence though...
Anyway, I below the output from two tries, one where it worked, and one where it didn't. Interestingly it worked in the case where I got the "ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred". If I have time I will test a bit more tonight. Let me know if you want me to test something in particular.
Output from the NOT working try (music played on the iPad):
pi@kitchenpi:~/shairport-sync/shairport-sync$ sudo /usr/local/bin/shairport-sync -a "Test" -vv
Looking for file "/etc/shairport-sync.conf"
startup
statistics_requester status is 0.
daemon status is 0.
rtsp listening port is 5000.
udp base port is 6001.
udp port range is 100.
Shairport Sync player name is "Test".
Audio Output name is "(null)".
on-start action is "(null)".
on-stop action is "(null)".
wait-cmd status is 0.
mdns backend "(null)".
userSuppliedLatency is 0.
AirPlayLatency is 88200.
iTunesLatency is 99400.
forkedDaapdLatency is 99400.
stuffing option is "0".
resync time is 2205.
allow a session to be interrupted: 0.
busy timeout time is 120.
tolerance is 88 frames.
password is "(null)".
ignore_volume_control is 0.
audio backend desired buffer length is 6615.
audio backend latency offset is 0.
avahi: avahi_register.
avahi: register_service.
Avahi without metadata
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 2.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: application/SDP.
Content-Length: 203.
AESIV missing from ANNOUNCE
RSAAESKEY missing from ANNOUNCE
required params missing from the following ANNOUNCE message:
v=0
o=iTunes 4103132033 0 IN IP4 192.168.1.25
s=iTunes
c=IN IP4 192.168.1.22
t=0 0
m=audio 0 RTP/AVP 96
a=min-latency:11025
a=rtpmap:96 AppleLossless
a=fmtp:96 352 0 16 40 10 14 2 255 0 0 44100
CSeq: 2.
Audio-Jack-Status: connected; type=analog.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
one joined...
new RTSP connection.
CSeq: 3.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 4.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: application/SDP.
Content-Length: 591.
Play connection from "iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1".
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
CSeq: 5.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6001;timing_port=6002.
User-Agent is iTunes 10 or better, (actual version is 11); selecting the iTunes latency of 99400 frames.
rtp_setup: cport=6001 tport=6002.
Connection from IPv4: 192.168.1.25:51949
UDP port chosen: 6001.
UDP port chosen: 6002.
UDP port chosen: 6003.
listening for audio, control and timing on ports 6001, 6002, 6003.
CSeq: 5.
Audio-Jack-Status: connected; type=analog.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6002;timing_port=6003;server_port=6001.
Session: 1.
CSeq: 6.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Session: 1.
Range: npt=0-.
RTP-Info: seq=0;rtptime=0.
CSeq: 6.
Audio-Jack-Status: connected; type=analog.
Audio-Latency: 88200.
CSeq: 4359.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: text/parameters.
Content-Length: 20.
SET_PARAMETER Content-Type:"text/parameters".
received parameters in SET_PARAMETER request.
volume: -19.200001
CSeq: 4359.
Audio-Jack-Status: connected; type=analog.
syncing to seqno 0.
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 2.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
Content-Type: application/SDP.
Content-Length: 203.
Already playing.
CSeq: 2.
Audio-Jack-Status: connected; type=analog.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
Here it worked (music played fine on the Raspberry Pi):
pi@kitchenpi:~/shairport-sync/shairport-sync$ sudo /usr/local/bin/shairport-sync -a "Test" -vv
Looking for file "/etc/shairport-sync.conf"
startup
statistics_requester status is 0.
daemon status is 0.
rtsp listening port is 5000.
udp base port is 6001.
udp port range is 100.
Shairport Sync player name is "Test".
Audio Output name is "(null)".
on-start action is "(null)".
on-stop action is "(null)".
wait-cmd status is 0.
mdns backend "(null)".
userSuppliedLatency is 0.
AirPlayLatency is 88200.
iTunesLatency is 99400.
forkedDaapdLatency is 99400.
stuffing option is "0".
resync time is 2205.
allow a session to be interrupted: 0.
busy timeout time is 120.
tolerance is 88 frames.
password is "(null)".
ignore_volume_control is 0.
audio backend desired buffer length is 6615.
audio backend latency offset is 0.
avahi: avahi_register.
avahi: register_service.
Avahi without metadata
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 2.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
Content-Type: application/SDP.
Content-Length: 203.
AESIV missing from ANNOUNCE
RSAAESKEY missing from ANNOUNCE
required params missing from the following ANNOUNCE message:
v=0
o=iTunes 4103132033 0 IN IP4 192.168.1.25
s=iTunes
c=IN IP4 192.168.1.22
t=0 0
m=audio 0 RTP/AVP 96
a=min-latency:11025
a=rtpmap:96 AppleLossless
a=fmtp:96 352 0 16 40 10 14 2 255 0 0 44100
CSeq: 2.
Audio-Jack-Status: connected; type=analog.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
one joined...
new RTSP connection.
CSeq: 3.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 4.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
Content-Type: application/SDP.
Content-Length: 591.
Play connection from "iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1".
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
CSeq: 5.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6001;timing_port=6002.
User-Agent is iTunes 10 or better, (actual version is 11); selecting the iTunes latency of 99400 frames.
rtp_setup: cport=6001 tport=6002.
Connection from IPv4: 192.168.1.25:51969
UDP port chosen: 6001.
UDP port chosen: 6002.
UDP port chosen: 6003.
listening for audio, control and timing on ports 6001, 6002, 6003.
CSeq: 5.
Audio-Jack-Status: connected; type=analog.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6002;timing_port=6003;server_port=6001.
Session: 1.
CSeq: 6.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
Session: 1.
Range: npt=0-.
RTP-Info: seq=0;rtptime=0.
CSeq: 6.
Audio-Jack-Status: connected; type=analog.
Audio-Latency: 88200.
CSeq: 4359.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 3.
Content-Type: text/parameters.
Content-Length: 20.
SET_PARAMETER Content-Type:"text/parameters".
received parameters in SET_PARAMETER request.
volume: -20.100000
CSeq: 4359.
Audio-Jack-Status: connected; type=analog.
syncing to seqno 0.
Aliasing of buffer index -- reset.
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
Error -32 in delay(): Broken pipe. Delay reported is 0 frames.
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: -6191.
syncing to seqno 771.
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 2.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: application/SDP.
Content-Length: 203.
Already playing.
CSeq: 2.
Audio-Jack-Status: connected; type=analog.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
one joined...
new RTSP connection.
CSeq: 3.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 4.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: application/SDP.
Content-Length: 591.
Already playing.
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
Error -32 in delay(): Broken pipe. Delay reported is 0 frames.
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
Error -32 in delay(): Broken pipe. Delay reported is 0 frames.
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: -6080.
syncing to seqno 1608.
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: 9351.
syncing to seqno 1888.
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 2.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: application/SDP.
Content-Length: 203.
Already playing.
CSeq: 2.
Audio-Jack-Status: connected; type=analog.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
one joined...
new RTSP connection.
CSeq: 3.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 4.
User-Agent: iTunes/11.0.4 (Macintosh; OS X 10.8.4) AppleWebKit/536.30.1.
Client-Instance: 8A12296A465B3CB6.
DACP-ID: 8A12296A465B3CB6.
Active-Remote: 2.
Content-Type: application/SDP.
Content-Length: 591.
Already playing.
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
Thanks for all that. It's really surprising that it works sometimes and not others; I was expecting the AESIV missing from ANNOUNCE
message, and the like, but I wasn't expecting everything to work afterwards. I've downloaded the app, so I'll be able to do a bit more work on it locally.
The move from master
to whaale
branch shouldn't make any particular difference to this issue.
The darned thing works for me on IOS 8, but is limited to one set of speakers unless I pay for it. Could it be that you have different numbers of speakers when you got different results?
Actually, it's doing what it seems to be doing for you, which is good. I'm investigating further – it could be interesting.
I think when I tested it I only used 1 speaker. And I compiled without libsoxr, in case that makes a difference. Let me know if I should test something.
Actually, there may be a slight difference between master
and development
– when Whaale sends an "objectionable" ANNOUNCE, the development version sends back a HTML error code, whereas the master version doesn't. My theory is that Whaale sends a probing ANNOUNCE to see if the player will accept an unencrypted audio stream. If it does, that save processing effort at both ends. If the player returns an error code to the probe, then Whaale sends an ANNOUNCE packet with the data necessary for an encrypted stream. To text this out, I'll try to modify the code in Shairport Sync tomorrow. If this idea turns out to be true, it would be quite a discovery.
Also, Whaale sends strange control packets with the distinguising code d6
or 214, and I don't know what they are for.
Success, I think. Shairport Sync will now, with the latest build from the whaale
branch, recognise and process unencrypted audio streams, such as from Whaale.
However, due to the limitations of Whaale, to get a reliable connection, you should make a couple of other changes:
drift
setting (in the general
section of /etc/shairport-sync.conf
) larger – I set it to 800 frames – to allow for a wider range of variation.audio_backend_buffer_desired_length
setting in the alsa
section something like 22050, i.e. half a second. If you're using a hardware mixer you won't notice any extra delay in response.Please let me know how it works. BTW, I still don't know what those new control packets are for....
I guess the "strange control packets" are retransmit reply packets. Actually it is not d6
but 86
. The most significant bit does not belong to the payload type.
Actually, removing the most significant bit from 0xd6
gives 0x56
, which is a useful clue, thanks. Code 0x56
is an audio packet resend – I've never seen it appear in the control stream, but it does appear often enough in the audio stream. I wonder if it is a bug in the whaale implementation...
I've just pushed another update to the whaale
branch that can cater for retransmitted audio packets being sent in the control stream. I'm pretty sure it shouldn't be happening, but Shairport Sync can now deal with it.
It turns out that Shairport Sync already advertises that it can process unencrypted data, so it's no wonder that "Whaale" was trying to use it!
You're right, removing the MSB from 0xd6
gives 0x56
which is 86
in decimal. Thanks for clarifying this!
Of course. Thanks for the hint – it worked out well.
Thanks a lot for you work, I tested the latest version with Whaale with the parameters you suggested, and it works really well. I just once had the problem that I couldn't connect anymore to one of the two shairport-sync receivers. When I restarted with verbose output (-vv) I couldn't reproduce the problem. I will test some more on the weekend.
Cool! Actually, I learned a few things myself, so thanks again for the report.
I'm not sure if one test user is enough to merge the changes in the main trunk, but I've been using the whaale
branch for a while now, and it seems to work flawlessly.
Thanks for the update! I hope we can do a merge pretty soon.
Hi there,
I was never completely satisfied with the sync of the original shairport, so I thought shairport-sync would be the perfect solution.
However, it does not seem to work with the App I use (Whaale), an iOS App from the App Store specifically for playing on multiple Airplay speakers - so one would think the perfect match for shairport-sync.
When I start playing, I get the following output (when using -vv):
And then the music plays on the iPad instead of the speaker. With the original shairport it works fine, even though I get a similar "WARNING: required params missing from announce". Do you have any idea what could be wrong? Or is there something the developers of the App could change to support shairport-sync? Or anything I can do to test/debug?
Any help would be appreciated! Thanks!