Skip to content

NAT-546: Validate generated media before upload - #169

Merged
eugene-mux merged 12 commits into
feature/nat-534-hevc-standard-ingestfrom
em/nat-546-output-validation
Oct 16, 2026
Merged

eugene-mux merged 12 commits into
feature/nat-534-hevc-standard-ingestfrom
em/nat-546-output-validation

Conversation

@eugene-mux

@eugene-mux eugene-mux commented Oct 6, 2026 •

Copy link
Copy Markdown

Description

Generated media is reinspected and accepted only with complete timeline proof, policy compliance, and a match to the conversion plan. Source and output MP4 inspection share one bounded sample/timeline scan and result type. Non-ISO scans return metadata only and select original bytes. Conversion requires proven source timing; the unused raw scanner and duration guesses have been removed.

Bitrate counts whole-track bytes over the full track span and complete intersecting GOPs over their full spans. Cadence and keyframe intervals use the presented edit. Timestamp comparison allows output-tick rounding and requires a consistent extractor timing convention across each track.

Timing tables are selected by platform track ID; metadata is no longer read twice.

Validation

  • 166 unit tests pass in each debug/release variant; SDK/sample release builds, lint-vital, and whitespace checks pass.
  • 36 API 36 emulator fixture cases pass, including leading/trailing GOP edits and Matroska planner fallback. Modern and forced-legacy reads agree.
  • Duration, A/V-start, and aspect tolerances retain the Swift v1.2.0 baselines.

Note

High Risk
Changes upload eligibility by requiring proven timelines and stricter bitrate/edit math; incorrect timeline or validation logic could reject good encodes or accept non-compliant output.

Overview
Adds post-conversion validation so generated files are only accepted after metadata + a complete ISO timeline scan, policy compliance, and a match to the conversion plan; rejections allow original-byte fallback, while cancellation stops preparation.

Replaces the old MediaSampleInspector file scan with StandardInputTimelineInspector: ISO stts/ctts/elst tables (via IsoTimelineReader) prove effective duration, A/V offset, and presentation times, then BoundedSampleReader verifies every sample against platform timestamps and derives video sample facts. VideoSampleFactsReader now keys cadence/timestamps off the presented edit window while bitrate/GOP bounds count whole-track bytes (including preroll/tails outside the edit).

StandardInputOutputValidator orchestrates reinspection (immutable file check, timeline completeness) and compares output to source timelines and StandardInputConversion (codec, dimensions, audio, cadence, timestamp preservation with tick rounding). PlanningCapabilities.sourceTimelineIsProven is required before conversion is offered.

Reviewed by Cursor Bugbot for commit 45bab3e. Bugbot is set up for automated code reviews on this repo. Configure here.

@eugene-mux
eugene-mux marked this pull request as ready for review October 6, 2026 22:55
@eugene-mux
eugene-mux requested a review from a team as a code owner October 6, 2026 22:55
@eugene-mux
eugene-mux requested a review from daytime-em October 6, 2026 22:55
@eugene-mux
eugene-mux added this pull request to stack #166 October 6, 2026 22:56

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@eugene-mux
eugene-mux force-pushed the em/nat-546-output-validation branch 3 times, most recently from 59dc6fb to 66eb9a5 Compare October 16, 2026 18:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 66eb9a5. Configure here.

@eugene-mux
eugene-mux force-pushed the em/nat-546-output-validation branch from 66eb9a5 to 8a39189 Compare October 16, 2026 19:58
Base automatically changed from em/nat-545-sample-inspection to feature/nat-534-hevc-standard-ingest October 16, 2026 19:58
@eugene-mux
eugene-mux merged commit 700c4a2 into feature/nat-534-hevc-standard-ingest Oct 16, 2026
1 of 2 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 4, 2026
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.

2 participants