owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.06k stars 236 forks source link

Handle Airplay stereo group as one speaker instead of two individual speakers #1413

Open ma-ku opened 2 years ago

ma-ku commented 2 years ago

When two Airplay speakers have been joined into a stereo pair, they still show up as two individual speakers. While playback of stereo streams seem to be working starting with audioOS 15.4 (see #1291), the UI still does not reflect the pairing and does not show the name of the stereo pair.

Expected behavior would be that instead of two speakers the UI would only show the stereo group with its name and eventually a visual clue that this is a stereo pair. When this pair is selected as output, then internally the server should stream content to the speakers involved in that group.

Initial work has been done on the backend in a forked repo. There, the parsing of the Airplay outputs is reflecting the grouping information found in mDNS and adds the information to the extended airplay record. It needs to be discussed, how the information is handled internally so that the UI can render the correct speaker information while the backend would need to know, which speakers are involved. Some guidance from @ejurgensen would be required to complete the work.

shauder commented 2 years ago

I did some more testing and I was able to get the pin to show on the TV for both and pair them through the Owntone settings. For a while the living room would mostly work. Sometimes it would deselect and then I would select it again and it would stick. Then I could deselect and the sound would stop. The bedroom one seems to want me to pair it every time. Eventually the living room one wanted me to pair again too.

Here is some more of the relevant logs.


[2022-03-24 15:45:08] [  LOG]  airplay: Starting device pairing for 'Bedroom Apple TV', go to the web interface and enter PIN
[2022-03-24 15:45:08] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' requires a valid PIN or password
[2022-03-24 15:45:08] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744)
[2022-03-24 15:45:30] [  LOG]  airplay: Pair setup stage complete, saving authorization key
[2022-03-24 15:45:55] [  LOG]  airplay: Starting device pairing for 'Living Room Apple TV', go to the web interface and enter PIN
[2022-03-24 15:45:55] [  LOG]   player: The AirPlay 2 device 'Living Room Apple TV' requires a valid PIN or password
[2022-03-24 15:45:55] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/16857613540288788273/toggle)
Joining mDNS multicast group on interface veth3f40c11.IPv6 with address fe80::8c4:77ff:fe6a:21f1.
New relevant interface veth3f40c11.IPv6 for mDNS.
Registering new address record for fe80::8c4:77ff:fe6a:21f1 on veth3f40c11.*.
Interface veth3f40c11.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth3f40c11.IPv6 with address fe80::8c4:77ff:fe6a:21f1.
Withdrawing address record for fe80::8c4:77ff:fe6a:21f1 on veth3f40c11.
[2022-03-24 15:46:15] [  LOG]  airplay: Pair setup stage complete, saving authorization key
[2022-03-24 15:46:57] [  LOG]  airplay: Device 'Living Room Apple TV' closed RTSP connection
[2022-03-24 15:47:05] [  LOG]  airplay: Response to SETPEERS from 'Bedroom Apple TV' was negative, aborting (0 (null))
[2022-03-24 15:47:05] [  LOG]  airplay: Clearing 'Bedroom Apple TV' pairing keys, you need to pair again
[2022-03-24 15:47:05] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' failed to activate
[2022-03-24 15:47:05] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744/toggle)
Joining mDNS multicast group on interface vethb19ddb7.IPv6 with address fe80::5828:79ff:fe1e:691f.
New relevant interface vethb19ddb7.IPv6 for mDNS.
Registering new address record for fe80::5828:79ff:fe1e:691f on vethb19ddb7.*.
Interface vethb19ddb7.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface vethb19ddb7.IPv6 with address fe80::5828:79ff:fe1e:691f.
Withdrawing address record for fe80::5828:79ff:fe1e:691f on vethb19ddb7.
[2022-03-24 15:47:33] [  LOG]  airplay: Starting device pairing for 'Bedroom Apple TV', go to the web interface and enter PIN
[2022-03-24 15:47:33] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' requires a valid PIN or password
[2022-03-24 15:47:33] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744/toggle)
[2022-03-24 15:47:59] [  LOG]  spotify: No spotify refresh token found
[2022-03-24 15:48:01] [  LOG]  airplay: Device 'Living Room Apple TV' closed RTSP connection
[2022-03-24 15:48:09] [  LOG]  airplay: Starting device pairing for 'Bedroom Apple TV', go to the web interface and enter PIN
[2022-03-24 15:48:09] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' requires a valid PIN or password
[2022-03-24 15:48:09] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744/toggle)
Joining mDNS multicast group on interface veth3a759c9.IPv6 with address fe80::7456:eaff:fe79:63fd.
New relevant interface veth3a759c9.IPv6 for mDNS.
Registering new address record for fe80::7456:eaff:fe79:63fd on veth3a759c9.*.
Interface veth3a759c9.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth3a759c9.IPv6 with address fe80::7456:eaff:fe79:63fd.
Withdrawing address record for fe80::7456:eaff:fe79:63fd on veth3a759c9.
[2022-03-24 15:48:25] [  LOG]  airplay: Pair setup stage complete, saving authorization key
Joining mDNS multicast group on interface veth39724ea.IPv6 with address fe80::b0b9:a6ff:fed9:da4f.
New relevant interface veth39724ea.IPv6 for mDNS.
Registering new address record for fe80::b0b9:a6ff:fed9:da4f on veth39724ea.*.
Interface veth39724ea.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth39724ea.IPv6 with address fe80::b0b9:a6ff:fed9:da4f.
Withdrawing address record for fe80::b0b9:a6ff:fed9:da4f on veth39724ea.
[2022-03-24 15:49:16] [  LOG]  spotify: No spotify refresh token found
[2022-03-24 15:49:22] [  LOG]     dacp: 'device-volume' request from '192.168.0.156' has unknown Active-Remote: '2167659679'
[2022-03-24 15:49:22] [  LOG]     dacp: 'device-volume' request from '192.168.0.101' has unknown Active-Remote: '3444356057'
[2022-03-24 15:49:23] [  LOG]     dacp: 'device-volume' request from '192.168.0.156' has unknown Active-Remote: '2167659679'
[2022-03-24 15:49:37] [  LOG]  airplay: Device 'Living Room Apple TV' closed RTSP connection
[2022-03-24 15:49:39] [  LOG]  airplay: Response to SETPEERS from 'Bedroom Apple TV' was negative, aborting (0 (null))
[2022-03-24 15:49:39] [  LOG]  airplay: Clearing 'Bedroom Apple TV' pairing keys, you need to pair again
[2022-03-24 15:49:39] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' failed to activate
[2022-03-24 15:49:39] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744)
[2022-03-24 15:49:57] [  LOG]     raop: AirPlay device 'Portable' is password-protected
[2022-03-24 15:49:57] [  LOG]     raop: No password given in config for AirPlay device 'Portable'
[2022-03-24 15:49:57] [  LOG]     raop: AirPlay device 'Portable' is password-protected
[2022-03-24 15:49:57] [  LOG]     raop: No password given in config for AirPlay device 'Portable'
Joining mDNS multicast group on interface veth28dc908.IPv6 with address fe80::84ac:46ff:feee:a771.
New relevant interface veth28dc908.IPv6 for mDNS.
Registering new address record for fe80::84ac:46ff:feee:a771 on veth28dc908.*.
[2022-03-24 15:50:15] [  LOG]  airplay: Starting device pairing for 'Bedroom Apple TV', go to the web interface and enter PIN
[2022-03-24 15:50:15] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' requires a valid PIN or password
[2022-03-24 15:50:15] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744)
Interface veth28dc908.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth28dc908.IPv6 with address fe80::84ac:46ff:feee:a771.
Withdrawing address record for fe80::84ac:46ff:feee:a771 on veth28dc908.
[2022-03-24 15:50:18] [  LOG]  airplay: Starting device pairing for 'Bedroom Apple TV', go to the web interface and enter PIN
[2022-03-24 15:50:18] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' requires a valid PIN or password
[2022-03-24 15:50:18] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744)
[2022-03-24 15:50:42] [  LOG]  airplay: Pair setup stage complete, saving authorization key
[2022-03-24T15:51:00Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
[2022-03-24T15:51:00Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
[2022-03-24T15:51:00Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
[2022-03-24T15:51:01Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
[2022-03-24T15:51:01Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
[2022-03-24T15:51:01Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
[2022-03-24T15:51:01Z WARN  libmdns::fsm] dropping truncated packet from 192.168.0.12:5353
Joining mDNS multicast group on interface veth5aa07db.IPv6 with address fe80::847f:7aff:fe86:fc70.
New relevant interface veth5aa07db.IPv6 for mDNS.
Registering new address record for fe80::847f:7aff:fe86:fc70 on veth5aa07db.*.
Interface veth5aa07db.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth5aa07db.IPv6 with address fe80::847f:7aff:fe86:fc70.
Withdrawing address record for fe80::847f:7aff:fe86:fc70 on veth5aa07db.
Joining mDNS multicast group on interface vethd486319.IPv6 with address fe80::e410:69ff:fe71:907.
New relevant interface vethd486319.IPv6 for mDNS.
Registering new address record for fe80::e410:69ff:fe71:907 on vethd486319.*.
Interface vethd486319.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface vethd486319.IPv6 with address fe80::e410:69ff:fe71:907.
Withdrawing address record for fe80::e410:69ff:fe71:907 on vethd486319.
[2022-03-24 15:52:26] [  LOG]  airplay: Response to SETPEERS from 'Bedroom Apple TV' was negative, aborting (0 (null))
[2022-03-24 15:52:26] [  LOG]  airplay: Clearing 'Bedroom Apple TV' pairing keys, you need to pair again
[2022-03-24 15:52:26] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' failed to activate
[2022-03-24 15:52:26] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744)
Joining mDNS multicast group on interface vethdf1628f.IPv6 with address fe80::a4cb:19ff:fead:89c5.
New relevant interface vethdf1628f.IPv6 for mDNS.
Registering new address record for fe80::a4cb:19ff:fead:89c5 on vethdf1628f.*.
Interface vethdf1628f.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface vethdf1628f.IPv6 with address fe80::a4cb:19ff:fead:89c5.
Withdrawing address record for fe80::a4cb:19ff:fead:89c5 on vethdf1628f.
Joining mDNS multicast group on interface veth89e96b0.IPv6 with address fe80::bca0:a3ff:fec9:9d5d.
New relevant interface veth89e96b0.IPv6 for mDNS.
Registering new address record for fe80::bca0:a3ff:fec9:9d5d on veth89e96b0.*.
Interface veth89e96b0.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth89e96b0.IPv6 with address fe80::bca0:a3ff:fec9:9d5d.
Withdrawing address record for fe80::bca0:a3ff:fec9:9d5d on veth89e96b0.
Joining mDNS multicast group on interface vethd3ec4e5.IPv6 with address fe80::2c40:20ff:fee3:dca5.
New relevant interface vethd3ec4e5.IPv6 for mDNS.
Registering new address record for fe80::2c40:20ff:fee3:dca5 on vethd3ec4e5.*.
Interface vethd3ec4e5.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface vethd3ec4e5.IPv6 with address fe80::2c40:20ff:fee3:dca5.
Withdrawing address record for fe80::2c40:20ff:fee3:dca5 on vethd3ec4e5.
[2022-03-24 15:56:11] [  LOG]  airplay: Device 'Living Room Apple TV' closed RTSP connection
Joining mDNS multicast group on interface vethcd7b92e.IPv6 with address fe80::98de:a7ff:fe72:3db9.
New relevant interface vethcd7b92e.IPv6 for mDNS.
Registering new address record for fe80::98de:a7ff:fe72:3db9 on vethcd7b92e.*.
Interface vethcd7b92e.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface vethcd7b92e.IPv6 with address fe80::98de:a7ff:fe72:3db9.
Withdrawing address record for fe80::98de:a7ff:fe72:3db9 on vethcd7b92e.
[2022-03-24 15:56:48] [  LOG]  airplay: Starting device pairing for 'Bedroom Apple TV', go to the web interface and enter PIN
[2022-03-24 15:56:48] [  LOG]   player: The AirPlay 2 device 'Bedroom Apple TV' requires a valid PIN or password
[2022-03-24 15:56:48] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/12837454162567186744)
Joining mDNS multicast group on interface vethe29dbf1.IPv6 with address fe80::ec57:25ff:fea5:d99.
New relevant interface vethe29dbf1.IPv6 for mDNS.
Registering new address record for fe80::ec57:25ff:fea5:d99 on vethe29dbf1.*.
Interface vethe29dbf1.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface vethe29dbf1.IPv6 with address fe80::ec57:25ff:fea5:d99.
Withdrawing address record for fe80::ec57:25ff:fea5:d99 on vethe29dbf1.
[2022-03-24 15:57:43] [  LOG]  airplay: Device 'Living Room Apple TV' closed RTSP connection
[2022-03-24 15:58:28] [  LOG]  airplay: Response to SETPEERS from 'Living Room Apple TV' was negative, aborting (0 (null))
[2022-03-24 15:58:28] [  LOG]  airplay: Clearing 'Living Room Apple TV' pairing keys, you need to pair again
[2022-03-24 15:58:28] [  LOG]   player: The AirPlay 2 device 'Living Room Apple TV' failed to activate
[2022-03-24 15:58:28] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/16857613540288788273)
Joining mDNS multicast group on interface veth944b034.IPv6 with address fe80::941d:dfff:fef8:5f36.
New relevant interface veth944b034.IPv6 for mDNS.
Registering new address record for fe80::941d:dfff:fef8:5f36 on veth944b034.*.
Interface veth944b034.IPv6 no longer relevant for mDNS.
Leaving mDNS multicast group on interface veth944b034.IPv6 with address fe80::941d:dfff:fef8:5f36.
Withdrawing address record for fe80::941d:dfff:fef8:5f36 on veth944b034.
[2022-03-24 15:58:43] [  LOG]  airplay: Starting device pairing for 'Living Room Apple TV', go to the web interface and enter PIN
[2022-03-24 15:58:43] [  LOG]   player: The AirPlay 2 device 'Living Room Apple TV' requires a valid PIN or password
[2022-03-24 15:58:43] [  LOG]      web: JSON api request failed with error code 500 (/api/outputs/16857613540288788273)```
aleszczynskig commented 2 years ago

Just a a couple of points I should have noted before. I have updated to the released 15.4 os for the HomePods.

I initially paired with the pin code using the Owntone UI and the pin displayed on the Apple TV and that worked as expected.

The speaker is selected/deselected correctly via the json api when called from curl. The issue seems to be in the UI. I will run another test and share the logs.

aleszczynskig commented 2 years ago

Scratch that. I also get the same 500 response code from curl. This is different behaviour from last week when I was testing.