FDH2 / UxPlay

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

Unable to connect after two timeouts #126

Closed aelmod closed 1 year ago

aelmod commented 1 year ago

[WIN32] Unable to connect after two timeouts - UxPlay does not appear in mirroring menu

Steps to reproduce:

On Windows with this case (on the third attempt to connect) I no longer see UxPlay in the mirroring menu. And no error in the console. Please, check this case on Linux or macOS to determine if this issue platform related.

Logs:

using randomly-generated MAC address b2:74:33:5f:51:0c
Initialized server socket(s)
Accepted IPv4 client on socket 8892
Local: 192.168.31.147
Remote: 192.168.31.223
Open connections: 1
Client identified as User-Agent: AirPlay/620.8.2
Accepted IPv4 client on socket 8928
Local: 192.168.31.147
Remote: 192.168.31.223
Open connections: 2
raop_rtp_mirror starting mirroring
raop_rtp_mirror could not set stream socket keepalive time 0 No error
raop_rtp_mirror could not set stream socket keepalive interval 0 No error
raop_rtp_mirror could not set stream socket keepalive probes 0 No error
Begin streaming to GStreamer video pipeline
raop_rtp_mirror tcp socket is closed, got 0 bytes of 128 byte header
raop_rtp_mirror->running is no longer true
Connection closed for socket 8892
Destroying connection
Open connections: 1
Connection closed for socket 8928
Destroying connection
Open connections: 0
Accepted IPv4 client on socket 3824
Local: 192.168.31.147
Remote: 192.168.31.223
Open connections: 1
Client identified as User-Agent: AirPlay/620.8.2
Accepted IPv4 client on socket 936
Local: 192.168.31.147
Remote: 192.168.31.223
Open connections: 2
raop_rtp_mirror starting mirroring
raop_rtp_mirror could not set stream socket keepalive time 0 No error
raop_rtp_mirror could not set stream socket keepalive interval 0 No error
raop_rtp_mirror could not set stream socket keepalive probes 0 No error
Begin streaming to GStreamer video pipeline
raop_rtp_mirror tcp socket is closed, got 0 bytes of 128 byte header
raop_rtp_mirror->running is no longer true
Connection closed for socket 3824
Destroying connection
Open connections: 1
Connection closed for socket 936
Destroying connection
Open connections: 0

Debug logs after second timeout:

raop_ntp send_len = 32, now = 1662072125957569
raop_ntp receive time type_t=83 packetlen = 32
80 d3 00 07 00 00 00 00 e6 bb b3 bd f5 23 3d f2
83 ad 50 c5 5c fb c3 c5 83 ad 50 c5 5d 08 f9 14

raop_ntp sync correction = 0
httpd receiving on socket 9036

Received video streaming performance info packet from client
conn_request

POST /feedback RTSP/1.0
CSeq: 53
DACP-ID: ****************
Active-Remote: **********
User-Agent: AirPlay/620.8.2

Handling request POST with URL /feedback
raop_handler_feedback

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

Received video streaming performance info packet from client
httpd receiving on socket 9036
conn_request

POST /feedback RTSP/1.0
CSeq: 54
DACP-ID: ****************
Active-Remote: **********
User-Agent: AirPlay/620.8.2

Handling request POST with URL /feedback
raop_handler_feedback

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

Received video streaming performance info packet from client
httpd receiving on socket 9036
conn_request

SET_PARAMETER rtsp://192.168.31.147/6534473199879212972 RTSP/1.0
Content-Length: 20
Content-Type: text/parameters
CSeq: 55
DACP-ID: ****************
Active-Remote: **********
User-Agent: AirPlay/620.8.2

volume: -30.000000

Handling request SET_PARAMETER with URL rtsp://192.168.31.147/6534473199879212972

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

raop_rtp_mirror: unidentified extra header data  710.000000, 0.000000
begin video stream wxh = 500x1080; source 500x1080
httpd receiving on socket 9036
raop_rtp_mirror width_source = 500.000000 height_source = 1080.000000 width = 500.000000 height = 1080.000000
raop_rtp_mirror: sps/pps header size = 6
raop_rtp_mirror h264 sps/pps header:
01 64 00 20 ff e1

raop_rtp_mirror sps size = 18
raop_rtp_mirror h264 Sequence Parameter Set:
27 64 00 20 ac 13 14 50 20 02 27 9e 59 b8 08 08
08 10

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 tcp socket is closed, got 0 bytes of 128 byte header
conn_request

TEARDOWN rtsp://192.168.31.147/6534473199879212972 RTSP/1.0
Content-Length: 69
Content-Type: application/x-apple-binary-plist
CSeq: 56
DACP-ID: ****************
Active-Remote: **********
User-Agent: AirPlay/620.8.2

<?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>type</key>
                        <integer>110</integer>
                </dict>
        </array>
</dict>
</plist>

Handling request TEARDOWN with URL rtsp://192.168.31.147/6534473199879212972
<?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>type</key>
                        <integer>110</integer>
                </dict>
        </array>
</dict>
</plist>

TEARDOWN request,  96=0, 110=1
raop_rtp_mirror->running is no longer true
raop_rtp_mirror exiting TCP thread

RTSP/1.0 200 OK
CSeq: 56
Server: AirTunes/220.68
Connection: close

httpd receiving on socket 9036
conn_request

TEARDOWN rtsp://192.168.31.147/6534473199879212972 RTSP/1.0
Content-Length: 42
Content-Type: application/x-apple-binary-plist
CSeq: 57
DACP-ID: ****************
Active-Remote: **********
User-Agent: AirPlay/620.8.2

<?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/>
</plist>

Handling request TEARDOWN with URL rtsp://192.168.31.147/6534473199879212972
<?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/>
</plist>

TEARDOWN request,  96=0, 110=0

RTSP/1.0 200 OK
CSeq: 57
Server: AirTunes/220.68
Connection: close

httpd receiving on socket 9036
Connection closed for socket 9036
Destroying connection
Open connections: 1
raop_ntp stopping time thread
raop_ntp exiting thread
raop_ntp stopped time thread
httpd receiving on socket 9032
Connection closed for socket 9032
Destroying connection
Open connections: 0
GStreamer video pipeline will be:
"appsrc name=video_source ! queue ! h264parse ! decodebin ! videoconvert ! autovideosink name=video_sink sync=false"
Initialized GStreamer video renderer
fduncanh commented 1 year ago

This in your debug output seems very significant!

Open connections: 2
raop_rtp_mirror starting mirroring
raop_rtp_mirror could not set stream socket keepalive time 0 No error
raop_rtp_mirror could not set stream socket keepalive interval 0 No error
raop_rtp_mirror could not set stream socket keepalive probes 0 No error
Begin streaming to GStreamer video pipeline
raop_rtp_mirror tcp socket is closed, got 0 bytes of 128 byte header
raop_rtp_mirror->running is no longer true

I am now using the keepalive settings from ludimus. Please recheck with current version, and look for errors in the new README section about Windows. The keepalive "options" parameter may should be a DWORD (32 bit integer) in widows, right now its an int.

Everything is now in main branch

fduncanh commented 1 year ago

Re: the MAC address on windows, it seems that GetAdaptersAddresses can be used. https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getadaptersaddresses

EDIT: this is now added

fduncanh commented 1 year ago

@aelmod Windows audio is now fixed : it needed an "audioresample" in the pipeline becase the wasapi plugin needed to resample from 41.2 kHz to 48 kHz.

now works great without uxplay audio options needed.

also cmake --install . --prefix /usr/local

installs properly.

fduncanh commented 1 year ago

@aelmod can you check that you still have your problem in the latest UxPlay Thanks!

fduncanh commented 1 year ago

seems to be working on windows now.

Thank you so much for getting this done!

Please review (including the readme write up) and suggest any changes (for example, maybe uxplay should be installed in /mingw64 instead of /usr/local) EDIT : I changed the README to suggest this