Commit graph

108 commits

Author SHA1 Message Date
Cameron Gutman
6e9ed871bc Add support for X-SS-Connect-Data in RTSP SETUP for control stream
This allows the host to provide a 32-bit integer that will be sent
in the data of the ENet connect event, similar to X-SS-Ping-Payload
for video and audio.

The host can use this data to uniquely identify a client when IP
addresses are not stable across the various separate connections,
such as when the client is behind a Carrier-Grade NAT.
2023-12-28 16:56:06 -06:00
Cameron Gutman
3aae4cdc59 Improve ENet socket error propagation for better debuggability 2023-12-22 13:45:50 -06:00
Cameron Gutman
5de4a5b85a Bind the control stream socket to the local address used for other UDP traffic 2023-10-26 01:27:31 -05:00
Cameron Gutman
05c3f9c754 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.
2023-10-26 01:09:26 -05:00
Cameron Gutman
5e844aad08 Fix UBSan warning for signed integer overflow 2023-10-11 20:09:48 -05:00
Cameron Gutman
620b4be477 Add separate LC_ASSERT_VT() for asserts that only apply for valid traffic 2023-10-11 20:01:39 -05:00
Cameron Gutman
c1744de069 Batch async control stream callbacks 2023-09-18 23:02:44 -05:00
Cameron Gutman
20130e210b Invoke control stream callbacks on a separate thread
Time spent processing client callbacks would contribute to increased control stream latency,
which means higher RTTs, more lengthy waits before retransmissions, and higher client-reported
network latency stats.
2023-09-17 14:49:06 -05:00
Cameron Gutman
515bea6fb4 Fix GCC static analysis warnings 2023-09-15 22:03:27 -05:00
Cameron Gutman
2bb026c763 Suppress connection warnings for the first sampling period 2023-08-23 21:03:40 -05:00
Cameron Gutman
dc62a6f88e Send periodic pings and FEC status messages more frequently 2023-08-19 11:39:55 -05:00
Cameron Gutman
78e06eb613 Batch control stream messages 2023-08-19 11:27:16 -05:00
Cameron Gutman
f2cea4d6b0 Update ENet submodule 2023-07-30 14:02:28 -05:00
Cameron Gutman
6d039a646b Fix extended delays for unreliable/unsequenced traffic on high latency connections 2023-07-25 23:30:45 -05:00
Cameron Gutman
2ac25bebaa Send unreliable traffic as reliable when we have just one channel 2023-07-16 15:11:09 -05:00
Cameron Gutman
f3b7edbd11 Overflow onto channel 0 rather than distributing
This allows the host to make some assumptions about channel IDs
2023-07-04 16:51:35 -05:00
Cameron Gutman
377d37503f Split controller motion events onto their own channels 2023-07-04 16:18:52 -05:00
Cameron Gutman
c8828d586c Don't send periodic pings as reliable traffic 2023-07-04 15:03:01 -05:00
Cameron Gutman
0095141e08 Split control data into multiple channels and optimize packet flags based on type of data
This can significantly performance on lossy networks by avoiding HOL blocking.
2023-07-04 14:49:21 -05:00
Cameron Gutman
a0f8c060c0 Introduce new protocol extensions for controller RGB LEDs and battery state 2023-07-02 14:38:54 -05:00
Cameron Gutman
ce98d4fb2f Introduce connection callbacks for trigger rumble and motion events 2023-06-11 19:42:02 -05:00
Cameron Gutman
7e089435c7 Reduce max number of frame status reports per second 2023-02-20 16:48:12 -06:00
Cameron Gutman
55a6d58225 Fix leak 2023-02-20 16:42:23 -06:00
Cameron Gutman
207f981fd0 Send final FEC frame status info to Sunshine
This info will be used for dynamic FEC and dynamic video packet batch size.
2023-02-20 16:24:48 -06:00
Cameron Gutman
82105f2f8f Declare packetFreed as volatile 2023-02-15 01:42:48 -06:00
Cameron Gutman
54d46ca80f Put backpressure on control stream sender when the window fills up
Without any backpressure, ENet will just let packets accumulate forever.
2023-02-14 23:02:18 -06:00
Cameron Gutman
79b5ef0e1e Add Sunshine protocol extension for passing HDR metadata 2023-01-16 21:06:33 -06:00
Cameron Gutman
9240090983 Add LiRequestIdrFrame() API for requesting an IDR frame on demand 2022-10-05 00:46:56 -05:00
Cameron Gutman
502f799a73 Add ML_ERROR_FRAME_CONVERSION error constant 2022-10-04 19:37:35 -05:00
Cameron Gutman
ec420615a1 Fix GCC build 2022-08-10 00:18:56 -05:00
Cameron Gutman
ef9c5a65cf Return a better error code when the control stream connection fails 2022-08-09 23:26:33 -05:00
Cameron Gutman
c72f30da2e Improve logging for control stream connection failure 2022-08-09 23:12:31 -05:00
Cameron Gutman
abc7acb5e4 Add HDR mode APIs 2022-01-28 21:29:14 -06:00
Cameron Gutman
cfe75eb569 Add workaround for keyboard and UTF-8 events interfering with each other 2022-01-17 21:56:06 -06:00
Cameron Gutman
b2c39883bf Fix incorrect IV for encrypted control stream packets on big-endian machines 2021-07-17 22:29:30 -05:00
Cameron Gutman
5820cc2048 Fix double-free if unencrypted packet is received on encrypted stream 2021-07-08 20:50:09 -05:00
Cameron Gutman
3b9d8a3176 Assert that the port numbers are set prior to being used 2021-07-02 01:44:11 -05:00
Cameron Gutman
56ccd99cc7 Dynamically determine audio, video, and control ports from RTSP DESCRIBE response 2021-07-01 23:45:33 -05:00
Cameron Gutman
d9ea208dea Avoid unlock and immediate relock of mutex 2021-05-25 19:57:06 -05:00
Cameron Gutman
edf1838708 Expose RTT information from ENet 2021-05-15 13:58:54 -05:00
Cameron Gutman
5feb3b6f90 Dynamically adjust wait time to hit the next RTO 2021-05-15 12:47:20 -05:00
Cameron Gutman
50c0648de2 Run a full enet_host_service() rather than just enet_host_flush() on send 2021-05-15 12:26:01 -05:00
Cameron Gutman
97216e1704 Wait for ENet socket readability rather than just sleeping 10 ms 2021-05-15 00:15:16 -05:00
Cameron Gutman
43eb36e17a Simplify and improve graceful disconnect logic 2021-05-14 22:36:13 -05:00
Cameron Gutman
387ff48a65 Perform a graceful disconnection if the termination was locally initiated 2021-05-14 22:06:07 -05:00
Cameron Gutman
132833deeb Limit RTO to 2x RTT and fix early peer timeout expiration 2021-05-14 20:44:19 -05:00
Cameron Gutman
a1a150c300 Refactor IDR/RFI requests to simplify code and fix race conditions 2021-05-14 20:41:20 -05:00
Cameron Gutman
a000f9f8b8 Validate that claimed length doesn't exceed the actual length 2021-04-29 17:26:59 -05:00
Cameron Gutman
8f371343cd Consolidate includes 2021-04-29 17:22:15 -05:00
Cameron Gutman
da68e64d9b Fix various MSVC warnings 2021-04-29 17:21:12 -05:00