Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Devin Review found 5 potential issues.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
haffi96
marked this pull request as draft
October 27, 2026 09:20
Contributor
Author
|
The main motivation here is to enable the H265 pre-encoded ingest path with length prefixed NAL units more or less trying to mirror Livekit Go SDK pre-encoded publish path See rust PR livekit/rust-sdks#1579 |
EncodedVideoSource takes Annex-B access units, but hardware encoder bridges commonly deliver 4-byte length-prefixed NAL units (avc3/hev1). The parser accepts any chunking of such a stream and returns EncodedVideoSource::Frame values: Annex-B (converted in place during the single copy), keyframe flag, and optional packet-trailer metadata from an LKTS SEI (the LiveKit Go SDK convention). single_slice_flush completes an access unit as soon as its slice arrives instead of when the next one begins, which otherwise holds every picture for a frame interval. Mirrors livekit-capture's LengthPrefixedAccessUnitParser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
haffi96
force-pushed
the
feat/h265-pre-encoded-length-prefixed
branch
from
October 30, 2026 09:29
b3e92e8 to
4382a5b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EncodedVideoSourcetakes Annex-B access units, but hardware encoder bridges can commonly deliver 4-byte length-prefixed NAL units (avc3/hev1). This adds a parser that turns such a stream, in any chunking (e.g. straight from a TCP socket), into ready-to-captureEncodedVideoSource::Frames.is_keyframewith the same rules aslivekit-capture(H.265 needs VPS/SPS/PPS with the IDR).single_slice_flushcompletes an access unit as soon as its slice arrives instead of when the next one begins, which otherwise holds every picture for a frame interval.frame_metadata_from_seifillsFrame::metadatafrom an LKTS packet-trailer SEI, the convention used by the LiveKit Go SDK.This is a C++ port of the
LengthPrefixedAccessUnitParseradded to livekit-capture in livekit/rust-sdks#1579, not a wrapper over FFI, so it works with the current Rust SDK and needs no new FFI messages; the cost is keeping the two parsers in sync. If a single implementation is preferred, a Rust-side source that takes raw length-prefixed bytes over FFI would be the follow-up. That PR also publishes pre-encoded video as a single layer, which matters for C++ becauseTrackPublishOptions::simulcastdefaults to on.Testing
LengthPrefixedAccessUnitParser*), including chunked-vs-one-shot equivalence and emulation-prevention handling in the SEI.hev1stream from GStreamer over TCP; steady-state publish latency p50 0.83 ms.single_slice_flush,frame_metadata_from_sei) tolivekit-server --devand LiveKit Cloud; every frame carried its SEI metadata and the subscriber received 720p30 with the user timestamp and frame ID intact.AudioProcessingModuleTest.AGCAttenuatesLoudSpeechfails locally both with and without this change.Created with Claude Opus 5.5 in Claude Code.