Commit graph

63 commits

Author SHA1 Message Date
Cameron Gutman
c0e3dc64a4 Add basic QoS attributes to our A/V sockets 2024-02-01 00:15:47 -06:00
Cameron Gutman
bbf15af837 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.
2023-10-26 01:15:27 -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
620b4be477 Add separate LC_ASSERT_VT() for asserts that only apply for valid traffic 2023-10-11 20:01:39 -05:00
Cameron Gutman
c13f4a323f Use connected datagram sockets for audio and video
This ensures unwanted data from other sources is dropped and that our own source address doesn't change while streaming.
2023-09-12 23:29:05 -05:00
Cameron Gutman
77c5d5c282 Tune SO_RCVBUF logic
- Calculate desired SO_RCVBUF by packet size for the video socket
- Use the OS default SO_RCVBUF for audio and STUN sockets
2023-07-25 18:30:19 -05:00
Cameron Gutman
dc186082a7 Add protocol extension for multi-client-compatible ping support 2023-02-12 01:23:25 -06:00
Cameron Gutman
4dbb445f8b Suppress Opus header assert with Sunshine 2023-01-16 21:13:18 -06:00
Cameron Gutman
8abc371fb4 Print warning when audio decryption fails 2021-07-17 22:57:50 -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
75999a6e07 Add Video/Audio prefix to ThreadProc names
It's easier to find them in stack traces that way.
2021-06-20 10:36:05 -05:00
Cameron Gutman
eff97414bf Perform the initial audio resync even if we hit the polling timeout 2021-06-19 16:44:48 -05:00
Cameron Gutman
2228e4812d Improve debugging for A/V data loss and recovery 2021-06-08 20:01:58 -05:00
Cameron Gutman
509a17dbc3 Perform PLC for each lost packet in the FEC block 2021-06-03 21:03:46 -05:00
Cameron Gutman
ef33aaa3c8 Fix queued packet leak when audio packet queue overflows 2021-06-02 22:05:45 -05:00
Cameron Gutman
e3d4f4e91f Validate the Opus data in debug builds 2021-06-02 20:10:46 -05:00
Cameron Gutman
3dff15b8c4 Fix memory leak when switching between immediate and queued audio packets 2021-06-01 19:33:56 -05:00
Cameron Gutman
89918324ce Implement audio FEC recovery support 2021-06-01 18:31:56 -05:00
Cameron Gutman
ccaca624f3 Attempt to fix audio latency issues on some PCs 2021-05-04 10:21:41 -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
Cameron Gutman
bce9f82844 Fix strict aliasing violation (and save a byteswap on each packet) 2021-04-28 17:05:41 -05:00
Cameron Gutman
fe205d838d Don't check for errors from sendto() in the ping threads 2021-04-28 17:04:44 -05:00
Cameron Gutman
c1befbe2a8 Improve audio resync logic to use initial receive time rather send time 2021-04-26 22:43:49 -05:00
Cameron Gutman
33c4e98152 Adjust initial audio resync drop time based on connection handshake latency 2021-04-26 21:39:36 -05:00
Cameron Gutman
29d2cc6d5b Improve MbedTLS implementation of AES-CBC 2021-04-22 17:08:35 -05:00
Cameron Gutman
d7549cd953 Use array initializers compatible with MSVC 2021-04-22 00:32:41 -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
3979dbd082 Allow compilation on OSes without IPv6 support 2021-04-17 23:40:36 -05:00
Cameron Gutman
4304e597d8 Add byteswapping macros for big-endian systems 2021-04-17 21:43:13 -05:00
Cameron Gutman
31433fc5ee Minor cleanup and bugfix 2021-04-09 13:47:24 -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
2c13835f32 Increase first-start audio drop for upcoming GFE 3.22 changes 2021-04-09 08:39:28 -05:00
Cameron Gutman
3fddfc5557 Fix Clang warnings 2020-12-05 23:20:02 -06: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
ae00c09cb6 Restore the 500 ms ping logic to prevent warnings in the server-side logs 2020-08-08 23:16:55 -07:00
Cameron Gutman
f596e80575 Improve logging of video/audio delay and errors 2020-05-01 20:23:44 -07:00
Cameron Gutman
9ffdc79b6f Add log messages to troubleshoot problems with missing video/audio 2020-04-29 20:17:55 -07:00
Cameron Gutman
fb60ae6a4d Parse Opus parameters from RTSP DESCRIBE response 2020-03-31 20:52:38 -07:00
Cameron Gutman
6b42954b47 Add LiGetPendingAudioDuration() function 2019-11-30 21:31:50 -06:00
Cameron Gutman
f4dad9ae8b Add presentation timestamp to video frame metadata 2019-11-10 18:07:11 -08: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
dffe51e885 Add LiGetPendingVideoFrames() and LiGetPendingAudioFrames() 2019-05-07 20:25:26 -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
31aa893acd Name our threads on Linux 2019-05-03 18:54:40 -07:00
Cameron Gutman
d6971983aa Use an interruptible sleep to allow our threads to exit sooner 2019-04-06 15:26:59 -07:00
Cameron Gutman
40fa4ef3c8 Reduce NAT keepalive packet rate after connection is established 2019-03-24 12:54:41 -07:00
Cameron Gutman
aa9610847e Ensure termination error code is propagated properly 2019-02-09 21:30:16 -08:00