Skip to content

fix(hang): omit empty HEVC constraint component in codec string#1781

Merged
kixelated merged 2 commits into
moq-dev:mainfrom
quidamschwarz:fix/hevc-zero-constraint-codec-string
Jun 18, 2026
Merged

fix(hang): omit empty HEVC constraint component in codec string#1781
kixelated merged 2 commits into
moq-dev:mainfrom
quidamschwarz:fix/hevc-zero-constraint-codec-string

Conversation

@quidamschwarz

Copy link
Copy Markdown
Contributor

Fixes #1780.

HEVC streams whose general_constraint_indicator_flags are all zero produced a codec string ending
in a dangling . (e.g. hvc1.1.60.L150.), which H265::from_str then rejected while parsing the
empty trailing field as a hex int. This breaks the catalog round-trip for such streams — both
catalog generation on publish and subscribe_catalog/subscribe_media on consume (surfaces to
callers as json: expected int). All-zero constraint flags are common in live HEVC from hardware
encoders, so it's hit publishing a real camera via moq-cli … publish … fmp4.

Changes — rs/hang/src/catalog/video/h265.rs

  • Display: emit the constraint component (and its leading .) only when there are significant
    bytes, so all-zero flags yield hvc1.1.60.L150 instead of hvc1.1.60.L150..
  • FromStr: tolerate an empty trailing field, so streams already published with the dangling
    . still parse (version skew while producers update).
  • Test: test_h265_zero_constraints (zero-constraint round-trip + dangling-. parse). The
    existing test_h265 / test_h265_long / test_h265_out_of_band cases are unchanged.

cargo test -p hang passes (4/4 in the h265 module).

HEVC streams whose general_constraint_indicator_flags are all zero produced
a codec string ending in a dangling '.' (e.g. `hvc1.1.60.L150.`). The matching
`FromStr` then parsed the empty trailing field as a hex int and failed, which
surfaces as `json: expected int` and breaks the catalog round-trip for such
streams (catalog generation on publish, and subscribe_catalog/subscribe_media
on consume). All-zero constraint flags are common in live HEVC from hardware
encoders, so this is hit publishing a real camera via `moq-cli ... publish fmp4`.

Emit the constraint component (and its leading '.') only when there are
significant bytes, and let `FromStr` tolerate an empty trailing field so
streams already published with the dangling '.' still parse. Adds a
zero-constraint round-trip test; the existing tests are unchanged.

Fixes moq-dev#1780

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kixelated kixelated enabled auto-merge (squash) June 18, 2026 20:13
@kixelated

Copy link
Copy Markdown
Collaborator

thanks, I'll fix the unrelated CI failure

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 65c65c17-ed6e-4bc9-bc58-eeb31ef0567f

📥 Commits

Reviewing files that changed from the base of the PR and between eb67c18 and 3f230d6.

📒 Files selected for processing (1)
  • rs/hang/src/catalog/video/h265.rs

Walkthrough

The H265 codec string implementation in h265.rs is updated in two ways. The Display implementation now checks whether all constraint_flags bytes are zero and, if so, omits the constraints component entirely from the formatted string instead of appending a trailing .. The FromStr parser is updated to skip empty tokens in the constraint-parsing loop, making it tolerant of a dangling . produced by older encoders or muxers. A new unit test verifies round-trip correctness for an all-zero-constraints codec string in both the omitted form and the legacy dangling-dot form.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing the omission of empty HEVC constraint component in codec strings, which is the core issue addressed in the changeset.
Description check ✅ Passed The description is well-related to the changeset, explaining the problem (dangling period in codec strings), the root cause, and the solution implemented in the code.
Linked Issues check ✅ Passed The PR fully addresses issue #1780's objectives: the Display implementation now omits the constraint component when all bytes are zero, FromStr tolerates empty trailing fields, and test coverage for zero-constraint scenarios was added.
Out of Scope Changes check ✅ Passed All changes in the PR are directly scoped to resolving issue #1780, focusing exclusively on the H265 constraint flags handling in the codec string Display and parsing logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hang: HEVC codec string with all-zero constraint flags emits a trailing "." that fails to parse ("expected int")

2 participants