mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-11-30 01:34:05 +00:00
Bind our UDP sockets to the same local address used by RTSP handshake
This means we can ensure a consistent local address for our outgoing PING traffic to keep the UDP flows alive without having to call connect() which breaks with multi-homed hosts on GFE and Sunshine v0.20 and earlier.
This commit is contained in:
1 parent
c86f49ee7f
commit
05c3f9c754
10 files changed
+66
-40
No files matched your search
+8
-8
@@ -75,13 +75,6 @@ int initializeAudioStream(void) {
|
||||
memcpy(&avRiKeyId, StreamConfig.remoteInputAesIv, sizeof(avRiKeyId));
|
||||
avRiKeyId = BE32(avRiKeyId);
|
||||
|
||||
// For GFE 3.22 compatibility, we must start the audio ping thread before the RTSP handshake.
|
||||
// It will not reply to our RTSP PLAY request until the audio ping has been received.
|
||||
rtpSocket = bindUdpSocket(RemoteAddr.ss_family, 0);
|
||||
if (rtpSocket == INVALID_SOCKET) {
|
||||
return LastSocketFail();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,8 +85,15 @@ int notifyAudioPortNegotiationComplete(void) {
|
||||
LC_ASSERT(!pingThreadStarted);
|
||||
LC_ASSERT(AudioPortNumber != 0);
|
||||
|
||||
// For GFE 3.22 compatibility, we must start the audio ping thread before the RTSP handshake.
|
||||
// It will not reply to our RTSP PLAY request until the audio ping has been received.
|
||||
rtpSocket = bindUdpSocket(RemoteAddr.ss_family, &LocalAddr, AddrLen, 0);
|
||||
if (rtpSocket == INVALID_SOCKET) {
|
||||
return LastSocketFail();
|
||||
}
|
||||
|
||||
// Connect our audio socket to the target address and port
|
||||
int err = connectUdpSocket(rtpSocket, &RemoteAddr, RemoteAddrLen, AudioPortNumber);
|
||||
int err = connectUdpSocket(rtpSocket, &RemoteAddr, AddrLen, AudioPortNumber);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user