You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
media: preserve the final picture in regular H.264 transport streams (#778) - #4030
The shared H.264 transport-stream reader reports the last picture's start as the duration, so public playback can clamp a request for that picture to the preceding frame. Include the final display period only for video-only H.264 transport streams with a clean, aligned packet index, a leading random-access picture, and complete readable timestamps at an exact regular cadence. All other inputs retain their previous indexed duration. No codec, seek, audio, dependency, or workflow changes.
The generated regression is intended to compare a two-frame transport stream with the Film reader and verify the final frame through the public probe and media pool. Guard tests cover damaged and partial tails, missing or irregular timing, and unit-size bounds. Diff checks and independent source review completed; builds and these tests have not run. Normal hosted CI is pending.
Summary by CodeRabbit
Bug Fixes
Playback duration is now estimated more accurately for eligible H.264 transport-stream videos, including the final picture, when timing information is complete and regular.
For incomplete, damaged, or irregular video data, duration continues to use the indexed timestamp span rather than an unreliable picture-timing estimate. This avoids extending playback duration when the final picture’s timing cannot be determined reliably.
No actionable comments were generated in the recent review.
Walkthrough
MPEG-TS duration now uses a picture-end estimate for eligible single-stream H.264 input with a clean packet index. When the estimate cannot be used, the route retains the indexed PTS span. Tests cover the estimate, final-picture retrieval, and damaged or partial tails.
Changes: MPEG-TS duration
Layer / File(s)
Summary
Duration estimation and eligibility crates/media/src/craft_source.rs
The picture-end estimate checks key-picture origin, readable units, positive constant PTS spacing that matches the frame rate, and arithmetic bounds. A separate check validates TS packet-index conditions.
Route integration and MPEG-TS tests crates/media/src/craft_source.rs
The duration route uses the estimate only for eligible single-stream H.264 input; otherwise it retains the indexed PTS span. Generated-fixture tests cover final-picture duration and retrieval, damaged or partial tails, and rejected estimate inputs.
This change extends the reported duration of regular video-only H.264 transport streams so the last picture can be requested. Other inputs keep their previous duration. No concrete merge-blocking risk was found. Normal CI should confirm the new tests.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: the final picture is preserved in regular H.264 transport streams. The raw summary confirms the change adds inferred end-of-final-picture duration for single-stream H.…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the final picture is preserved in regular H.264 transport streams. The raw summary confirms the change adds inferred end-of-final-picture duration for single-stream H.264 MPEG-TS files with a clean index, falling back to the indexed span otherwise. The title's '(#778)' suffix differs from the PR objectives' reference to #4030, but that does not affect topical relevance. The title is specific and matches the changeset.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Clippy (1.99.1)
Clippy execution timed out
Clippy (1.99.1) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.
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.
Reviewing files that changed from the base of the PR and between 421b013 and ba74b98.
Files selected for processing: 1
crates/media/src/craft_source.rs
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
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
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.
Part of storytold/craft-libs#778 and storytold/craft-libs#781 (scoped claim).
The shared H.264 transport-stream reader reports the last picture's start as the duration, so public playback can clamp a request for that picture to the preceding frame. Include the final display period only for video-only H.264 transport streams with a clean, aligned packet index, a leading random-access picture, and complete readable timestamps at an exact regular cadence. All other inputs retain their previous indexed duration. No codec, seek, audio, dependency, or workflow changes.
The generated regression is intended to compare a two-frame transport stream with the Film reader and verify the final frame through the public probe and media pool. Guard tests cover damaged and partial tails, missing or irregular timing, and unit-size bounds. Diff checks and independent source review completed; builds and these tests have not run. Normal hosted CI is pending.
Summary by CodeRabbit