juhovh / shairplay

Apple airplay and raop protocol server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS 9 support

voron opened this issue · comments

I'm unable to use shairplay with iOS 9 beta 3. On the same time Apple Airport works fine with the same iOS 9 iPad and the same instance of shairplay works fine with iOS 8.4.1 another iPad. Here is iOS 9-related console output

[root@playroom bin]# shairplay -a playroom --ao_driver=alsa --hwaddr=b8:27:eb:51:d8:a4
Initialized server socket(s)
*** WARNING *** The program 'shairplay' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=shairplay>
Accepted IPv4 client on socket 10
Local: 192.168.78.30
Remote: 192.168.78.20
Accepted IPv6 client on socket 11
Local: fe80:0000:0000:0000:0213:efff:fe40:0725
Remote: fe80:0000:0000:0000:0409:966b:bb87:92c1
Receiving on socket 10
Connection closed for socket 10
Receiving on socket 11
Got challenge: S26Dy1m46AgDAPXbUUY2Wg==
Got response: nV2dEZJabFCnF+ENxz0eFhdBUy9H/JIk4HrC5y1vuN5xh6QNyB6zzRjADosZodtabQD1Cdd7zkwEO4S9buzXceRyjsDJYRaSSmc8DioSBt4H22X0iwPP8kkbu9VR2M3lU5nZm8his6/WkdRH0jGG4zIJGDWY43FWqr+Z8OWKDUOqmx0nYdxPT2MOQvFymNXsry4o3KxKzmf65jKhZFE258QARmdpyscoF4S+gVqUZIqt0ez7ZA2vFVta5Qekdc5ehKE52aFotIoYp8Ar9E1q2eFP1Flcd2qDQ5fYjk4ShATG/WIS783LOin9GOrB9DTZKofNz556GQlRig5I1vgvsw
Handled request OPTIONS with URL *
Receiving on socket 11
connection: IN IP6 fe80::409:966b:bb87:92c1
rtpmap: 96 AppleLossless
fmtp: 96 352 0 16 40 10 14 2 255 0 0 44100
rsaaeskey: HaF9c0dc1EZIut4hK9GNqEf9Xnm2/GmXWxYx1MQ7NK8ghPkTM5F2c6OfqPjQEoMYFw30X+I+qrKWRbAI88Q2RkSe3ekZm6QnGT0VmTYTpeeDz8xOyFwOTrTE4tT40Ga1JpWJT5sWdAvzrg1NLe4Q8uUznBWlgbfjNBEg+KyhBI+GP/w2ZVzSaUWdvSna3tEQd2R6TnAHKrrTdznqJ9p01CS4kWfs2WK0MTOtEsBWzY8Qeo8g8EaVKlncBVocENXxO7HoOHVTaW6HcF0+MJG1BgjQdzvT0mB+HwE2lkH5s5ornb3GY8tmT1GgEq+tij9QpZjZQX1sSULqS3XCP6WgyA==
aesiv: T0MW8tN5nLKJscniCmALyA==
aeskeylen: 16
aesivlen: 16
Handled request ANNOUNCE with URL rtsp://fe80::213:efff:fe40:725/16485092811308287640
Receiving on socket 11
Transport: RTP/AVP/UDP;unicast;mode=record;timing_port=51410;control_port=50525
Found remote timing port: 51410
Found remote control port: 50525
Responding with RTP/AVP/UDP;unicast;mode=record;timing_port=58308;events;control_port=37767;server_port=50503
Handled request SETUP with URL rtsp://fe80::213:efff:fe40:725/16485092811308287640
Receiving on socket 11
Handled request GET_PARAMETER with URL rtsp://fe80::213:efff:fe40:725/16485092811308287640
Receiving on socket 11
Exiting UDP RAOP thread
Handled request TEARDOWN with URL rtsp://fe80::213:efff:fe40:725/16485092811308287640
Receiving on socket 11
Connection closed for socket 11

Do you need any additional info?

Thank you, it looks like iOS 9 has started to make a GET_PARAMETER request, which is unhandled by shairplay, because so far it has not been clear what that request is used for. That is why the connection gets disconnected. Unfortunately the debug log doesn't give the whole contents of GET_PARAMETER.

It could be something very simple like the iPad just requesting volume parameter before starting the stream. Could you please attach a full dump of the handshake with for example "tcpdump -i -s 65535 -w " and I'll have a look at it.

Here is tcpflow http://pastebin.com/raw.php?i=e5v1kfNk and here is tcpdump of another handshake with some other packets like icmp https://www.dropbox.com/s/a5xgerz9x3o2xzb/shairplay.tcpdump?dl=0

Seems to be just requesting volume as I suspected, this might mean I have to add a new callback for requesting volume, since it's not stored anywhere. I'll let you know when I have a fix for testing.

@voron sorry to be late about this, but one thing came to my mind, would you mind trying to delete the "GET_PARAMETER, " text from the string on src/lib/raop.c line 205 and recompile? That might be a quick fix, but if it doesn't work I'll actually implement the GET_PARAMETER. It's just a bit annoying to implement since there can be multiple values in one request...

I had recompiled shairplay without GET_PARAMETER - it's still requested and iPad disconnects from shairplay. Here is tcpflow http://pastebin.com/raw.php?i=PFxACZD9

Strangely, there is no GET_PARAMETER with iOS9 and Airport Express http://pastebin.com/raw.php?i=X58D9C7e . This seems to be common iOS 9 related problem - airplay was re-designed, old firmware on AppleTV is broken and so on. I suspect no quick solution.

Yeah, I just looked at the article in 9to5mac which suggest even apps like Reflector need changes to make things work. I guess have to just wait for the smoke to settle down and then get to this, I'm worried that the work that has been put to reverse engineer screen mirroring might go to waste as well now.

http://pastebin.com/raw.php?i=X58D9C7e tcpflow with iOS9 and Airport Express fw 7.6.3 just in case.

Really keen to get this fixed. Happy to offer $'s if it can motivate a faster resolution :)

I finally got to update my devices to iOS 9 and I can confirm that just implementing GET_PARAMETER fixes the issue, I'll start implementing it. Screen mirroring is another issue that needs to be looked into later.

Please test the latest master branch version for iOS 9 support, seems to work for me.

@voron @livewireintegration @Memphiz

Works for me too.

Mhh this is only half of the story for kodi sadly. I had to disable the airplay announcement to make airtunes work with your changes. It seems the fact that kodi announces both roap and airplay service ios9 somehow tries to do its new connect handshake stuff which we know nothing about :(((

Good work though for the roap only users :)

@Memphiz ah, that makes sense but sucks... I noticed Reflector now advertises iOS9 support at http://www.airsquirrels.com/reflector/ maybe that could give some hints too about the changes.

Just out of curiosity I posted a dissected RAOP handshake of iOS 9 screen mirroring session to http://pastebin.com/raw.php?i=wLWEqLWg. Basically it seems to do: pair-verify, pair-setup, pair-verify, pair-verify. Then it proceeds with the fp-setup handshake as usual, don't know how tricky it would be to get the raop and airplay support to work concurrently... Should really get this whole process figured out so that mirroring and whatever could be made work.

Also the whole metadata stuff seems broken (no duration/progress, no artist, no album, no title, no album thumb) ...

for completness - DACP (remote control) still works with the music app ...

It's very possible that since we still emulate airport device (which doesn't have a screen) then this metadata is no more sent to that class of device... Should get the Apple TV DRM working and then probably everything would work as before. But easier said than done, no one seems to have time and skills. :)

By the way the pair-setup handshake seems to be related to HomeKit, there is some implementation at https://github.com/brutella/hc/blob/master/netio/endpoint/pair-verify.go that has implemented it but the documentation is quite slim. Looks like Apple has merged the AirPlay and HomeKit protocols in iOS 9 to work better with each other.

It looks like HomeKit pairing is actually using SRP with TLV encoded values, but the AirPlay pairing data is quite different. Need to continue to look into this.

I must say I haven't come across that GET_PARAMETER stuff with Shairport Sync, though I wonder if it's been taken out of iOS 9?

Has anybody had any joy finding where the metadata is gone?

Really looking forward for full iOS9 support! Keep up the good work 👍

any progress?

Shairport Sync is seeing metadata again in the RAOP protocol...

Hi juhovh:
"pair-verify" " pair-setup",this two sessions is resolved ?can you help me to how reseponse two sessions?
Thank you very much!

@juhovh ,
"pair-verify" " pair-setup",this two sessions is resolved ?can you help me to how reseponse two sessions?
Thank you very much!

@Jack-lx @juhovh @voron
"pair-verify" " pair-setup",this two sessions is resolved ?can you help me to how reseponse two sessions?
Thank you very much!

Hi Jack-Ix / wenliabc2007,
Can you please provide steps/details about how you have resolved "pair-verify" " pair-setup" sessions?
Thank you very much