Commit Graph

31 Commits

Author SHA1 Message Date
Andy Grundman
de364b6ecd Use nanors for optimized Reed-Solomon FEC decoding (#125) 2026-02-18 23:36:52 -06:00
Andy Grundman
82ee2d6590 Improve support for high-resolution stats
* This patch adds a new microsecond-resolution function call, LiGetMicroseconds(), to complement
the existing LiGetMillis(). Many variables used by stats have been updated to work at this
higher resolution and now provide better results when displaying e.g. sub-millisecond frametime stats.
To try and avoid confusion, variables that now contain microseconds have been renamed with a suffix
of 'Us', and those ending in 'Ms' contain milliseconds. I originally experimented with nanoseconds but it
felt like overkill for our needs.

Public API in Limelight.h:
uint64_t LiGetMicroseconds(void);
uint64_t LiGetMillis(void);
const RTP_AUDIO_STATS* LiGetRTPAudioStats(void);  // provides access to RTP data for the overlay stats
const RTP_VIDEO_STATS* LiGetRTPVideoStats(void);

Note: Users of this library may need to make changes. If using LiGetMillis() to track the duration of
something that is shown to the user, consider switching to LiGetMicroseconds(). Remember to divide by
1000 at time of display to show in milliseconds.
2025-11-06 20:27:01 -06: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
happyharryh
7d9df5b731 Update oldestRtpBaseSequenceNumber when advance the queue state 2022-10-31 20:36:55 -05:00
Cameron Gutman
6418c631ba Further improve audio FEC recovery logic when dealing with completely missing FEC blocks 2022-10-25 22:31:18 -05:00
Cameron Gutman
21998586d1 Improve audio recovery when a prior FEC block was completely lost
We now start playing the latest FEC block immediately, instead of needlessly
waiting for a second FEC block to realize we've lost a full block and need
to skip forward.
2022-10-24 23:38:23 -05:00
Cameron Gutman
7ba4eea417 Don't print misleading audio FEC log messages 2022-10-23 22:09:01 -05:00
Cameron Gutman
7c346c3104 Fix handling of older GFE versions in surround sound mode
7.1 surround sound would usually behave like CBR content, which never
tripped the logic to detect this incompatibility. Now we will both
detect it via hardcoded version number check, but also detect when the
FEC base sequence number constraint is violated too.
2021-06-20 14:55:44 -05:00
Cameron Gutman
c680a60710 Disable audio FEC when using old GFE and Sunshine versions 2021-06-19 16:22:44 -05:00
Cameron Gutman
fed1a899aa Add defines for RTP audio payload types 2021-06-19 16:08:18 -05:00
Cameron Gutman
b2d4b2c61f Fix spurious exit of fast recovery mode when the stream starts 2021-06-12 18:33:20 -05:00
Cameron Gutman
a13eeddacf Fix Win32 release build 2021-06-09 20:38:22 -05:00
Cameron Gutman
f01103af23 Add a free FEC block cache to avoid memory allocations 2021-06-09 20:29:05 -05:00
Cameron Gutman
b471edbb80 Add a fast path to drop the audio FEC block with in-order packets
If we have not seen any OOS audio data lately, we can assume that
seeing the next FEC block means the previous block has completed
transmission. If we don't have it all by then, just assume it was
lost and move on. This reduces the perception of audio loss by
reducing the change that we cause the audio device to underrun.
2021-06-09 02:31:55 -05:00
Cameron Gutman
c64ba99654 Fix build on GCC/Clang 2021-06-09 01:45:44 -05:00
Cameron Gutman
7b838dd692 Improve audio FEC queue timeout logic 2021-06-09 00:46:14 -05:00
Cameron Gutman
ca7a6e7bbe Validate block size before writing data 2021-06-08 20:03:49 -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
a8aed6b344 Avoid spurious audio data loss warning on connection start 2021-06-03 21:02:27 -05:00
Cameron Gutman
e9fd544ff4 Fix FEC queue state assert firing on shutdown 2021-06-02 20:11:20 -05:00
Cameron Gutman
ab51acb712 Only data shards should be eligible for immediate consumption 2021-06-02 19:50:22 -05:00
Cameron Gutman
d0adb044cf Fix bugs discovered by FEC state validation logic 2021-06-02 19:36:57 -05:00
Cameron Gutman
565b170e00 Add FEC state validation in debug builds 2021-06-02 19:36:31 -05:00
Cameron Gutman
08e4a47fc2 Add FEC validation mode for audio FEC 2021-06-01 22:43:43 -05:00
Cameron Gutman
dd3675db63 Fix mishandling of a completely missing FEC block 2021-06-01 21:31:48 -05:00
Cameron Gutman
da7db59414 Fix freeing FEC block after wrapping seqnum with in-order FEC block 2021-06-01 21:16:18 -05:00
Cameron Gutman
fde6b05618 Fix incorrect assert on sequence number wrap 2021-06-01 21:14:25 -05:00
Cameron Gutman
683208ddc8 Return all available audio data after FEC block timer expires 2021-06-01 20:01:26 -05:00
Cameron Gutman
4aa82b0a9f Fix Clang/GCC build 2021-06-01 18:39:19 -05:00
Cameron Gutman
89918324ce Implement audio FEC recovery support 2021-06-01 18:31:56 -05:00