Repository navigation
Fixing the HEVC VPS detection and the Annex-B RTP framing - #60
Merged
Merged
Conversation
The VPS type test compared the wrong way around: & binds looser than ==, so nalptr[0] >> 1 & 0x3F == H265_NAL_TYPE_VPS evaluated as (nalptr[0] >> 1) & 0 and a type-32 NAL never populated the VPS cache. Group the shift and mask before the comparison, matching the SPS and PPS checks below it, and reject VPS payloads shorter than four bytes before they reach the MIME encoder. The RTP packer only took the Annex-B path when a pack opened with a four-byte start code, so a three-byte prefix, or a run of leading zeros before either prefix, was sent as a raw NAL with the framing bytes still in the payload. Count the leading zeros, accept either prefix, and hand the pack to the existing splitter. Extracted from #59, authored by Daniel Piers.
The RTP packer decided for itself whether a pack held Annex-B framing before splitting it, and kept a raw path for anything that did not match. nal_split() already scans for both start code lengths and hands the whole pack back as a single NAL when none is present, so the hand-rolled detection and the separate raw path were redundant, and out of step with the parameter cache, which has always split unconditionally. Drop the branch and run nal_split() over every pack.
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.
The source fix from #59 by @dpiers, narrowed to
src/rtsp/rtp.cso it can land on its own.nal_split()rather than a hand-rolled prefix scan. The splitter already handles both start code lengths and returns the whole pack as a single NAL when none is present, so the raw fallback is preserved and the packetizer now matches the parameter cache.The test harness, fixtures and CI job from #59 are intentionally left out for now.