Closed PeterPablo closed 8 years ago
[Edit – forget this – it's not relevant to this issue, sorry] Hi Peter. Thanks for this. I guess it's the same as #160. I haven't gotten around to testing this out yet, but i haven't forgotten, promise!
Hi Peter. This is a very interesting bug, as it seems to be caused by the ALAC to PCM code, which I have never even touched. Does it always happen with a particular track from a particular source (e.g. iTunes)? If so, perhaps you'd be kind enough to let me borrow it. My approach would be to stop the crash, not necessarily actually fix it [yet].
Hi Mike, I can reproduce this issue reliably, as I can't use shairport-sync anymore with my laptop. I always connect the system audio to shairport-sync (using the speaker icon ion the toolbar). The crash occurred both when playing from spotify and from VLC. Consequently the issue seems unrelated to the file. I'd say this is either linked to a breaking change in shairport-sync or has something to do with the recent minor update of El Capitan. I could compile an older version, though probably earliest next thursday.
Hi Peter. I'm running Spotify 1.0.19.106 on Mac OS X 10.11.2. I'm not having a lot of joy causing it to fail. Any tricks you'd suggest? Or for VLC 2.2.1? Have you metadata enabled? Any other non-standard settings?
I compiled tag 2.6 and tried to connect from iTunes with verbose output:
shairport-sync -vvv
Looking for the configuration file "/etc/shairport-sync.conf".
Looking for configuration file at full path "/etc/shairport-sync.conf"
Output device name is "default".
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 "my shairport sync".
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 -1.
iTunesLatency is -1.
forkedDaapdLatency is -1.
stuffing option is "0".
resync time is 0.
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.
volume range in dB (zero means use the range specified by the mixer): 0.
configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
metdata enabled is 0.
metadata pipename is "(null)".
get-coverart is 0.
avahi: avahi_register.
avahi: register_service.
Avahi without metadata
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 3588260302.
Apple-Challenge: FoiMmbm4sBSKQWPlQ4nvVw.
Apple-Response: P9TUCfY8LPHPMIpRq9Kmoxqs1QtxjSD4Ws6w9MWWOaa9ffbicI9zQ3xXRWn9ZOGqs7cg4epRUi9hS70MDW1SlET6eTuJSVS9LTtgTcPft8UO/Eti88xMRUYeni82iZuffGuaze03IfbH3tvJCyHGsHb906oyywNMFl33wsWGojw7fYfAO07SeAcw3l9xmxwxOkXx8G4ewyklYThgryoLlOw7dxk9qqtdhDkQqQTNjOZd1/7vosLALYYiiZPuDmidbWBMXE4VA2QMfqvsxQJpgi26mmn9EdAzpW7GqgZ1EtEwZzcVocU1tr8uezZQ1zM2/HjHN62i+mV29LiqH/8qmQ.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
one joined...
new RTSP connection.
CSeq: 1.
Content-Type: application/sdp.
Content-Length: 568.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 3588260302.
Play connection from user agent "iTunes/12.3.2 (Macintosh; OS X 10.11.2)".
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
CSeq: 2.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6001;timing_port=6002.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 3588260302.
Active-Remote string seen: "3588260302".
DACP-ID string seen: "53C333C006EBBB74".
User-Agent is iTunes 10 or better, (actual version is 12); selecting the iTunes latency of -1 frames.
rtp_setup: cport=6001 tport=6002.
Connection from IPv4: 192.168.1.9:61705
listening for audio, control and timing on ports 6001, 6002, 6003.
CSeq: 2.
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: 3.
Session: 1.
Range: npt=0-.
RTP-Info: seq=19936;rtptime=3354798995.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 3588260302.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Audio-Latency: 11025.
syncing to seqno 2331.
FIXME: unhandled predicition type: 2
FIXME: unhandled predicition type: 15
shairport-sync: player.c:247: alac_decode: Assertion `outsize == (4 * frame_size)' failed.
Abgebrochen
Crashes happen also in combination of version 2.6 with Spotify and VLC, when using system audio.
Android is still more or less fine.
I used this config:
grep -v '^//' /etc/shairport-sync.conf
general =
{
name = "my shairport sync"; // This is the name the service will advertise to iTunes. The default is "Shairport Sync on <hostname>"
resync_threshold = 0; // a synchronisation error greater than this will cause resynchronisation; 0 disables it
log_verbosity = 1; // "0" means no debug verbosity, "3" is most verbose.
};
sessioncontrol =
{
};
alsa =
{
};
A freshly compiled development branch works with those configuration parameters ./configure --with-alsa --with-avahi --with-systemd --with-ssl=openssl
.
When you say "works" do you mean "doesn't crash"?
I recompiled with the additional flag --with-metadata
--> works as well.
I recompiled with the additional flags --with-metadata --with-soxr
--> works as well.
Works by the meaning of no crash. hmmm...
Hmm, with --with-soxr
I again received crash, when streaming from my laptop:
RTP: Packets out of sequence: expected: 55292, got 17182.
FIXME: unhandled predicition type: 5
FIXME: unhandled predicition type: 2
shairport-sync: player.c:246: alac_decode: Assertion `outsize == (4 * frame_size)' failed.
Abgebrochen
weird...
--with-metadata
is now also crashing:
pi@rpi2 ~/bin/shairport-sync_clean $ ./shairport-sync -vvv
Looking for the configuration file "/etc/shairport-sync.conf".
Looking for configuration file at full path "/etc/shairport-sync.conf"
Output device name is "default".
startup
The processor is running little-endian.
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 "my shairport sync".
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 -1.
iTunesLatency is -1.
forkedDaapdLatency is -1.
stuffing option is "0".
resync time is 2205.
allow a session to be interrupted: 1.
busy timeout time is 5.
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.
volume range in dB (zero means use the range specified by the mixer): 0.
configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
metdata enabled is 0.
metadata pipename is "(null)".
get-coverart is 0.
avahi: avahi_register.
avahi: register_service.
Avahi without metadata
culling threads.
new RTSP connection.
Apple-Challenge: aH3bzOMWwHLF6Si58WaHqg==.
CSeq: 0.
DACP-ID: AB3BA2575516C4FE.
Active-Remote: 2918667251.
User-Agent: AirPlay/250.10.
Apple-Response: HefEMnb4t95tsr03fMobmbdHAFYQo3rjf2jOJbA+d6Vpq0a2+/99FKJF46NJFt3rac32xmk2e90aX2bK1unlgC4Punh7sKNL3M3zcrfJ1h7mBUNngvNHDqTSvO6f7kknPKurphjWcs4XEbb+qCAdGz9IA/KMCFTaZDwILViXidv0cnMqKIPT2U7cHy1ER8G+dGP/uWmKKEacQ3FsMSKqlgmkCxX9QYtKtV34sAajo23VuVhVkmVs6iJN8KI6w0k6PN2q82sGkP+k22ATpawAzxz+Ju+yXci0qPGlrj3fRUm6fXi6R1izW0LTGwFnnqSWxHjh67irI52XxMbYvDhJBw.
CSeq: 0.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
Content-Length: 642.
Content-Type: application/sdp.
CSeq: 1.
DACP-ID: AB3BA2575516C4FE.
Active-Remote: 2918667251.
User-Agent: AirPlay/250.10.
Play connection from user agent "AirPlay/250.10".
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Transport: RTP/AVP/UDP;unicast;mode=record;timing_port=49665;control_port=50681.
CSeq: 2.
DACP-ID: AB3BA2575516C4FE.
Active-Remote: 2918667251.
User-Agent: AirPlay/250.10.
Active-Remote string seen: "2918667251".
DACP-ID string seen: "AB3BA2575516C4FE".
User-Agent is AirPlay; selecting the AirPlay latency of -1 frames.
rtp_setup: cport=50681 tport=49665.
Connection from IPv4: 192.168.1.9:62362
listening for audio, control and timing on ports 6001, 6002, 6003.
CSeq: 2.
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: 3.
DACP-ID: AB3BA2575516C4FE.
Active-Remote: 2918667251.
User-Agent: AirPlay/250.10.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Audio-Latency: 11025.
syncing to seqno 55610.
Content-Length: 20.
Content-Type: text/parameters.
CSeq: 4.
DACP-ID: AB3BA2575516C4FE.
Active-Remote: 2918667251.
User-Agent: AirPlay/250.10.
SET_PARAMETER Content-Type:"text/parameters".
received parameters in SET_PARAMETER request.
volume: -20.000000
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
Speicherzugriffsfehler
Really strange -- I went back down to ./configure --with-alsa --with-avahi --with-systemd --with-ssl=openssl
and this now also crashes when starting playback from spotify. I did my tests using 692d422f1934569af78d7e53998b6730eda61993.
edit: I yet again started clean and even deleted my almost empty config file -- to no avail :-/
Peter, thanks for your detective work!
If the messages like FIXME: unhandled predicition type: 5
are for real, and not caused by something else, they point to shortcomings in the ALAC to PCM decoder in alac.c
. The cause would likely be encodings that come from Spotify that are [probably] legal but not sent by other sources like iTunes. Shairport Sync is written on the basis that the decoder always works properly and crashes if certain criteria are not met by the output of the decoder. What I need to do is alter the code around the decoder so that it doesn't fall over whenever there's a problem. What (I guess) it should do is fill any blank frames with silence and allow Shairport Sync to carry on. The decoder is a fantastic piece of detective work, but there are other hints that it may not be perfect – see #109 – and a freely available sample decoder is available from Apple under the Apache license, though it might be difficult or even impossible to incorporate.
iTunes fails for me as well:
pi@rpi2 ~/bin/shairport-sync_clean $ ./shairport-sync -vvv
Looking for the configuration file "/etc/shairport-sync.conf".
Looking for configuration file at full path "/etc/shairport-sync.conf"
Output device name is "default".
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 "Shairport Sync on rpi2".
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 -1.
iTunesLatency is -1.
forkedDaapdLatency is -1.
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.
volume range in dB (zero means use the range specified by the mixer): 0.
configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
avahi: avahi_register.
avahi: register_service.
Avahi without metadata
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 2285254041.
Apple-Challenge: sPQc5awTDA+v2ghkg0s3PQ.
rsa_apply encrypt
rsa_apply exit
Apple-Response: g3Sb5njHoEVQzl0i26T+8+EBb46M9su8XWXRq7FzDJgP9/0Rdrjvmcssl1OYrCsZY/TMWnIX0QP/+VkQZD3Geo1lgRQy/+T3ysUGSbRMdYG8FY1xdjgBHHEavcCC41aUfw8t1NHOYPd3+6GcRXrNDO+9XdbiAqFAmFEpfWWUKuYWESno4GxfpLumD15DRdJ38HfWBLnCpZ3HSweAVgetzf856jVDV10xVmqiY5E74djVKKTmOh+CkEzCkayU8cxhucHzTpZ20bUWxf5YwwqAtPh3v7csoklVQC3i17SBBjnwLlf9oP4qmcBg+inr7uS85+oueprYG4T5Wajw/sFhUA.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
RTSP connection closed.
closing RTSP connection.
terminating RTSP thread.
culling threads.
one joined...
new RTSP connection.
CSeq: 1.
Content-Type: application/sdp.
Content-Length: 568.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 2285254041.
rsa_apply decrypt
rsa_apply exit
Play connection from user agent "iTunes/12.3.2 (Macintosh; OS X 10.11.2)".
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
CSeq: 2.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6001;timing_port=6002.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 2285254041.
Active-Remote string seen: "2285254041".
User-Agent is iTunes 10 or better, (actual version is 12); selecting the iTunes latency of -1 frames.
rtp_setup: cport=6001 tport=6002.
Connection from IPv4: 192.168.1.9:62716
listening for audio, control and timing on ports 6001, 6002, 6003.
CSeq: 2.
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: 3.
Session: 1.
Range: npt=0-.
RTP-Info: seq=46470;rtptime=31277805.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 2285254041.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Audio-Latency: 11025.
CSeq: 4.
Session: 1.
Content-Type: text/parameters.
Content-Length: 18.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 2285254041.
SET_PARAMETER Content-Type:"text/parameters".
received parameters in SET_PARAMETER request.
syncing to seqno 21160.
volume: 0.000000
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
CSeq: 5.
Session: 1.
Content-Type: text/parameters.
Content-Length: 18.
User-Agent: iTunes/12.3.2 (Macintosh; OS X 10.11.2).
Client-Instance: 53C333C006EBBB74.
DACP-ID: 53C333C006EBBB74.
Active-Remote: 2285254041.
SET_PARAMETER Content-Type:"text/parameters".
received parameters in SET_PARAMETER request.
volume: 0.000000
CSeq: 5.
Audio-Jack-Status: connected; type=analog.
Speicherzugriffsfehler
My last try was to use polarssl
-- again no success. I looked up that line in player.c
, where there is that one assert
and ssl was noted closeby.
Since I am unfamiliar with the code, I won't dig any further.
As a last step I am now compiling version 2.5.0.9... edit: As expected, this also crashes.
Please let me note that https://github.com/juhovh/shairplay that is used by Kodi works for me, when connecting from iTunes. It though does not show up as a system playback device. May be this is of help for you.
edit: so I rebooted my raspberry pi and guess what -- it now works?!?!
shairport-sync --version
2.7.3-openssl-Avahi-ALSA-metadata
pi@rpi2 ~ $ uname -a
Linux rpi2 4.1.14-v7+ #828 SMP PREEMPT Thu Dec 10 13:22:08 GMT 2015 armv7l GNU/Linux
Don't ask me why. As a last ressort measure, I ran rpi-update
.
Thanks again. I have no idea why that should make a difference, TBH, and I'm shortly going to push a development update with a little more diagnostics and a little more resilience in it. Edit: I guess it could be that your machine was dropping occasional parts of the UDP frame – it's barely plausible. Edit again: Actually, UDP packets are checksummed, so unless that's faulty – unlikely, I'd say – then it's not really plausible as the packet would simply be dropped.
If the messages like FIXME: unhandled predicition type: 5 are for real, they are data-driven; if the audio source doesn't contain the trigger, (and it hasn't up until recently), then there won't be any problems. This code will hopefully note their occurrence in the log and try to carry on.
The version of the decoder is the same in shairplay, in abrasive's shairport and in Shairport Sync.
Just pushed that update in the development branch. If you set debug verbosity to 1 it will detect if the output of the decoder is unusual, and it will keep going. I haven't been able to make it happen, but the program runs properly. I'll try to get it to misbehave later today.
From a discussion in #169, I think this issue is resolved, Peter. Issue #160 remains to be tackled. Is that a fair summary?
yes, indeed. I think the crashes I observed are all linked to the preceeding switch of two sources. Please close here.
Cool.
Hi Mike,
I observe a crash of shairport-sync:
Log:
If I use AirAudio to connect from my tablet, the connection works just fine.
This used to work on my laptop (MacBook Air), though I recently both updated it to the *.2 update and recompiled shairport-sync to the last tagged release.