Revert "Use connected datagram sockets for audio and video"

This causes problems on multi-homed GFE and Sunshine (prior to v0.21) hosts
because audio and video data can be sent back from an address different than
the one we used as our original destination address.

This reverts commit c13f4a323f.
This commit is contained in:
Cameron Gutman committed 2023-10-26 01:15:27 -05:00
1 parent 05c3f9c754
commit bbf15af837
4 files changed
+17 -38

No files matched your search

+8 -11
View File
@@ -50,6 +50,12 @@ void destroyVideoStream(void) {
// UDP Ping proc
static void VideoPingThreadProc(void* context) {
char legacyPingData[] = { 0x50, 0x49, 0x4E, 0x47 };
LC_SOCKADDR saddr;
LC_ASSERT(VideoPortNumber != 0);
memcpy(&saddr, &RemoteAddr, sizeof(saddr));
SET_PORT(&saddr, VideoPortNumber);
// We do not check for errors here. Socket errors will be handled
// on the read-side in ReceiveThreadProc(). This avoids potential
@@ -61,10 +67,10 @@ static void VideoPingThreadProc(void* context) {
pingCount++;
VideoPingPayload.sequenceNumber = BE32(pingCount);
send(rtpSocket, (char*)&VideoPingPayload, sizeof(VideoPingPayload), 0);
sendto(rtpSocket, (char*)&VideoPingPayload, sizeof(VideoPingPayload), 0, (struct sockaddr*)&saddr, AddrLen);
}
else {
send(rtpSocket, legacyPingData, sizeof(legacyPingData), 0);
sendto(rtpSocket, legacyPingData, sizeof(legacyPingData), 0, (struct sockaddr*)&saddr, AddrLen);
}
PltSleepMsInterruptible(&udpPingThread, 500);
@@ -268,15 +274,6 @@ int startVideoStream(void* rendererContext, int drFlags) {
return LastSocketError();
}
// Connect our video socket to the target address and port
LC_ASSERT(VideoPortNumber != 0);
err = connectUdpSocket(rtpSocket, &RemoteAddr, AddrLen, VideoPortNumber);
if (err != 0) {
VideoCallbacks.cleanup();
closeSocket(rtpSocket);
return err;
}
VideoCallbacks.start();
err = PltCreateThread("VideoRecv", VideoReceiveThreadProc, NULL, &receiveThread);