63 Commits

Author SHA1 Message Date
ns6089
907110c4ec Support YUV 4:4:4 formats 2024-06-06 02:31:32 -05:00
Cameron Gutman
298f356acb Adjust the requested packet size to account for the encryption header 2024-01-14 18:42:41 -06:00
Cameron Gutman
06f18be4bf Allow negotiation of audio encryption using new encryption flags 2024-01-14 14:10:45 -06:00
Cameron Gutman
b74b6e883c Add video encryption support 2024-01-14 14:04:52 -06:00
Cameron Gutman
3430ee2c3a Add control stream encryption v2 support 2024-01-14 12:58:48 -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
8b84d17c8d Replace additional unsafe string functions 2023-10-06 17:33:37 -05:00
Cameron Gutman
a258b7e12b Fix leak in unreachable codepath 2023-09-18 22:59:03 -05:00
Cameron Gutman
315d0bbfa3 Use modern string parsing functions in SdpGenerator 2023-09-12 21:24:28 -05:00
Cameron Gutman
8b0dbf7158 Send client feature flags indicating FEC status support 2023-08-19 11:03:00 -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
e36bde4acc Implement AV1 codec support
This has a breaking change to StreamConfiguration that requires client updates.
2023-07-02 22:16:20 -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
af1dbfe505 Use APP_VERSION_AT_LEAST in a couple other places 2022-10-22 14:45:19 -05:00
Cameron Gutman
bfade1d795 Add workaround for nvstreamer.exe crash on GFE 3.26 when streaming below 720x540 2022-10-04 18:33:12 -05:00
Cameron Gutman
72f4f9e7b1 Disable BLL-FEC on GFE 3.26
The effective FEC percentage is much lower which negatively impacts performance on lossy networks
2022-10-04 17:51:01 -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
f05be47ed8 Replace other hardcoded ports 2021-07-02 00:27:35 -05:00
Cameron Gutman
5a71a4c092 Use 10ms packets for slow Opus decoders
With the old 20ms packets, an FEC block was 80ms of audio data.
This is enough data that waiting for the FEC shards can cause
an audio data underflow. The burst of 80ms of audio data after
reassembly fails can then lead clients to drop samples due to
excessive queued data.
2021-06-07 23:20:40 -05:00
Cameron Gutman
c057075eac Set minRequiredFecPackets to better handle lossy links at low bitrates 2021-05-16 09:27:50 -05:00
Cameron Gutman
7174caf5f1 Implement support for multi-FEC frames 2021-04-26 20:36:07 -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
5782246b30 Add hack to prevent video glitching on GFE 3.22 when packets per frame exceed 120 2021-04-09 19:30:38 -05:00
Cameron Gutman
12f0f3d6d7 Add encrypted control stream support for GFE 3.22
Receive-side not yet fully working
2021-04-09 10:25:24 -05:00
Cameron Gutman
9a706fd78c Temporarily switch to control protocol 9 on GFE 3.22 2021-04-09 07:45:17 -05:00
Cameron Gutman
5f9f7ce407 Code cleanup: use stdbool.h 2020-11-30 20:38:13 -06:00
Cameron Gutman
e9ee868da4 Don't enable QoS for IPv6/NAT64 either 2020-10-31 17:08:29 -05:00
Cameron Gutman
dbf81dcb63 Don't enable QoS for remote IPv4 streams
Some broken routers/CPE will drop all QoS tagged packets
2020-10-28 20:35:45 -05:00
Cameron Gutman
d9d2668473 Fix audio problems caused by stale HighQualitySurroundSupported and HighQualitySurroundEnabled values 2020-04-02 18:44:13 -07:00
Cameron Gutman
607aaca93f Replace AUDIO_CONFIGURATION constants with MAKE_AUDIO_CONFIGURATION() macro 2020-03-31 21:33:34 -07:00
Cameron Gutman
c1b8aa266f Use 10 ms audio packets on low bitrate streams to balance latency and bandwidth 2020-03-18 20:03:56 -07:00
Cameron Gutman
e60a7ef75f Add color space and color range options 2019-12-14 14:32:47 -08:00
Cameron Gutman
b0213d06a7 Always use DSCP marking for our AV traffic 2019-12-12 18:43:57 -08:00
Cameron Gutman
f5ae5df5d0 Fix logic error in low bitrate audio duration selection 2019-12-01 19:22:16 -08: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
6245934462 Fix streaming from Gen 3 servers 2019-07-05 21:01:14 -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
Cameron Gutman
c87d4a755e Add a workaround to get low bandwidth stereo working again and a cap flag to never request HQ audio 2019-04-25 01:03:27 -07:00
Cameron Gutman
9fc962eb61 Use strict bitrate logic only in remote streaming mode 2019-01-01 18:45:01 -08:00
Cameron Gutman
64096db415 Include FEC overhead in specified bitrate 2019-01-01 18:21:30 -08:00
Cameron Gutman
dd49e5bbfd Fix video bitrate being capped at initialBitrateKbps 2018-12-21 15:07:18 -08:00
Cameron Gutman
639ff18dbb Allow automatic detection of remote streaming 2018-11-21 20:52:50 -08:00
Cameron Gutman
b2ebba2167 Only disable split encode on older GFE versions 2018-09-22 20:22:10 -07:00
Cameron Gutman
8743ce5d08 Improve encoding rate steps for PC native resolutions 2018-09-05 18:40:47 -07:00
Cameron Gutman
884b8d0a95 Additional fixes for corrupt FEC recovery handling 2018-09-05 12:04:39 -07:00
Cameron Gutman
fc124b60ce Enable slicing on HEVC if the client requests it 2018-08-04 16:37:57 -07:00
Cameron Gutman
679f6e83bb Fix HEVC streams requiring a higher bitrate to enable high quality surround audio 2018-07-27 19:04:25 -07:00
Cameron Gutman
4c47dd74ad Revert "Reduce audio bitrate when streaming with a low video bitrate" due to breakage on GFE 3.14.1 2018-07-27 19:02:27 -07:00