FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.64k stars 83 forks source link

Ubuntu 20.04, use data line connect with iphone8, raop_ntp receive timeout #92

Closed zhaocius closed 2 years ago

zhaocius commented 2 years ago

i have found the device in screen mirror, but after pressing it on iphone,show these logs:

UxPlay-1.50a $ ./uxplay
using system MAC address b0:7b:25:1d:57:c3
Initialized server socket(s)
Accepted IPv4 client on socket 25
Local: 172.20.10.8
Remote: 172.20.10.1
Open connections: 1
Client identified as User-Agent: AirPlay/610.19.1
Accepted IPv4 client on socket 27
Local: 172.20.10.8
Remote: 172.20.10.1
Open connections: 2
raop_rtp_mirror starting mirroring
raop_ntp receive timeout 2 (limit 5) (request sent 2022-04-25 12:26:30.186604)
raop_ntp receive timeout 3 (limit 5) (request sent 2022-04-25 12:26:34.514642)
raop_ntp receive timeout 4 (limit 5) (request sent 2022-04-25 12:26:37.842652)
raop_ntp receive timeout 5 (limit 5) (request sent 2022-04-25 12:26:40.170591)
***ERROR lost connection with client (network problem?)
   Client no-response limit of 5 timeouts (15 seconds) reached:
   Sometimes the network connection may recover after a longer delay:
   the default timeout limit n = 5 can be changed with the "-reset n" option
reset_video 0
Removing connection for socket 25
Destroying connection
Open connections: 1
raop_rtp_mirror->running is no longer true
Removing connection for socket 27
Destroying connection
Open connections: 0
Initialized server socket(s)
fduncanh commented 2 years ago

This is probaly a problem with your network.

Uxplay asks the client for a timestamp signal every 3 seconds, to see if the client is still there. If it does not receive a reply from the client, it terminates the connection after (5) failures (timeouts) to get a reply.

Did this happen immediately, or some time after mirroring started?

get a more detailed debug report with uxplay -d

zhaocius commented 2 years ago

it succeeds when i change to iphone12. here is some diffs which compare two logs. i cannot post the full log because i cannot determine if they are safe to post. this pc belongs to my company.

DACP-ID: 32D85964062F7532 Active-Remote: 4016312620 User-Agent: AirPlay/610.19.1

DACP-ID: C82D790DA32A055C Active-Remote: 2062076060 User-Agent: AirPlay/605.1

is it because of the airplay version?

zhaocius commented 2 years ago

Did this happen immediately, or some time after mirroring started? -- it happens when iphone shows "√" in screen mirror list.

EDIT: I think the (Tick) means its connected. So you are saying that it never mirrors the screen?

fduncanh commented 2 years ago

iPhone 8 should work. I'm surprised.

see if an older version of UxPlay (versions 1.35-1.51 are available) works. If it's a problem I have introduced It could be fixed.

try 1.43 first (look in " Releases" )

If older versions work, find the oldest one that works and the first that doesn't work for you, and report it here.

fduncanh commented 2 years ago

I just tested on a very old iPhone4S from 2011, with iOS 9.3 AirPlay/280.33

Uxplay-1.51 worked fine for mirroring, so it seems unlikely that UPlay is broken for old iPhones, but just check to see if older releases of UxPlay work with your iPhone8.

User-Agent: AirPlay/280.33
zhaocius commented 2 years ago

yes, never mirrors.

zhaocius commented 2 years ago

iPhone 8 should work. I'm surprised.

see if an older version of UxPlay (versions 1.35-1.51 are available) works. If it's a problem I have introduced It could be fixed.

try 1.43 first (look in " Releases" )

If older versions work, find the oldest one that works and the first that doesn't work for you, and report it here.

i tried 1.43, it still does not work.

zhaocius commented 2 years ago

I just tested on a very old iPhone4S from 2011, with iOS 9.3 AirPlay/280.33

Uxplay-1.51 worked fine for mirroring, so it seems unlikely that UPlay is broken for old iPhones, but just check to see if older releases of UxPlay work with your iPhone8.

User-Agent: AirPlay/280.33

maybe my post earlier misled you... the iphone8 has a later version: iphone8 IOS 15.4.1 User-Agent: AirPlay/610.19.1 iphone12 IOS 15.3.1 User-Agent:AirPlay/605.1

fduncanh commented 2 years ago

does it work on any older versions of UxPlay? like 1.35?

Uxplay is tested on an iPhone SE 2020 running iOS 15.4 1 and works fine.

zhaocius commented 2 years ago

does it work on any older versions of UxPlay? like 1.35?

Uxplay is tested on an iPhone SE 2020 running iOS 15.4 1 and works fine.

no. it still doesnot work on 1.35. i tyied iphone10 with ISO15.4, it works. so i'm confused...

fduncanh commented 2 years ago

also try testing on RPiPlay https://github.com/FD-/RPiPlay

I suspect some problem with the iPhone8. compare the uxplay -d output from connecting with the iPhone 12 and 8.

look at what happens after the "begin video stream" message

raop_rtp_mirror accepting client
raop_rtp_mirror: unidentified extra header data  240.000000, 0.000000
begin video stream wxh = 1440x1080; source 1440x1080
raop_rtp_mirror width_source = 1440.000000 height_source = 1080.000000 width = 1440.000000 height = 1080.000000
raop_rtp_mirror: sps/pps header size = 6
raop_rtp_mirror h264 sps/pps header:
01 64 00 2a ff e1 

raop_rtp_mirror sps size = 18
raop_rtp_mirror h264 Sequence Parameter Set:
27 64 00 2a ac 13 14 50 16 80 89 f9 66 e0 20 20 
20 40 

raop_rtp_mirror pps size = 4
raop_rtp_mirror h264 Picture Parameter Set:
28 ee 3c b0 

remainder size = 4
remainder of sps+pps packet:
02 00 00 00 

raop_rtp_mirror video ntp = 1650942733168236, now = 1650942733167463, latency = -773
nalu_type = 5, nalu_size = 22557,  processed bytes 22561, payloadsize = 22561 nalus_count = 1
Begin streaming to GStreamer video pipeline
raop_rtp_mirror video ntp = 1650942733201569, now = 1650942733175630, latency = -25939
nalu_type = 1, nalu_size = 1762,  processed bytes 1766, payloadsize = 1766 nalus_count = 1
raop_rtp_mirror video ntp = 1650942733218236, now = 1650942733194859, latency = -23377
raop_rtp local data port    socket 43 port UDP 35912
RAOP initialized success
nalu_type = 1, nalu_size = 9318,  processed bytes 9322, payloadsize = 9322 nalus_count = 1
raop_rtp_mirror video ntp = 1650942733251504, now = 1650942733196614, latency = -54890
nalu_type = 1, nalu_size = 15733,  processed bytes 15737, payloadsize = 15737 nalus_count = 1
raop_rtp_mirror video ntp = 1650942733268147, now = 1650942733196641, latency = -71506
nalu_type = 1, nalu_size = 15097,  processed bytes 15101, payloadsize = 15101 nalus_count = 1
raop_rtp_mirror video ntp = 1650942733284809, now = 1650942733199589, latency = -85220
nalu_type = 1, nalu_size = 12973,  processed bytes 12977, payloadsize = 12977 nalus_count = 1
raop_rtp_mirror video ntp = 1650942733301467, now = 1650942733203433, latency = -98034
nalu_type = 1, nalu_size = 16374,  processed bytes 16378, payloadsize = 16378 nalus_count = 1
fduncanh commented 2 years ago

Does the iPhone8 have any MDM restrictions (Mobile Device Management., often found on employer-owned phones for security) that might prevent it responding to uxplay's request for a timestamp?

But since it went though the handshake process to connect to uxplay, this seems unlikely

zhaocius commented 2 years ago

it doesnot print "begin video stream... "

raop_rtp_mirror accepting client
raop_ntp send_len = 32, now = 1650878437982795
raop_ntp receive timeout 1 (limit 5) (request sent 2022-04-25 17:20:37.582795)
raop_ntp send_len = 32, now = 1650878441310196
raop_ntp receive timeout 2 (limit 5) (request sent 2022-04-25 17:20:41.910196)
^CStopping...
fduncanh commented 2 years ago

you need to look in the uxplay -d debug output for what happens after "accepting client" compare the working and non-working phones

zhaocius commented 2 years ago

RPiPlay doesnot work either. this iphone8 actually belongs to my company.

zhaocius commented 2 years ago

image

zhaocius commented 2 years ago

image i interrupted the process after printing timeout

fduncanh commented 2 years ago

after "raop_rtp_mirror accepting client" the video data needs to begin to be received, with info about picture size etc, as you see in the working version. This is sent on a tcp port.

try "uxplay -d -reset 100"

to see if anything ever arrives. This will allow 3 x 100 = 300 seconds before the timeout disconnects

fduncanh commented 2 years ago

I'm guessing it has MDM security that blocks it in some way

This should have happened earlier in the sequence, it's the crypto handshake

Handling request SETUP with URL rtsp://192.168.2.8/190255937795082299
DACP-ID: A4AAC905DDA4BA7
Active-Remote: 2420486752
Transport: null
SETUP 1
eiv_len = 16
16 byte aesiv (needed for AES-CBC audio decryption iv):
c3 64 b2 ad 66 e9 82 cb 06 fa 0b 3c 4c 9c 19 35 

ekey_len = 72
ekey:
46 50 4c 59 01 02 01 00 00 00 00 3c 00 00 00 00 
09 c7 be d9 cb 81 a5 d6 d7 ac 1e 59 d6 f8 a2 50 
00 00 00 10 a4 96 5b b4 05 98 72 0b 6b c0 4d 8d 
38 44 68 b5 77 7b e1 94 12 4b 0a 44 5e 9b 6c db 
2c 48 c1 61 68 d1 7f 3a 

fairplay_decrypt ret = 0
16 byte aeskey (fairplay-decrypted from ekey):
c2 fb 1d 4b af 58 01 1f 14 84 51 0f d6 63 a4 9b 

32 byte shared ecdh_secret:
cf d9 81 05 45 20 53 09 d7 a2 a7 99 69 14 96 d8 
03 bf 48 1f e2 dc 71 0e 36 64 a2 26 2f a5 38 5c 

Client identified as User-Agent: AirPlay/610.19.1
16 byte aeskey after sha-256 hash with ecdh_secret:
c9 55 4c ff d7 40 08 fc 12 1e 64 11 aa 91 ab 89 

timing_rport = 57497
raop_ntp parse remote ip = 192.168.2.138
raop_ntp starting time
raop_ntp local timing port socket 27 port UDP 7011
raop_rtp parse remote ip = 192.168.2.138
raop_rtp_mirror parse remote ip = 192.168.2.138
eport = 7000, tport = 7011

RTSP/1.0 200 OK 
CSeq: 6 
Server: AirTunes/220.68 
Content-Type: application/x-apple-binary-plist 
Content-Length: 77 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>timingPort</key>
    <integer>7011</integer>
    <key>eventPort</key>
    <integer>7000</integer>
</dict>
</plist>

raop_ntp send_len = 32, now = 1650942732970119
raop_ntp receive time type_t packetlen = 32
raop_ntp sync correction = -1650816821901064
Accepted IPv4 client on socket 28
Local: 192.168.2.8
Remote: 192.168.2.138
Open connections: 2
httpd receiving on socket 26
conn_request
fduncanh commented 2 years ago

After the crypto handshake

raop_ntp send_len = 32, now = 1650942732970119   <-----uxplay asks client for a timestamp
raop_ntp receive time type_t packetlen = 32   , <-- you never get this reply, just timeout after  5x3 =15 seconds
raop_ntp sync correction = -1650816821901064
zhaocius commented 2 years ago

try "uxplay -d -reset 100"

to see if anything ever arrives. This will allow 3 x 10


... 

raop_ntp send_len = 32, now = 1650946584894174 raop_ntp receive timeout 37 (limit 100) (request sent 2022-04-26 12:16:24.984734) raop_rtp_mirror error in header recv: 110 Connection timed out raop_rtp_mirror exiting TCP thread raop_ntp send_len = 32, now = 1650946588222203 raop_ntp receive timeout 38 (limit 100) (request sent 2022-04-26 12:16:28.312763) raop_ntp send_len = 32, now = 1650946591550188

...

raop_ntp send_len = 32, now = 1650946794558115 raop_ntp receive timeout 100 (limit 100) (request sent 2022-04-26 12:19:54.681379) raop_ntp exiting thread ***ERROR lost connection with client (network problem?) Client no-response limit of 100 timeouts (300 seconds) reached: Sometimes the network connection may recover after a longer delay: the default timeout limit n = 5 can be changed with the "-reset n" option reset_video 0 Removing connection for socket 25 Destroying connection Open connections: 1 Removing connection for socket 27 Destroying connection Open connections: 0 Exiting HTTP thread Initialized server socket(s)

fduncanh commented 2 years ago

Uxplay is not receiving anything from the client on the rtp timing port (udp) or the mirror data port (tcp).

did crypto key exchange actually successfully happen before this? (see above)

zhaocius commented 2 years ago

i get this log, but the time sequence is different image

fduncanh commented 2 years ago

There are three threads (1) ntp thread in raop_ntp.c (2) video thread in raop_rtp_mirror.c and (3) handshake + audio thread in raop_rtp.c. the -d output comes from all three threads so they can print out in different orders.

the messages typically say which thread they come from.

zhaocius commented 2 years ago

There are three threads (1) ntp thread in raop_ntp.c (2) video thread in raop_rtp_mirror.c and (3) handshake + audio thread in raop_rtp.c. the -d output comes from all three threads so they can print out in different orders.

the messages typically say which thread they come from.

got it ,so i have "raop_ntp receive time type_t packetlen = 32", is it still the MDM problem?

fduncanh commented 2 years ago

Hmmm. raop_ntp receive time is good. you were not getting that before, which caused the time out. Did you fix the MDM problem? are things working now?

zhaocius commented 2 years ago

i checked https://support.apple.com/en-us/HT202837 , and i donot think this iPhone is supervised it still not work

fduncanh commented 2 years ago

_got it ,so i have "raop_ntp receive time typet packetlen = 32", is it still the MDM problem?

The most recent debug log shows you received a ntp time packet at some point. Do they stop being received (with a timeout) later?

Unless you post a more complete log, I cant understand what is going on. (but its probably special to that phone)

zhaocius commented 2 years ago
supported audio format 1: AAC-ELD 44100/2
supported audio format 2: ALAC 44100/16/2
GStreamer video pipeline will be:
"appsrc name=video_source stream-type=0 format=GST_FORMAT_TIME is-live=true ! queue ! h264parse ! decodebin ! videoconvert ! autovideosink name=video_sink sync=false"
Initialized GStreamer video renderer
using system MAC address b0:7b:25:1d:57:c3
Initialized server socket(s)
Accepted IPv4 client on socket 25
Local: 172.20.10.8
Remote: 172.20.10.1
Open connections: 1
httpd receiving on socket 25
conn_request

GET /info RTSP/1.0
X-Apple-ProtocolVersion: 1
Content-Length: 70
Content-Type: application/x-apple-binary-plist
CSeq: 0
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>qualifier</key>
    <array>
        <string>txtAirPlay</string>
    </array>
</dict>
</plist>

Handling request GET with URL /info

RTSP/1.0 200 OK 
CSeq: 0 
Server: AirTunes/220.68 
Content-Type: application/x-apple-binary-plist 
Content-Length: 1064 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>txtAirPlay</key>
    <data>
    GmRldmljZWlkPWIwOjdiOjI1OjFkOjU3OmMzE2ZlYXR1cmVzPTB4NUE3RkZFRTYJZmxh
    Z3M9MHg0EG1vZGVsPUFwcGxlVFYzLDJDcGs9YjA3NzI3ZDZmNmNkNmUwOGI1OGVkZTUy
    NWVjM2NkZWFhMjUyYWQ5ZjY4M2ZlYjIxMmVmOGEyMDUyNDY1NTRlNydwaT0yZTM4ODAw
    Ni0xM2JhLTQwNDEtOWE2Ny0yNWRkNGE0M2Q1MzYOc3JjdmVycz0yMjAuNjgEdnY9Mg==
    </data>
    <key>features</key>
    <integer>130367356919</integer>
    <key>name</key>
    <string>UxPlay@zhaozi</string>
    <key>audioFormats</key>
    <array>
        <dict>
            <key>type</key>
            <integer>100</integer>
            <key>audioInputFormats</key>
            <integer>67108860</integer>
            <key>audioOutputFormats</key>
            <integer>67108860</integer>
        </dict>
        <dict>
            <key>type</key>
            <integer>101</integer>
            <key>audioInputFormats</key>
            <integer>67108860</integer>
            <key>audioOutputFormats</key>
            <integer>67108860</integer>
        </dict>
    </array>
    <key>pi</key>
    <string>2e388006-13ba-4041-9a67-25dd4a43d536</string>
    <key>vv</key>
    <integer>2</integer>
    <key>statusFlags</key>
    <integer>68</integer>
    <key>keepAliveLowPower</key>
    <integer>1</integer>
    <key>sourceVersion</key>
    <string>220.68</string>
    <key>pk</key>
    <data>
    sHcn1vbNbgi1jt5SXsPN6qJSrZ9oP+shLviiBSRlVOc=
    </data>
    <key>keepAliveSendStatsAsBody</key>
    <integer>1</integer>
    <key>deviceID</key>
    <string>b0:7b:25:1d:57:c3</string>
    <key>audioLatencies</key>
    <array>
        <dict>
            <key>outputLatencyMicros</key>
            <false/>
            <key>type</key>
            <integer>100</integer>
            <key>audioType</key>
            <string>default</string>
            <key>inputLatencyMicros</key>
            <false/>
        </dict>
        <dict>
            <key>outputLatencyMicros</key>
            <false/>
            <key>type</key>
            <integer>101</integer>
            <key>audioType</key>
            <string>default</string>
            <key>inputLatencyMicros</key>
            <false/>
        </dict>
    </array>
    <key>model</key>
    <string>AppleTV3,2</string>
    <key>macAddress</key>
    <string>b0:7b:25:1d:57:c3</string>
    <key>displays</key>
    <array>
        <dict>
            <key>uuid</key>
            <string>e0ff8a27-6738-3d56-8a16-cc53aacee925</string>
            <key>widthPhysical</key>
            <false/>
            <key>heightPhysical</key>
            <false/>
            <key>width</key>
            <integer>1920</integer>
            <key>height</key>
            <integer>1080</integer>
            <key>widthPixels</key>
            <integer>1920</integer>
            <key>heightPixels</key>
            <integer>1080</integer>
            <key>rotation</key>
            <false/>
            <key>refreshRate</key>
            <integer>60</integer>
            <key>maxFPS</key>
            <integer>30</integer>
            <key>overscanned</key>
            <false/>
            <key>features</key>
            <integer>14</integer>
        </dict>
    </array>
</dict>
</plist>

httpd receiving on socket 25
conn_request

POST /pair-setup RTSP/1.0
Content-Length: 32
Content-Type: application/octet-stream
CSeq: 1
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

44 3e 54 47 2f ce 8e c2 3f 5b c2 01 34 ae f1 86 
d0 11 56 06 19 62 a7 96 7c 7c c3 07 50 86 c7 d7 

Handling request POST with URL /pair-setup

RTSP/1.0 200 OK 
CSeq: 1 
Server: AirTunes/220.68 
Content-Type: application/octet-stream 
Content-Length: 32 

89 d6 20 e8 97 19 be da 0c c2 c8 48 5e f9 3a 92 
cb ed 1c 57 70 8b f4 74 07 e2 92 cf df 9a e3 2a 

httpd receiving on socket 25
conn_request

POST /pair-verify RTSP/1.0
X-Apple-PD: 1
X-Apple-AbsoluteTime: 672837941
Content-Length: 68
Content-Type: application/octet-stream
CSeq: 2
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

01 00 00 00 79 1e fd f7 ca 38 5b 29 8a 8d c3 5a 
dc 31 11 33 b7 06 f6 ec cb 33 24 ec 60 9c f6 91 
54 fd 97 7c 44 3e 54 47 2f ce 8e c2 3f 5b c2 01 
34 ae f1 86 d0 11 56 06 19 62 a7 96 7c 7c c3 07 
50 86 c7 d7 

Handling request POST with URL /pair-verify

RTSP/1.0 200 OK 
CSeq: 2 
Server: AirTunes/220.68 
Content-Type: application/octet-stream 
Content-Length: 96 

c3 ab 08 6b 36 7c be 57 7c c3 03 54 39 41 77 d0 
d7 47 df 03 84 a1 7b b1 6f b0 32 32 04 3c 0d 11 
d3 59 b2 44 1a 7d d5 12 2f 1b a4 9d e6 75 7b 98 
60 d6 82 fa 97 eb e6 64 4c 4f 74 d2 3e 80 4e b6 
56 cc 54 d3 00 c4 4e c6 49 7f f9 90 14 e7 56 39 
22 a8 0e 31 32 a3 e9 f5 07 4c 62 be 9f a3 31 2e 

httpd receiving on socket 25
conn_request

POST /pair-verify RTSP/1.0
X-Apple-PD: 1
X-Apple-AbsoluteTime: 672837941
Content-Length: 68
Content-Type: application/octet-stream
CSeq: 3
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

00 00 00 00 0a 62 d1 b5 36 52 f7 4c 5a fc 9c ae 
c8 81 a2 58 04 fe 5f 73 1a a3 0c 07 10 bf 99 7f 
3d 50 fb 36 53 cd 91 9e 5e 04 e5 e2 c5 21 75 11 
e2 1e b5 11 89 e6 52 cb 82 57 37 f3 73 26 fd e9 
d3 d0 47 68 

Handling request POST with URL /pair-verify
2nd pair-verify step: checking signature
pair-verify: signature is verified

RTSP/1.0 200 OK 
CSeq: 3 
Server: AirTunes/220.68 
Content-Type: application/octet-stream 

httpd receiving on socket 25
conn_request

POST /fp-setup RTSP/1.0
X-Apple-ET: 32
Content-Length: 16
Content-Type: application/octet-stream
CSeq: 4
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

46 50 4c 59 03 01 01 00 00 00 00 04 02 00 00 bb 

Handling request POST with URL /fp-setup

RTSP/1.0 200 OK 
CSeq: 4 
Server: AirTunes/220.68 
Content-Type: application/octet-stream 
Content-Length: 142 

46 50 4c 59 03 01 02 00 00 00 00 82 02 00 0f 9f 
3f 9e 0a 25 21 db df 31 2a b2 bf b2 9e 8d 23 2b 
63 76 a8 c8 18 70 1d 22 ae 93 d8 27 37 fe af 9d 
b4 fd f4 1c 2d ba 9d 1f 49 ca aa bf 65 91 ac 1f 
7b c6 f7 e0 66 3d 21 af e0 15 65 95 3e ab 81 f4 
18 ce ed 09 5a db 7c 3d 0e 25 49 09 a7 98 31 d4 
9c 39 82 97 34 34 fa cb 42 c6 3a 1c d9 11 a6 fe 
94 1a 8a 6d 4a 74 3b 46 c3 a7 64 9e 44 c7 89 55 
e4 9d 81 55 00 95 49 c4 e2 f7 a3 f6 d5 ba 

httpd receiving on socket 25
conn_request

POST /fp-setup RTSP/1.0
X-Apple-ET: 32
Content-Length: 164
Content-Type: application/octet-stream
CSeq: 5
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

46 50 4c 59 03 01 03 00 00 00 00 98 00 8f 1a 9c 
3c b3 7b 06 0a 22 2f b9 12 43 64 52 86 c6 3f 36 
bb 98 3a bf 47 45 b7 86 9b 93 e3 bd 1a 6e be 5a 
09 32 80 d1 31 25 53 34 67 69 65 5e 62 46 45 82 
62 aa c7 9a 9a ed 6f 67 c8 14 c3 fa 37 3f 51 91 
04 7f c0 b6 86 e0 b3 f4 53 bf ea 8e d6 9e 50 f8 
56 19 71 01 e7 d3 4e c8 ad a3 a6 49 ee bd 67 0a 
be 91 69 f8 fe f0 6a 43 7f c1 19 e8 6f 55 c4 2a 
76 de f2 6a 4a 84 75 f9 cb 85 21 70 ee 31 ed 76 
38 c0 d2 e9 30 f0 f0 69 59 47 74 47 a1 21 de 78 
29 47 fe 7a 

Handling request POST with URL /fp-setup

RTSP/1.0 200 OK 
CSeq: 5 
Server: AirTunes/220.68 
Content-Type: application/octet-stream 
Content-Length: 32 

46 50 4c 59 03 01 04 00 00 00 00 14 38 c0 d2 e9 
30 f0 f0 69 59 47 74 47 a1 21 de 78 29 47 fe 7a 

httpd receiving on socket 25
conn_request

SETUP rtsp://172.20.10.8/18355770518045805101 RTSP/1.0
Content-Length: 523
Content-Type: application/x-apple-binary-plist
CSeq: 6
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>et</key>
    <integer>32</integer>
    <key>eiv</key>
    <data>
    Fie++jkDA/YQU1dixXEy8Q==
    </data>
    <key>timingProtocol</key>
    <string>NTP</string>
    <key>sessionUUID</key>
    <string>FEBCCC08-7AB5-4A2D-B7BD-292BA17825A4</string>
    <key>osName</key>
    <string>iPhone OS</string>
    <key>osBuildVersion</key>
    <string>19E258</string>
    <key>sourceVersion</key>
    <string>610.19.1</string>
    <key>timingPort</key>
    <integer>60048</integer>
    <key>isScreenMirroringSession</key>
    <true/>
    <key>osVersion</key>
    <string>15.4.1</string>
    <key>ekey</key>
    <data>
    RlBMWQECAQAAAAA8AAAAAKvASQe0aZLEPLvrffO3QMYAAAAQsj4DLAHCvTzL/NYln+qM
    mfobJMtwch6pvJmP2lt1HpLlXT3B
    </data>
    <key>deviceID</key>
    <string>60:8B:0E:AE:EA:27</string>
    <key>model</key>
    <string>iPhone10,1</string>
    <key>name</key>
    <string>zhaozi</string>
    <key>macAddress</key>
    <string>62:8B:0E:BA:9B:64</string>
</dict>
</plist>

Handling request SETUP with URL rtsp://172.20.10.8/18355770518045805101
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
Transport: null
SETUP 1
eiv_len = 16
16 byte aesiv (needed for AES-CBC audio decryption iv):
16 27 be fa 39 03 03 f6 10 53 57 62 c5 71 32 f1 

ekey_len = 72
ekey:
46 50 4c 59 01 02 01 00 00 00 00 3c 00 00 00 00 
ab c0 49 07 b4 69 92 c4 3c bb eb 7d f3 b7 40 c6 
00 00 00 10 b2 3e 03 2c 01 c2 bd 3c cb fc d6 25 
9f ea 8c 99 fa 1b 24 cb 70 72 1e a9 bc 99 8f da 
5b 75 1e 92 e5 5d 3d c1 

fairplay_decrypt ret = 0
16 byte aeskey (fairplay-decrypted from ekey):
9e 54 c3 44 82 fc 04 4a 65 84 72 6d 16 37 e9 6a 

32 byte shared ecdh_secret:
ae 1e ab ab b8 ad ee 49 65 ff 66 28 d7 15 73 a3 
a9 6f b2 cc 7e 34 f7 fe 9e 46 f7 97 e0 81 59 70 

Client identified as User-Agent: AirPlay/610.19.1
16 byte aeskey after sha-256 hash with ecdh_secret:
f9 2a 03 66 c0 50 af b8 57 b0 9e e2 b4 9e 27 07 

timing_rport = 60048
raop_ntp parse remote ip = 172.20.10.1
raop_ntp starting time
raop_ntp local timing port socket 26 port UDP 58212
raop_rtp parse remote ip = 172.20.10.1
raop_rtp_mirror parse remote ip = 172.20.10.1
eport = 42477, tport = 58212

RTSP/1.0 200 OK 
CSeq: 6 
Server: AirTunes/220.68 
Content-Type: application/x-apple-binary-plist 
Content-Length: 77 

raop_ntp send_len = 32, now = 1651145142003448
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>timingPort</key>
    <integer>58212</integer>
    <key>eventPort</key>
    <integer>42477</integer>
</dict>
</plist>

raop_ntp receive time type_t packetlen = 32
raop_ntp sync correction = -1651061148863674
Accepted IPv4 client on socket 27
Local: 172.20.10.8
Remote: 172.20.10.1
Open connections: 2
httpd receiving on socket 25
conn_request

GET /info RTSP/1.0
X-Apple-ProtocolVersion: 1
CSeq: 7
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

Handling request GET with URL /info

RTSP/1.0 200 OK 
CSeq: 7 
Server: AirTunes/220.68 
Content-Type: application/x-apple-binary-plist 
Content-Length: 1064 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>txtAirPlay</key>
    <data>
    GmRldmljZWlkPWIwOjdiOjI1OjFkOjU3OmMzE2ZlYXR1cmVzPTB4NUE3RkZFRTYJZmxh
    Z3M9MHg0EG1vZGVsPUFwcGxlVFYzLDJDcGs9YjA3NzI3ZDZmNmNkNmUwOGI1OGVkZTUy
    NWVjM2NkZWFhMjUyYWQ5ZjY4M2ZlYjIxMmVmOGEyMDUyNDY1NTRlNydwaT0yZTM4ODAw
    Ni0xM2JhLTQwNDEtOWE2Ny0yNWRkNGE0M2Q1MzYOc3JjdmVycz0yMjAuNjgEdnY9Mg==
    </data>
    <key>features</key>
    <integer>130367356919</integer>
    <key>name</key>
    <string>UxPlay@zhaozi</string>
    <key>audioFormats</key>
    <array>
        <dict>
            <key>type</key>
            <integer>100</integer>
            <key>audioInputFormats</key>
            <integer>67108860</integer>
            <key>audioOutputFormats</key>
            <integer>67108860</integer>
        </dict>
        <dict>
            <key>type</key>
            <integer>101</integer>
            <key>audioInputFormats</key>
            <integer>67108860</integer>
            <key>audioOutputFormats</key>
            <integer>67108860</integer>
        </dict>
    </array>
    <key>pi</key>
    <string>2e388006-13ba-4041-9a67-25dd4a43d536</string>
    <key>vv</key>
    <integer>2</integer>
    <key>statusFlags</key>
    <integer>68</integer>
    <key>keepAliveLowPower</key>
    <integer>1</integer>
    <key>sourceVersion</key>
    <string>220.68</string>
    <key>pk</key>
    <data>
    sHcn1vbNbgi1jt5SXsPN6qJSrZ9oP+shLviiBSRlVOc=
    </data>
    <key>keepAliveSendStatsAsBody</key>
    <integer>1</integer>
    <key>deviceID</key>
    <string>b0:7b:25:1d:57:c3</string>
    <key>audioLatencies</key>
    <array>
        <dict>
            <key>outputLatencyMicros</key>
            <false/>
            <key>type</key>
            <integer>100</integer>
            <key>audioType</key>
            <string>default</string>
            <key>inputLatencyMicros</key>
            <false/>
        </dict>
        <dict>
            <key>outputLatencyMicros</key>
            <false/>
            <key>type</key>
            <integer>101</integer>
            <key>audioType</key>
            <string>default</string>
            <key>inputLatencyMicros</key>
            <false/>
        </dict>
    </array>
    <key>model</key>
    <string>AppleTV3,2</string>
    <key>macAddress</key>
    <string>b0:7b:25:1d:57:c3</string>
    <key>displays</key>
    <array>
        <dict>
            <key>uuid</key>
            <string>e0ff8a27-6738-3d56-8a16-cc53aacee925</string>
            <key>widthPhysical</key>
            <false/>
            <key>heightPhysical</key>
            <false/>
            <key>width</key>
            <integer>1920</integer>
            <key>height</key>
            <integer>1080</integer>
            <key>widthPixels</key>
            <integer>1920</integer>
            <key>heightPixels</key>
            <integer>1080</integer>
            <key>rotation</key>
            <false/>
            <key>refreshRate</key>
            <integer>60</integer>
            <key>maxFPS</key>
            <integer>30</integer>
            <key>overscanned</key>
            <false/>
            <key>features</key>
            <integer>14</integer>
        </dict>
    </array>
</dict>
</plist>

httpd receiving on socket 25
conn_request

GET_PARAMETER rtsp://172.20.10.8/18355770518045805101 RTSP/1.0
Content-Length: 8
Content-Type: text/parameters
CSeq: 8
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

volume 

Handling request GET_PARAMETER with URL rtsp://172.20.10.8/18355770518045805101

RTSP/1.0 200 OK 
CSeq: 8 
Server: AirTunes/220.68 
Content-Type: text/parameters 
Content-Length: 13 

volume: 0.0 

httpd receiving on socket 25
conn_request

RECORD rtsp://172.20.10.8/18355770518045805101 RTSP/1.0
CSeq: 9
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

Handling request RECORD with URL rtsp://172.20.10.8/18355770518045805101
raop_handler_record

RTSP/1.0 200 OK 
CSeq: 9 
Server: AirTunes/220.68 
Audio-Latency: 11025 
Audio-Jack-Status: connected; type=analog 

httpd receiving on socket 25
conn_request

SET_PARAMETER rtsp://172.20.10.8/18355770518045805101 RTSP/1.0
Content-Length: 20
Content-Type: text/parameters
CSeq: 10
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

volume: -20.000000 

Handling request SET_PARAMETER with URL rtsp://172.20.10.8/18355770518045805101

RTSP/1.0 200 OK 
CSeq: 10 
Server: AirTunes/220.68 

httpd receiving on socket 25
conn_request

SETUP rtsp://172.20.10.8/18355770518045805101 RTSP/1.0
Content-Length: 204
Content-Type: application/x-apple-binary-plist
CSeq: 11
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
User-Agent: AirPlay/610.19.1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>streams</key>
    <array>
        <dict>
            <key>timestampInfo</key>
            <array>
                <dict>
                    <key>name</key>
                    <string>SubSu</string>
                </dict>
                <dict>
                    <key>name</key>
                    <string>BePxT</string>
                </dict>
                <dict>
                    <key>name</key>
                    <string>AfPxT</string>
                </dict>
                <dict>
                    <key>name</key>
                    <string>BefEn</string>
                </dict>
                <dict>
                    <key>name</key>
                    <string>EmEnc</string>
                </dict>
            </array>
            <key>latencyMs</key>
            <integer>75</integer>
            <key>type</key>
            <integer>110</integer>
            <key>streamConnectionID</key>
            <integer>-8167967639424056559</integer>
        </dict>
    </array>
</dict>
</plist>

Handling request SETUP with URL rtsp://172.20.10.8/18355770518045805101
DACP-ID: 8F685595AF75741
Active-Remote: 1501608579
Transport: null
type = 110
streamConnectionID (needed for AES-CTR video decryption key and iv): 10278776434285495057
raop_rtp_mirror starting mirroring
raop_rtp_mirror local data port socket 28 port TCP 37593
Mirroring initialized successfully

RTSP/1.0 200 OK 
CSeq: 11 
Server: AirTunes/220.68 
Content-Type: application/x-apple-binary-plist 
Content-Length: 85 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>streams</key>
    <array>
        <dict>
            <key>dataPort</key>
            <integer>37593</integer>
            <key>type</key>
            <integer>110</integer>
        </dict>
    </array>
</dict>
</plist>

raop_rtp_mirror accepting client
raop_ntp send_len = 32, now = 1651145145004089
raop_ntp receive timeout 1 (limit 5) (request sent 2022-04-28 19:25:45.631737)
raop_ntp send_len = 32, now = 1651145148334312
raop_ntp receive timeout 2 (limit 5) (request sent 2022-04-28 19:25:48.961960)
^CStopping...
fduncanh commented 2 years ago

timing_rport = 60048
raop_ntp parse remote ip = 172.20.10.1
raop_ntp starting time
raop_ntp local timing port socket 26 port UDP 58212
raop_rtp parse remote ip = 172.20.10.1
raop_rtp_mirror parse remote ip = 172.20.10.1
eport = 42477, tport = 58212

uxplay has sent a request to the client for a ntp timestamp on the clients udp port 60048 expecting an answer on server udp port 58212, but no response was received. I have no idea why. You would have to monitor the network traffic to see what was happening. I suspect something wrong with the iPhone, since other iPhones work. Some kind of MDM restriction?

There is no obvious UxPlay problem. Did you try with RPiPlay https://github.com/FD-/RpIplay which UxPlay is derived from?

If rpiplay also doesnt work, it confirms an issue with your iPhone.

zhaocius commented 2 years ago

timing_rport = 60048
raop_ntp parse remote ip = 172.20.10.1
raop_ntp starting time
raop_ntp local timing port socket 26 port UDP 58212
raop_rtp parse remote ip = 172.20.10.1
raop_rtp_mirror parse remote ip = 172.20.10.1
eport = 42477, tport = 58212

uxplay has sent a request to the client for a ntp timestamp on the clients udp port 60048 expecting an answer on server udp port 58212, but no response was received. I have no idea why. You would have to monitor the network traffic to see what was happening. I suspect something wrong with the iPhone, since other iPhones work. Some kind of MDM restriction?

There is no obvious UxPlay problem. Did you try with RPiPlay https://github.com/FD-/RpIplay which UxPlay is derived from?

If rpiplay also doesnt work, it confirms an issue with your iPhone.

i tried the RpIplay and it didn't work either. well, i'm not going to bother with this problem anymore.

fduncanh commented 2 years ago

OK , closing issue, doesnt appear to be a UxPlay issue