mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.3k stars 574 forks source link

[AP2] Apple TV disconnecting from time to time #1359

Closed corrpel closed 2 years ago

corrpel commented 2 years ago

Hello, Using the latest version of dev branch, Apple TV connected to SPS. SPS is working nice, but sometimes is disconnecting from ATV and i have to reconnect to it again. In this example, i was playing an Youtube video, paused for about 5 minutes and SPS disconnected before pressing play again. I've attached some logs, maybe they can help disconnect.log .

corrpel commented 2 years ago

Maybe it is related to this? I see this often 1 second before disconnecting.

      2968.693531829         8.752214446 "rtp.c:1282" The last PTP timing sample is pretty old: 10.003252 seconds.
      2969.305042646         0.611510817 "rtsp.c:5017" Connection 3: new connection from fdd8:f97:8913:1:101e:7ce4:c9dc:fd4d:51669 to self at fdd8:f97:8913:1:ba27:ebff:fe1b:6c35:7000.
mikebrady commented 2 years ago

Thanks for the post. The "last PTP timing sample is pretty old" might just be indicative of a noisy or dodgy network connection. Would you have any information about the quality of the network?

corrpel commented 2 years ago

Both SPS(RPI 3B+) and ATV are connected by cable to an ISP router that for about 2 years, didn't produce any issues. But good point, I will also try to use 5GZ on ATV instead of cable, maybe there is an issue with the cable that I don't see but SPS could be sensible to it. I will let you know how it goes, I see this issue happening a lot.

mikebrady commented 2 years ago

Some updates coming from this end as well 😉.

corrpel commented 2 years ago

I see this message again,

      4403.459904414         4.203756658 "dacp.c:632" metadata_store.dacp_server_active set to 0.
      4520.555056169       117.095151755 "mdns_avahi.c:154" (Browser) REMOVE: service 'iTunes_Ctrl_2F0C8C631AAD1D4D' of type '_dacp._tcp' in domain 'local'.
      4520.555320440         0.000264271 "dacp.c:464" dacp_monitor_port_update_callback with Remote ID "2F0C8C631AAD1D4D", target ID "2F0C8C631AAD1D4D" and port number 0.
      4529.309093260         8.753772820 "rtp.c:1282" The last PTP timing sample is pretty old: 10.002370 seconds.

Second line (4520.555056169) <> fourth line (4529.309093260 ) Maybe because of this mdns_avahi REMOVE? There are ~ 10 seconds between this messages

mikebrady commented 2 years ago

Thanks again.

The second line shows that Shairport Sync can no longer see the mDNS signal advertising a remote control facility provided by an AirPlay device, presumably the Apple TV. The third line notes that this change has been registered in a thread in Shairport Sync.

The fourth line indicates that nqptp has been unable to accept any PTP timing samples, again presumably from the Apple TV, for the past 10 seconds. Samples should be arriving at the rate of 8 per second, and while Shairport Sync will reject a portion of them, it would be reasonable to accept some over a period like that. So again, it may be indicative of a network issue of some kind. The updates that [I hope] will come out this week will hopefully make Shairport Sync a bit more tolerant of timing errors of PTP timing signals. But taken together with the disappearance of the DACP remote control information and the loss of audio, they are suggestive of some problem with a network or a firewall or something.

If you're on WiFi this might be a useful guide as to what works. iPhones and Macs have free signal strength facilities, and wavemon is useful on Linux machines. And of course, microwave ovens cause much interference with 2.4GHz WiFi. Apologies if you have already covered this ground.

github-actions[bot] commented 2 years ago

This issue has been inactive for 45 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.