Tolerate FU/FU-A with both S and E bits set#131
Merged
Conversation
scottlamb
requested changes
Mar 28, 2026
scottlamb
left a comment
Owner
There was a problem hiding this comment.
Thanks for the nice report, test, and fix! One comment below.
| initial_nal_header: nal_header, | ||
| cur_nal, | ||
| }); | ||
| if end { |
Owner
There was a problem hiding this comment.
Can we hoist this end block to after the match rather than duplicate it for the start vs non-start cases? (same in h265.rs)
Contributor
Author
There was a problem hiding this comment.
Certainly; is this what you had in mind?
danieltwagner
commented
Mar 28, 2026
| }); | ||
| } | ||
| } else if mark { | ||
| return Err("FU-A has MARK and no END".into()); |
Contributor
Author
There was a problem hiding this comment.
I believe this was dead, shadowed by the conditional in L496 ("FU-A pkt with MARK && !END")
danieltwagner
commented
Mar 28, 2026
| nal.next_piece_idx = pieces; | ||
| access_unit.in_fu = false; | ||
| } else if mark { | ||
| return Err("FU has MARK and no END".into()); |
Contributor
Author
There was a problem hiding this comment.
I believe this to be similarly shadowed by "FU pkt with MARK && !END" (L389)
scottlamb
approved these changes
Mar 29, 2026
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.
On my IMX415-based SSC378DE (Infinity6c family) OpenIPC camera I have observed intermittent packets that have both start and end bits set, both for H.264 and H.265.
This PR proposes to warn once when these are encountered and to otherwise struggle on, treating them as a complete NAL.
Previously this caused an
Invalid FU-A header c1/Invalid FU header c1error and stream teardown.Before: H.265 8/8 runs failed within 3–69s; H.264 intermittent as FU-A errors occur less frequently than with H.265.
After: 3/3 H.265 × 120s and 3/3 H.264 × 180s runs complete cleanly, all frames decode without error.