Commit graph

67 commits

Author SHA1 Message Date
ns6089
2a5a1f3e8a
Add support for LTR ACK control messages (#122)
* Add support for LTR ACK control messages
2026-01-20 21:47:38 -06:00
Cameron Gutman
06f18be4bf Allow negotiation of audio encryption using new encryption flags 2024-01-14 14:10:45 -06:00
Cameron Gutman
b6bbb4fb26 Add new RTSP encryption flags 2024-01-14 12:08:37 -06:00
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
3ed3ba6253 Remove separate codec, HDR, and remote bitrate adjustments
We currently scale bitrate based on both remote vs local, SDR vs HDR, and H.264 vs
HEVC vs AV1. This has led to a lot of user confusion wondering why the bitrate
doesn't seem to match their selection in some configurations.

In H.264 local streams, we will currently overshoot the selected bitrate by about
20% due to FEC, while remote streams will be right around the selected bitrate due
to remote-specific FEC bitrate adjustments.

HEVC and AV1 streams (as configured by most clients) basically behave similarly
between local and remote, since the codec bitrate adjustment factor of 75% is nearly
the same as the FEC bitrate adjustment factor of 80%. However, this adjustment was
only performed for SDR streams so local HDR streams would overshoot like H.264.

This change cleans up all this mess by using a single non-codec-specific video
bitrate adjustment for FEC in all cases. It also allows Sunshine to perform the FEC
adjustment on its end if the default FEC value of 20% has been overridden by the
user or if we implement dynamic FEC support in the future.

The net result is HEVC and AV1 SDR streams will only see a tiny bitrate increase,
but HDR and H.264 may see noticable 20% bitrate reductions that may require the
user to adjust their bitrate setting to reach the effective value they got before.
However, the new behavior should be more intuitive for users going forward since
changing codecs, using a VPN, or enabling HDR won't cause significant changes to the
video bitrate.
2023-12-03 20:09:34 -06: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
c3e9aea843 Fix non-standard forward declaration 2023-09-18 21:19:59 -05:00
Cameron Gutman
78e06eb613 Batch control stream messages 2023-08-19 11:27:16 -05:00
Cameron Gutman
8b0dbf7158 Send client feature flags indicating FEC status support 2023-08-19 11:03:00 -05:00
Cameron Gutman
325518b47a Add LiGetHostFeatureFlags() API 2023-08-03 22:09:30 -05:00
Cameron Gutman
27428e655b Move ServerCodecModeSupport values into public header 2023-07-16 15:30:55 -05:00
Cameron Gutman
377d37503f Split controller motion events onto their own channels 2023-07-04 16:18:52 -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
1125dc3dba Replace enableHdr option with directly receiving ServerCodecModeSupport value from XML 2023-07-02 23:28:10 -05:00
Cameron Gutman
9bf09d681e Plumb Sunshine feature flags SDP attribute for protocol extensions 2023-06-18 15:52:51 -05:00
Cameron Gutman
4a48024dc8 Introduce new input extension functions for touch, pen, motion, and controller arrival 2023-06-11 19:38:22 -05:00
Cameron Gutman
169078d0a9 Allow encoder to pick optimal ref frame count if RFI is supported by the decoder 2023-04-29 13:11:38 -05: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
dc186082a7 Add protocol extension for multi-client-compatible ping support 2023-02-12 01:23:25 -06:00
Cameron Gutman
07beb0f0a5 Accept any negative version as Sunshine 2023-01-16 21:38:36 -06:00
Cameron Gutman
071e595766 Implement horizontal scrolling protocol extension for Sunshine 2023-01-16 20:56:51 -06:00
Cameron Gutman
50c0a51b10 Improve high quality audio support
High quality audio now works on IPv6 and remote connections
2022-11-04 21:44:07 -05:00
Cameron Gutman
44668bd256 Distinguish speculative RFIs from normal FEC-initiated RFIs 2022-10-06 21:21:00 -05:00
Cameron Gutman
7d1a081fd0 Fix signature of notifyFrameLost() and add additional assert 2022-10-06 20:38:55 -05:00
Cameron Gutman
e951302927 Disable RFI when streaming from a server that doesn't support it 2022-10-06 20:01:40 -05:00
Cameron Gutman
5e1be51b84 Implement predictive RFI to recover more quickly from frame loss
With predictive RFI, we can recover from a lost frame as soon as the next frame
by predicting whether we will have enough FEC data to be be able to recover a
frame based on the sequence numbers of the received packets.
2022-10-05 22:04:22 -05:00
Cameron Gutman
9240090983 Add LiRequestIdrFrame() API for requesting an IDR frame on demand 2022-10-05 00:46:56 -05: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
56ccd99cc7 Dynamically determine audio, video, and control ports from RTSP DESCRIBE response 2021-07-01 23:45:33 -05:00
Cameron Gutman
5e3aa93479 Add a recording mode for debugging purposes 2021-06-20 11:15:30 -05:00
Cameron Gutman
68c784445c Introduce optional pull-based API for video data 2021-06-13 15:14:38 -05:00
Cameron Gutman
9361c325bb Rename RtpFecQueue to RtpVideoQueue to match RtpAudioQueue 2021-06-01 22:57:26 -05:00
Cameron Gutman
89918324ce Implement audio FEC recovery support 2021-06-01 18:31:56 -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
8f371343cd Consolidate includes 2021-04-29 17:22:15 -05:00
Cameron Gutman
db81f1e512 Add support for audio stream encryption
Clients must opt-in using the new encryptionFlags field
2021-04-22 00:20:17 -05:00
Cameron Gutman
d62ee951a0 Refactor OpenSSL usage into a platform-specific file to allow other crypto backends 2021-04-17 17:47:53 -05:00
Cameron Gutman
d0c3513504 Reorder audio initialization and RTSP handshake to avoid RTSP PLAY failure on GFE 3.22 2021-04-09 08:39:28 -05:00
Cameron Gutman
c0c200e72c Fix APP_VERSION_AT_LEAST macro definition 2021-04-09 07:51:05 -05:00
Cameron Gutman
a51cc972d3 Add APP_VERSION_AT_LEAST() macro for cleaner GFE version checks 2021-04-09 07:26:24 -05:00
Cameron Gutman
5f9f7ce407 Code cleanup: use stdbool.h 2020-11-30 20:38:13 -06:00
Cameron Gutman
1b022a0d05 Terminate the connection if we can't receive a key frame in 10 seconds 2020-08-29 21:00:05 -07:00
Cameron Gutman
7d0458a16b Dynamically allocate the RTSP response buffer 2020-04-29 19:58:50 -07:00
Cameron Gutman
607aaca93f Replace AUDIO_CONFIGURATION constants with MAKE_AUDIO_CONFIGURATION() macro 2020-03-31 21:33:34 -07:00
Cameron Gutman
fb60ae6a4d Parse Opus parameters from RTSP DESCRIBE response 2020-03-31 20:52:38 -07:00
Cameron Gutman
c1a26618d4 Increase audio packet duration for low bandwidth connections 2019-11-30 21:59:34 -06:00
Cameron Gutman
a9780361a3 Fix high-quality surround sound breaking audio when streaming over the Internet or IPv6 2019-08-04 15:05:40 -07:00
Cameron Gutman
59481c085a Add support for requesting 20 ms audio frames for slow Opus decoders 2019-05-04 15:33:48 -07:00