Closed mikebrady closed 9 years ago
Hi Joost. Thanks for this report. I'd be really interested in chasing this bug down. It is of course possible that Shairport Sync has a flaw that only shows up using Synology. I am away for a month though, so probably no movement for a while. Meantime, could you just verify that your exact setup works alright but with a "real" iTunes or iOS or AirPlay source in place of the Synology source?
Hey Mike, thanks for your initiative. Good call about testing the real iTunes. I hope I can reactivate an old MacBook I should have lying around gathering dust and install/fire up iTunes. I'll get back back with some results here. Thanks!
Hi Mike,
I tried a "real" iTunes on an old MacBook yesterday and it worked flawlessly/perfectly in sync (shariport-sync on RPi, my Ubuntu laptop and the MacBook playing locally). Directly afterwards I also tried the synology server once again, and the setup then exhibited the same problems as described above. So this seems to be a server problem/incompatibility indeed.
Thanks for the update. It's reassuring as it tends to indicate that the problem is associated with an interaction between the Synology server and shairport-sync and not something to do with networks, etc. Do you have any idea what software the server is using as its iTunes server?
That's what I am trying to work out as well. Perhaps some kind of forked-daapd, or sth. else. I'll dig deeper and (hopefully) let you know!
That would be very useful! Today I installed the latest forked-daapd onto my Ubuntu virtual machine and it works well with my somewhat updated (and not very well tested) version of Shairport Sync.
Hi there. I've just updated Shairport Sync to 2.1. It includes an option to turn off the resync behaviour completely, but you hopefully won't need it with the bug fixes. I'd be obliged if you'd try it out – https://github.com/mikebrady/shairport-sync/blob/2.1/README.md
Closing this due to lack of response. Please reopen if necessary.
Same problem here with Synology AudioStation 5.2. It seems to work fine when I launch Shairport-sync with "-r 0" option.
Thank You!
Thanks for this. If you turn on debug messages with the -v option, could you say what the "Play connection from..." message says please?
Here is the exact output with debug messages :
startup
avahi: avahi_register.
avahi: register_service.
new RTSP connection.
Play connection from "AudioStation/5.2 (Synology)".
Connection from IPv4: IP:38092
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: 12530.
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: 12743.
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: -3462.
Thanks. Unfortunately I don't have access to an AudioStation and haven't been able to find anything out about it. It's good to hear that the -r option works.
Hey there,
sorry for dropping of this conversation for a while. Thought I'd just chime in, though I do not have any news. Just tried the latest release 2.1.15 (thasnks for your continued work!) and sadly had the exact same problem as before with the Synology server. As with Adrien, -r0 helps, and of course unsyncs me from other clients. Typical results just like above:
statistics_requester status is 0.
daemon status is 0.
rtsp listening port is 5000.
Shairport Sync player name is "Shairport Sync on Chromebox".
Audio Output name is "alsa".
on-start action is "(null)".
on-stop action is "(null)".
wait-cmd status is 0.
mdns backend "avahi".
latency is 0.
AirPlayLatency is 88200.
iTunesLatency is 99400.
stuffing option is "(null)".
resync time is 2205.
busy timeout time is 120.
startup
avahi: avahi_register.
avahi: register_service.
culling threads.
new RTSP connection.
CSeq: 1.
User-Agent: AudioStation/5.2 (Synology).
Client-Instance: 0011322A94966011.
DACP-ID: 0011322A94966011.
Active-Remote: 0000000000006011.
CSeq: 1.
Audio-Jack-Status: connected; type=analog.
Public: ANNOUNCE, SETUP, RECORD, PAUSE, FLUSH, TEARDOWN, OPTIONS, GET_PARAMETER, SET_PARAMETER.
CSeq: 2.
User-Agent: AudioStation/5.2 (Synology).
Client-Instance: 0011322A94966011.
DACP-ID: 0011322A94966011.
Active-Remote: 0000000000006011.
Content-Length: 572.
Content-Type: application/sdp.
Play connection from "AudioStation/5.2 (Synology)".
CSeq: 2.
Audio-Jack-Status: connected; type=analog.
CSeq: 3.
User-Agent: AudioStation/5.2 (Synology).
Client-Instance: 0011322A94966011.
DACP-ID: 0011322A94966011.
Active-Remote: 0000000000006011.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=6003;timing_port=6004.
Unrecognised User-Agent. Using latency of 88200 frames.
rtp_setup: cport=6003 tport=6004.
Connection from IPv4: 192.168.1.100:54050
listening for audio, control and timing on ports 43740, 58440, 51595.
CSeq: 3.
Audio-Jack-Status: connected; type=analog.
Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=58440;timing_port=51595;server_port=43740.
Session: 1.
CSeq: 4.
User-Agent: AudioStation/5.2 (Synology).
Client-Instance: 0011322A94966011.
DACP-ID: 0011322A94966011.
Active-Remote: 0000000000006011.
Session: 1.
Range: npt=0.
RTP-Info: seq=19676;rtptime=2230926672.
CSeq: 4.
Audio-Jack-Status: connected; type=analog.
Audio-Latency: 88200.
CSeq: 5.
User-Agent: AudioStation/5.2 (Synology).
Client-Instance: 0011322A94966011.
DACP-ID: 0011322A94966011.
Active-Remote: 0000000000006011.
Session: 1.
Content-Type: text/parameters.
Content-Length: 20.
CSeq: 5.
Audio-Jack-Status: connected; type=analog.
syncing to seqno 19675.
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
+++++++++
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: -3307.
syncing to seqno 20020.
+++++++++
---------
---------
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: 4028.
syncing to seqno 20271.
+++++++++
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: -3204.
syncing to seqno 20496.
---------
Lost sync with source for 4 consecutive packets -- flushing and resyncing. Error: 3872.
syncing to seqno 20738.
^Cshutdown requested...
avahi: avahi_unregister.
shutting down playing thread.
RTSP shutdown requested.
closing RTSP connection.
shutting down RTP thread
Audio receiver -- Server RTP thread interrupted. terminating.
Control RTP thread interrupted. terminating.
Timing RTP thread interrupted. terminating.
rtp_timing_sender thread interrupted. terminating.
Closed and terminated timer requester thread.
Timing RTP thread terminated.
terminating RTSP thread.
exit...
Hmm. Thanks for the update. I don't know how to progress this, as I have no access to Synology stuff. It does seem to be a peculiarity of AudioStation.
Yes. My main concern is that I would like to have a multiroom setup without proprietary components (though the synology server also is not free). Did you have any success with some kind of linux server (mt-daapd for ex) and multiple clients?
Just as an fyi, apparently here's somebody who got the Synology software/OS running in a VirtualBox:
http://www.robvanhamersveld.nl/2013/01/21/install-and-test-synology-dsm-in-a-virtual-machine/
Yes, AFAIR, I tried it with ejurgensen's (Evan Jurgensen?) forked-daapd – https://github.com/ejurgensen/forked-daapd some months ago and it worked fine. When I get time (!), I'll try that Synology trick – it looks like it's worth trying.
Thanks for the link, going to check it out!
Let me know what you think of it!
Hi,
same here - streaming audio from latest Synology AudioStation to shairport-sync on my Raspberry Pi (ArchLinux) results in ~ 10 secs silence compared to ~1/2 sec of music.
Using "-r 0" as workaround fixes the audio playback.
Interesting. If you were up for a bit of experimentation, I'd be interested in seeing if we could resolve this issue...
Hi, depends on how much this bit needs. Playing around with the RasPi should be no problem (the possibility of creating a backup image is something I really miss on other systems), but I can't and won't doing experiments with my Synology by installing software or doing manual changes.
Yep, this is just with different installations of Shairport Sync on the PI, with some diagnostic stuff turned on. BTW, is it a Pi or a Pi 2?
It's a Pi Model B with HifiBerry DAC.
Cool. It'll take me a few days to set up something similar here. May i ask what installation of Arch Linux you used?
I followed the instructions at http://blog.thul.org/technik/anwendungen/raspberry-pi-als-streamingclient-fuer-die-synology-audio-station/
Great, thanks for that. I'll do a little local experimentation and then get back to you.
No need to hurry - I hope to be of some assistance, but might need a couple of days to follow your instructions after they arrive.
I have the same issue with the latest audio Station 5.4. the issue only appears if i stream via wifi. Have you investigated the root cause? Regards, Dominik
Hi Dominik. Thanks for that information, which is very interesting indeed. It puts a different perspective on the whole problem if play works well over ethernet, which I think you imply -- am I right?
A bug of long standing has just been fixed in the development branch, which just might have a bearing on the problem. Would it be possible for you to compile a development version of Shairport Sync and try it out?
Hi Dominik,
did I get you right the problem doesn't appear when playing over a wired connection? Never thought of checking this, but I can do a confirmation if needed / wanted by Mike.
That would be useful, thanks. Also, if it was convenient to try the latest development version, that would be super. As I said above, an important and long-standing bug has been fixed in the development version that hasn't yet made its way to the master version.
@anmith The confirmation would be very helpful. @mikebrady I have running your sync version on 3 Pi's with the Squeezeplug OS and also one with volumio, which is not your sync version (and the problem is the same). Of course i can test the developer version, if you give me a short tutorial how to do it (i will try with github tut). Maybe it will be the best to test it on a "naked" PI, am i right?
Thanks for the update. The fact that is happens with the other version of Shairport makes me a bit pessimistic, TBH. If you're trying the github tutorial, I suggest you use Raspbian Wheezy.
Hi, I did an update on my Raspberry to the latest available packages (ArchLinux) and tried playing flac files with ethernet and with wifi connection using the default configuration file: both resulted in choppy, unlistenable playback.
Hmm, not good.
Not really.
As with older releases, setting resync_threshold = 0 in the "shairport-sync.conf" fixes playback.
I'm trying to imagine what might be happening. With the resync_threshold set to zero, would it be possible for you to gather some statistics (statistics = "yes"), say over an hour or so, just to see what kind of drifting is occurring. (There is some diagnostic code, commented out, for checking the clock drift, and if might be worth turning it on to see if any clues can be found, but maybe that's for later on...)
I'm playing and logging right now, where should I upload the log to?
Sorry to interupt your discussion. I tried compiling the developer version and played via wifi with success! Thank you for the hint. When will you fixed this issue in stable version? And how can i upgrade my 4 Pis with OS (squeezeplug and volumio)? Maybe you can give me short explanation what was the root cause of this failure. Thank you in advance
@anmith, thank you so much for this. If you could run it with the debug verbosity at 1, then the log for an hour should be pretty small, so you could post it right here.
@atze09, that sounds great. Can I verify with you that you've made no special changes to the settings – in particular, you haven't changed the rsync threshold?
The one I did earlier had debug level 0, I will create another with increased level tomorrow.
As I can't attach a txt file (mssing write permission) here's a copy and paste of the current log:
-- Logs begin at Thu 1970-01-01 01:00:07 CET, end at Thu 2015-10-15 19:58:27 CEST. -- Oct 15 19:36:05 hifi-pi systemd[1]: Started ShairportSync AirTunes receiver. Oct 15 19:36:05 hifi-pi shairport-sync[691]: startup Oct 15 19:37:19 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:20 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:20 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:20 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:21 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:21 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:28 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:28 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:37:49 hifi-pi shairport-sync[691]: Sync error: 9141636.1 (frames); net correction: -162.5 (ppm); corrections: 590.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 279. Oct 15 19:38:15 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:38:15 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:38:19 hifi-pi shairport-sync[691]: Sync error: 2284333.9 (frames); net correction: -573.8 (ppm); corrections: 1278.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 39, min and max buffer occupancy 224 and 253. Oct 15 19:38:49 hifi-pi shairport-sync[691]: Sync error: -805.4 (frames); net correction: -401.4 (ppm); corrections: 1662.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1113, min and max buffer occupancy 224 and 253. Oct 15 19:39:19 hifi-pi shairport-sync[691]: Sync error: -1778.5 (frames); net correction: -659.2 (ppm); corrections: 1253.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1106, min and max buffer occupancy 224 and 251. Oct 15 19:39:27 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:39:49 hifi-pi shairport-sync[691]: Sync error: 1141135.5 (frames); net correction: -59.7 (ppm); corrections: 1349.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 253. Oct 15 19:40:19 hifi-pi shairport-sync[691]: Sync error: -1075.4 (frames); net correction: -285.8 (ppm); corrections: 1560.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1352, min and max buffer occupancy 223 and 253. Oct 15 19:40:44 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:40:49 hifi-pi shairport-sync[691]: Sync error: 1140731.5 (frames); net correction: -533.0 (ppm); corrections: 852.0 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 252. Oct 15 19:41:19 hifi-pi shairport-sync[691]: Sync error: -892.9 (frames); net correction: -186.0 (ppm); corrections: 1800.7 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 540, min and max buffer occupancy 224 and 253. Oct 15 19:41:49 hifi-pi shairport-sync[691]: Sync error: -1414.0 (frames); net correction: -758.2 (ppm); corrections: 1234.5 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 763, min and max buffer occupancy 224 and 252. Oct 15 19:41:56 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:42:19 hifi-pi shairport-sync[691]: Sync error: 1141594.7 (frames); net correction: -269.9 (ppm); corrections: 1400.8 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 223 and 253. Oct 15 19:42:49 hifi-pi shairport-sync[691]: Sync error: -1850.1 (frames); net correction: -715.1 (ppm); corrections: 1085.6 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 278, min and max buffer occupancy 223 and 252. Oct 15 19:43:01 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:43:19 hifi-pi shairport-sync[691]: Sync error: 1140940.5 (frames); net correction: -74.8 (ppm); corrections: 1143.8 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 253. Oct 15 19:43:49 hifi-pi shairport-sync[691]: Sync error: -438.1 (frames); net correction: -776.4 (ppm); corrections: 1982.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1744, min and max buffer occupancy 224 and 253. Oct 15 19:44:12 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:44:19 hifi-pi shairport-sync[691]: Sync error: 1140690.9 (frames); net correction: -377.2 (ppm); corrections: 839.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 253. Oct 15 19:44:49 hifi-pi shairport-sync[691]: Sync error: -142.7 (frames); net correction: -664.5 (ppm); corrections: 2144.7 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1045, min and max buffer occupancy 223 and 253. Oct 15 19:45:18 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:45:19 hifi-pi shairport-sync[691]: Sync error: 1140630.3 (frames); net correction: -546.6 (ppm); corrections: 712.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 253. Oct 15 19:45:49 hifi-pi shairport-sync[691]: Sync error: -612.8 (frames); net correction: -185.2 (ppm); corrections: 1963.2 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1045, min and max buffer occupancy 224 and 253. Oct 15 19:46:19 hifi-pi shairport-sync[691]: Sync error: -1669.9 (frames); net correction: -904.1 (ppm); corrections: 1102.2 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 799, min and max buffer occupancy 224 and 252. Oct 15 19:46:23 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:46:49 hifi-pi shairport-sync[691]: Sync error: 1141414.0 (frames); net correction: 79.4 (ppm); corrections: 1207.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 253. Oct 15 19:47:19 hifi-pi shairport-sync[691]: Sync error: -745.7 (frames); net correction: -907.2 (ppm); corrections: 1694.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1509, min and max buffer occupancy 224 and 252. Oct 15 19:47:29 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:47:49 hifi-pi shairport-sync[691]: Sync error: 1141276.0 (frames); net correction: -310.7 (ppm); corrections: 1151.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 222 and 253. Oct 15 19:48:08 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:48:19 hifi-pi shairport-sync[691]: Sync error: 1140914.0 (frames); net correction: -162.5 (ppm); corrections: 1012.2 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 224 and 253. Oct 15 19:48:49 hifi-pi shairport-sync[691]: Sync error: -462.8 (frames); net correction: -416.5 (ppm); corrections: 1961.7 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1396, min and max buffer occupancy 224 and 253. Oct 15 19:49:19 hifi-pi shairport-sync[691]: Sync error: -1803.2 (frames); net correction: -601.7 (ppm); corrections: 1194.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 429, min and max buffer occupancy 223 and 252. Oct 15 19:49:25 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:49:49 hifi-pi shairport-sync[691]: Sync error: 1141530.5 (frames); net correction: -159.5 (ppm); corrections: 1467.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 223 and 253. Oct 15 19:50:19 hifi-pi shairport-sync[691]: Sync error: -746.3 (frames); net correction: -665.2 (ppm); corrections: 1790.1 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1469, min and max buffer occupancy 223 and 253. Oct 15 19:50:37 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:50:49 hifi-pi shairport-sync[691]: Sync error: 1140930.7 (frames); net correction: -176.9 (ppm); corrections: 1043.2 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 223 and 253. Oct 15 19:51:19 hifi-pi shairport-sync[691]: Sync error: -205.6 (frames); net correction: -704.6 (ppm); corrections: 2107.6 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 1928, min and max buffer occupancy 224 and 253. Oct 15 19:51:42 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:51:42 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:51:49 hifi-pi shairport-sync[691]: Sync error: 2283978.0 (frames); net correction: -407.5 (ppm); corrections: 1192.2 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 223 and 254. Oct 15 19:52:19 hifi-pi shairport-sync[691]: Sync error: -1277.4 (frames); net correction: -416.5 (ppm); corrections: 1422.0 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 275, min and max buffer occupancy 219 and 253. Oct 15 19:52:32 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:52:32 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:52:49 hifi-pi shairport-sync[691]: Sync error: 2284201.4 (frames); net correction: -377.2 (ppm); corrections: 1260.2 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 223 and 252. Oct 15 19:53:18 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:53:19 hifi-pi shairport-sync[691]: Sync error: 1141560.2 (frames); net correction: -507.3 (ppm); corrections: 1337.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 222 and 252. Oct 15 19:53:49 hifi-pi shairport-sync[691]: Sync error: -1268.5 (frames); net correction: -442.2 (ppm); corrections: 1394.8 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 633, min and max buffer occupancy 222 and 252. Oct 15 19:53:50 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:53:50 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:53:50 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:54:19 hifi-pi shairport-sync[691]: Sync error: 3427317.7 (frames); net correction: -458.9 (ppm); corrections: 1302.5 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 31, min and max buffer occupancy 223 and 252. Oct 15 19:54:22 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:54:22 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:54:22 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:54:49 hifi-pi shairport-sync[691]: Sync error: 3427158.8 (frames); net correction: -179.9 (ppm); corrections: 1271.5 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 79, min and max buffer occupancy 223 and 251. Oct 15 19:54:54 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:55:19 hifi-pi shairport-sync[691]: Sync error: 1141643.9 (frames); net correction: -501.2 (ppm); corrections: 1417.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 0, min and max buffer occupancy 223 and 251. Oct 15 19:55:26 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:55:49 hifi-pi shairport-sync[691]: Sync error: 1141520.2 (frames); net correction: -347.7 (ppm); corrections: 1285.1 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 159, min and max buffer occupancy 223 and 252. Oct 15 19:56:19 hifi-pi shairport-sync[691]: Sync error: -1437.2 (frames); net correction: -346.2 (ppm); corrections: 1006.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 531, min and max buffer occupancy 223 and 251. Oct 15 19:56:49 hifi-pi shairport-sync[691]: Sync error: -1684.2 (frames); net correction: -158.0 (ppm); corrections: 1158.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 873, min and max buffer occupancy 223 and 251. Oct 15 19:56:50 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:56:50 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred Oct 15 19:57:19 hifi-pi shairport-sync[691]: Sync error: 2284153.5 (frames); net correction: 31.8 (ppm); corrections: 1068.9 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 119, min and max buffer occupancy 222 and 251. Oct 15 19:57:49 hifi-pi shairport-sync[691]: Sync error: -1659.3 (frames); net correction: -455.8 (ppm); corrections: 1193.7 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 616, min and max buffer occupancy 222 and 252. Oct 15 19:58:19 hifi-pi shairport-sync[691]: Sync error: -1965.0 (frames); net correction: -336.4 (ppm); corrections: 1095.4 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 146; min DAC queue size 906, min and max buffer occupancy 222 and 252. Oct 15 19:58:27 hifi-pi shairport-sync[691]: ALSA lib pcm.c:7905:(snd_pcm_recover) underrun occurred
Thanks. Would you be up for trying to download, compile and run the development version, to see if you can replicate @atze09's result? It's a little bit tricky, but not rocket science, and I can make up a quick guide – you're on ArchLinux on a Pi, right?
@atze09, the problem was that a variable that was used both as a flag and a time-value was initialised wrongly – it was only initialised to zero at the start of a play, which was fine most of the time, whereas it should have been set to zero at the start of every continuous play. When a play started, if it was zero, it would be set to the time of the first frame. If there was a flush and resume, the flag should have been reset to zero. Normally, when a flush and resume occurred, the incorrectly-left value in the variable was harmless, but, for reasons I don't understand, when Shairport Sync was used as the system sound player, say for playing a Quicktime Movie or YouTube videos, the incorrectly-left value in the flag caused any play sessions coming afterwards to basically choke. I think. It seems to have also been causing problems in the same way with Synology sources.
I'll be pushing out a new master
update in the next few days with this fix in it. It will be up to the volumio and squeezplug guys then to consider using it. There are a couple of new features too – automatic latency detection and volume adjustment range setting – so I imagine they'll want to do some acceptance testing. I'm afraid I don't know how to just replace the installation of Shairport Sync that comes in those integrations with a new one...
mikebrady; I am an wheezy and have not changed the rsync threshold. Just followed your general install guide. Can you please give me a feedback, when the new master release is on? That would be awesome
@mikebrady: I might find the time to build the dev version today, a small guide would be much appreciated. Both Raspberrys are running on ArchARM.
@atze09, I will post here when the update to the master is pushed, sure.
@anmith, here is a brief guide...
Overview The idea is to build and test a development version of Shairport Sync on a Raspberry Pi running Arch Linux.
We assume that the latest release version of Shairport Sync has already been installed using @EliaCereda's installation package, available at https://github.com/EliaCereda/shairport-sync-PKGBUILD. This is important because it means that all the tools and dependencies have already been downloaded.
Our approach is to build the development version but not to install it. Instead, when it's built, we will temporarily stop the installed version and run our development version from the command line. It will automatically use the same configuration file as the installed version. When we are finished, we can stop the development version and restart the installed version, and then everything will be back to the way it was.
Finally, we are doing all this while logged in over ssh as a non-root user, in this case mike
.
Here Goes First, for reference, let's check the version of Arch Linux and have a look in our home directory:
mike@alarmpi ~]$ uname -a
Linux alarmpi 4.1.8-1-ARCH #1 SMP PREEMPT Tue Sep 22 19:47:50 MDT 2015 armv7l GNU/Linux
[mike@alarmpi ~]$ ls
shairport-sync-PKGBUILD
We are going to leave the shairport-sync-PKGBUILD
directory untouched.
[mike@alarmpi ~]$ git clone https://github.com/mikebrady/shairport-sync.git
Cloning into 'shairport-sync'...
remote: Counting objects: 3949, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 3949 (delta 0), reused 0 (delta 0), pack-reused 3945
Receiving objects: 100% (3949/3949), 1.67 MiB | 530.00 KiB/s, done.
Resolving deltas: 100% (2444/2444), done.
Checking connectivity... done.
[mike@alarmpi ~]$
[mike@alarmpi ~]$ ls
shairport-sync shairport-sync-PKGBUILD
[mike@alarmpi ~]$
cd
into the shairport-sync
directory and operate in there:[mike@alarmpi ~]$ cd shairport-sync
[mike@alarmpi shairport-sync]$
[mike@alarmpi shairport-sync]$ git checkout development
Branch development set up to track remote branch development from origin.
Switched to a new branch 'development'
[mike@alarmpi shairport-sync]$
autoreconf
:[mike@alarmpi shairport-sync]$ autoreconf -i -f
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 3936.
configure.ac:21: installing './compile'
configure.ac:6: installing './install-sh'
configure.ac:6: installing './missing'
Makefile.am: installing './depcomp'
(BTW, that Unescaped...
stuff seems to be a bug in the build system – it's not a Shairport Sync issue.)
./configure
:[mike@alarmpi shairport-sync]$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-soxr
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
[snip...]
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating man/Makefile
config.status: creating config.h
config.status: executing depfiles commands
[mike@alarmpi shairport-sync]$
make
:[mike@alarmpi shairport-sync]$ make
make all-recursive
make[1]: Entering directory '/home/mike/shairport-sync'
Making all in man
make[2]: Entering directory '/home/mike/shairport-sync/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/mike/shairport-sync/man'
make[2]: Entering directory '/home/mike/shairport-sync'
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT shairport.o -MD -MP -MF .deps/shairport.Tpo -c -o shairport.o shairport.c
mv -f .deps/shairport.Tpo .deps/shairport.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT rtsp.o -MD -MP -MF .deps/rtsp.Tpo -c -o rtsp.o rtsp.c
mv -f .deps/rtsp.Tpo .deps/rtsp.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT mdns.o -MD -MP -MF .deps/mdns.Tpo -c -o mdns.o mdns.c
mv -f .deps/mdns.Tpo .deps/mdns.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT mdns_external.o -MD -MP -MF .deps/mdns_external.Tpo -c -o mdns_external.o mdns_external.c
mv -f .deps/mdns_external.Tpo .deps/mdns_external.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT common.o -MD -MP -MF .deps/common.Tpo -c -o common.o common.c
mv -f .deps/common.Tpo .deps/common.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT rtp.o -MD -MP -MF .deps/rtp.Tpo -c -o rtp.o rtp.c
mv -f .deps/rtp.Tpo .deps/rtp.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT player.o -MD -MP -MF .deps/player.Tpo -c -o player.o player.c
mv -f .deps/player.Tpo .deps/player.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT alac.o -MD -MP -MF .deps/alac.Tpo -c -o alac.o alac.c
mv -f .deps/alac.Tpo .deps/alac.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT audio.o -MD -MP -MF .deps/audio.Tpo -c -o audio.o audio.c
mv -f .deps/audio.Tpo .deps/audio.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT mdns_avahi.o -MD -MP -MF .deps/mdns_avahi.Tpo -c -o mdns_avahi.o mdns_avahi.c
mv -f .deps/mdns_avahi.Tpo .deps/mdns_avahi.Po
gcc -DHAVE_CONFIG_H -I. -Wno-multichar -g -O2 -MT audio_alsa.o -MD -MP -MF .deps/audio_alsa.Tpo -c -o audio_alsa.o audio_alsa.c
mv -f .deps/audio_alsa.Tpo .deps/audio_alsa.Po
gcc -Wno-multichar -g -O2 -o shairport-sync shairport.o rtsp.o mdns.o mdns_external.o common.o rtp.o player.o alac.o audio.o mdns_avahi.o audio_alsa.o -lasound -lavahi-common -lavahi-client -lsoxr -lssl -lcrypto -lconfig -lpopt -lm -lpthread -ldaemon -lrt
make[2]: Leaving directory '/home/mike/shairport-sync'
make[1]: Leaving directory '/home/mike/shairport-sync'
[mike@alarmpi shairport-sync]$
[mike@alarmpi shairport-sync]$ sudo systemctl stop shairport-sync
[sudo] password for mike:
[mike@alarmpi shairport-sync]$
[mike@alarmpi shairport-sync]$ ./shairport-sync -V
2.5.0.9-openssl-Avahi-ALSA-soxr
[mike@alarmpi shairport-sync]$
...and (b) we can run it from the command line. It will read settings from /etc/shairport-sync.conf
, the same as the installed version. Command line options will be honoured, and will override corresponding settings in the configuration file – useful in this situation:
[mike@alarmpi shairport-sync]$ ./shairport-sync -v --statistics
Looking for the configuration file "/etc/shairport-sync.conf".
Output device name is "hw:1".
Mixer device name is "hw:1".
Mixer Control name is "PCM".
Hardware mixer has dB volume from -128.000000 to 0.000000.
Has mute ability.
startup
avahi: avahi_register.
avahi: register_service.
Avahi without metadata
(BTW, the settings listed above are not for the built-in DAC – they are for an external USB DAC.)
new RTSP connection.
RTSP connection closed.
closing RTSP connection.
new RTSP connection.
Play connection from user agent "iTunes/12.3 (Macintosh; OS X 10.11)".
Active-Remote string seen: "474103743".
Connection from IPv4: 192.168.2.15:54210
Using negotiated latency of 99225 frames.
Using negotiated latency of 99578 frames.
Sync error: 35.1 (frames); net correction: 0.0 (ppm); corrections: 0.0 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 4373, min and max buffer occupancy 259 and 269.
Sync error: 63.3 (frames); net correction: -34.0 (ppm); corrections: 34.0 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6218, min and max buffer occupancy 262 and 264.
Sync error: 64.9 (frames); net correction: -33.3 (ppm); corrections: 33.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6211, min and max buffer occupancy 261 and 264.
Sync error: 64.3 (frames); net correction: -33.3 (ppm); corrections: 33.3 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6202, min and max buffer occupancy 260 and 264.
Sync error: 65.3 (frames); net correction: -40.8 (ppm); corrections: 40.8 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6252, min and max buffer occupancy 258 and 264.
Sync error: 65.2 (frames); net correction: -35.5 (ppm); corrections: 35.5 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6194, min and max buffer occupancy 195 and 264.
Sync error: 65.2 (frames); net correction: -34.8 (ppm); corrections: 34.8 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6232, min and max buffer occupancy 261 and 264.
Sync error: 62.1 (frames); net correction: -34.8 (ppm); corrections: 34.8 (ppm); missing packets 0; late packets 0; too late packets 0; resend requests 0; min DAC queue size 6163, min and max buffer occupancy 259 and 265.
Optional If the development version works better than the installed version and you want to use it instead, then you could replace the installed version by the development version.
[mike@alarmpi shairport-sync]$ which shairport-sync
/usr/local/bin/shairport-sync
[mike@alarmpi shairport-sync]$
[mike@alarmpi shairport-sync]$ sudo cp ./shairport-sync /usr/local/bin/
[sudo] password for mike:
[mike@alarmpi shairport-sync]$
daemon-reload
too:[mike@alarmpi shairport-sync]$ sudo systemctl daemon-reload
[sudo] password for mike:
[mike@alarmpi shairport-sync]$
Hi,
the release package is already installed using
[root@alarmpi ~]# pacman -S shairport-sync
Then I started using your tutorial
---snip---
[andreas@alarmpi ~]$ uname -a
Linux alarmpi 4.1.10-2-ARCH #1 PREEMPT Sat Oct 10 08:33:01 MDT 2015 armv6l GNU/Linux
[andreas@alarmpi ~]$ git clone https://github.com/mikebrady/shairport-sync.git
Cloning into 'shairport-sync'...
remote: Counting objects: 3949, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 3949 (delta 0), reused 0 (delta 0), pack-reused 3945
Receiving objects: 100% (3949/3949), 1.67 MiB | 790.00 KiB/s, done.
Resolving deltas: 100% (2444/2444), done.
Checking connectivity... done.
[andreas@alarmpi ~]$ cd shairport-sync/
[andreas@alarmpi shairport-sync]$
[andreas@alarmpi shairport-sync]$ git checkout development
Branch development set up to track remote branch development from origin.
Switched to a new branch 'development'
[andreas@alarmpi shairport-sync]$ autoreconf -i -f
configure.ac:54: error: possibly undefined macro: AC_DEFINE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
A re-install of "base-devel" helped, autoconf is working now ...
This from HiFiJ:
Hi Mike,
I compiled shairport-sync on two RasPis and on my Ubuntu Thinkpad and tried to use it with the itunes server implementation (so no "real" itunes) on my Synology NAS (a DS 114 to be exact). I have done this before with the original shairport, and that worked well (meaning good sound quality on RasPis/Openelec/XBMC), but of course without multi player synchronisation.
Now, with shairport-sync I have the problem that the stream is constantly disrupted, playing for a second or so (varying), then stopping for a couple of seconds. I already did a log with -vv which I could send or post, if you are interested in looking into this. I suppose the main parts are these errors with changing frame counts:
syncing to first seqno 871C. Lost sync with source -- flushing and resyncing. Error of 11591 frames. syncing to first seqno 884E. Lost sync with source -- flushing and resyncing. Error of 12257 frames. syncing to first seqno 8978. Lost sync with source -- flushing and resyncing. Error of -3345 frames.
(btw, network connection is fine on both raspis and laptop, shairport and squeezelite are working good).
I guess synology devices are quite common, and I personally now three other persons who use them as an Itunes server, so perhaps this is of some interest to you as it would provide an Apple free, linux based environment for multiroom audio as an alternative to SqueezeCenter/LMS and squeezelite.
Thanks for your work!
Joost