Commit Graph
102 Commits
Author SHA1 Message Date
Cameron Gutman ae6633eedc Keep RFI and IDR waits mutually exclusive 2026-11-12 21:22:23 -06:00
Cameron Gutman e64327c864 Add a lock to fix races in the VideoDepacketizer 2026-11-12 21:19:09 -06:00
Cameron Gutman 3b6ee9d916 Remove LiPeekNextVideoFrame API
Due to internal queue flushes outside of the app's control, this
API has fundamental UAF issues and is not possible to use safely.
2026-11-10 21:25:16 -06:00
Cameron Gutman 348d5d1e32 Fix potential leaks on queue shutdown 2026-11-10 21:03:51 -06:00
Ulises Britos bf71226754 fix(video): bound frame reassembly and reject missing SOF (#169) 2026-11-10 20:43:13 -06:00
Cameron Gutman be438856af Fix handling of a partially dropped IDR frame 2026-09-08 22:58:14 -05:00
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
Andy Grundman e356b2cfde Change presentationTimeMs to presentationTimeUs: retain more resolution when dealing with RTP video timestamps from Sunshine. Include raw rtpTimestamp value for use with integer time APIs. 2025-11-06 20:27:01 -06:00
Andy Grundman a3ebaaf015 Use uint64_t for DECODE_UNIT presentationTimeMs
This still holds a millisecond value sourced from RTP timestamp, but since we're changing the API anyway, now is a good time to future-proof this field.
2025-11-06 20:27:01 -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
camelcx c86e0537d1 Fix some edge case on small MTU devices using qsv codec (#107)
Add fall back logic to prevent edge case where SPS SPP is not included in the same packet and key IDR frame is mislabeled as P frame causing assertion error at validation.
2025-07-05 19:13:06 -05:00
Cameron Gutman f78f2135fa Don't strictly enforce picture data following the first PPS in debug mode 2023-10-13 23:23:27 -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 ec6713fd80 Improve checks for runt video packets
Since we always allocate fixed size these aren't likely to be exploitable,
but we ought to fix them anyway. Worst case, we will just read some garbage
and generate corrupt video output.
2023-09-12 22:44:45 -05:00
Cameron Gutman e0d83f61c2 Fix missing debug message when an I-frame is sent as an RFI recovery frame for AV1 2023-08-14 21:32:38 -05:00
Cameron Gutman 8bca948b61 Fix unused function warning on release builds 2023-08-12 15:08:22 -05:00
Cameron Gutman a0b29fe3dc Avoid asserting on filler NALUs in reference frames on debug builds 2023-08-12 05:32:11 -05:00
Cameron Gutman 49fef03830 Change frameHeaderSize to uint32_t to avoid warning from promotion to signed int 2023-07-08 01:40:44 -05:00
Cameron Gutman 9205a87002 Improve validation of lastPacketPayloadLength field 2023-07-08 01:31:41 -05:00
Cameron Gutman ed7d72c07d Fix single packet frame case for AV1 2023-07-06 01:41:15 -05:00
Cameron Gutman 190b08ecf4 Encode the final packet length in the frame header for AV1
Some decoders (Android) are very strict about trailing padding bytes.
2023-07-06 01:29:24 -05:00
Cameron Gutman 953971c9a3 Fix handling of AV1 keyframes 2023-07-05 18:45:29 -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
ns6089 284840bde7 Add support for sunshine host latency 2023-05-03 20:38:42 -05:00
Cameron Gutman c9426a6a71 Add HDR and colorspace fields to DECODE_UNIT 2023-03-11 11:36:21 -06:00
Cameron Gutman 8186687093 Fix video header parsing assert with GFE 3.27 2023-02-13 21:26:47 -06:00
Cameron Gutman ef9ad529a4 Skip PPS NALUs prepended to P-frames 2023-01-02 23:48:16 -06:00
Cameron Gutman 9da6329496 Fix integer truncation warning on MSVC 2022-12-06 17:33:43 -06:00
Cameron Gutman 5c7a5ce129 Remove overzealous assert 2022-12-06 17:23:11 -06:00
Cameron Gutman bc00d957d3 Synthesize a PTS for hosts that don't send one 2022-12-06 17:22:02 -06:00
Cameron Gutman 4840e431f4 Call notifyKeyFrameReceived() before the decoder processes the frame
We don't care if the decoder processes it successfully.
2022-11-21 02:22:26 -06:00
Cameron Gutman 1e582e3e58 Improve decode unit validation 2022-11-21 02:17:47 -06:00
Cameron Gutman 549058d9d1 Assert that P-frames are not processed before IDR frames 2022-11-12 19:42:51 -06:00
Cameron Gutman 56d6b7ff5a Ensure RFI is not used when an IDR frame is needed 2022-11-12 19:22:13 -06:00
Cameron Gutman 5f92ecafe7 Avoid triggering RFI wait code for decode unit queue overflow 2022-10-06 21:25:48 -05:00
Cameron Gutman 44668bd256 Distinguish speculative RFIs from normal FEC-initiated RFIs 2022-10-06 21:21:00 -05:00
Cameron Gutman 947d1b5aef Predictive RFI -> Speculative RFI 2022-10-06 21:20:44 -05:00
Cameron Gutman 7d1a081fd0 Fix signature of notifyFrameLost() and add additional assert 2022-10-06 20:38:55 -05:00
Cameron Gutman f2dd7888f7 Immediately request an IDR frame on corrupt frame 2022-10-06 20:36:53 -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 dbfbc91971 Explicitly request an IDR frame in the IDR frame wait path 2022-10-03 18:27:57 -05:00
Cameron Gutman a4870f619b Frame type fields are present all the way back to GFE 3.2 (and probably further) 2022-10-03 18:26:24 -05:00
Cameron Gutman 4c62b5d23a Fix fallback handling of RFI on older servers 2022-10-03 18:25:08 -05:00
Cameron Gutman 3593dea585 Rework RFI to work reliably with HEVC 2022-10-02 22:19:48 -05:00
Cameron Gutman 795e3f644a Ensure the next frame after a DU drop is always an IDR frame
On RFI-capable decoders, this would sometimes be a P-frame
2022-10-02 21:12:01 -05:00
Cameron Gutman 3ae777f973 Try to recover if the frame header parsing fails 2022-09-24 13:43:32 -05:00
Cameron Gutman 54825845e7 Fix large frame header size for GFE 3.26 2022-09-22 21:51:11 -05:00
Cameron Gutman 50603ac16e Fix mishandling of IDR frames with a VUI or AUD NAL 2022-09-11 23:34:38 -05:00
Cameron Gutman e453a4d548 Add 3 byte Annex B start sequence test mode for debugging clients 2022-09-05 17:41:37 -05:00