Skip to content

NAT-545: Inspect Android media metadata (1 of 2) - #167

Merged
eugene-mux merged 10 commits into
feature/nat-534-hevc-standard-ingestfrom
em/nat-545-metadata-inspection
Oct 16, 2026
Merged

eugene-mux merged 10 commits into
feature/nat-534-hevc-standard-ingestfrom
em/nat-545-metadata-inspection

Conversation

@eugene-mux

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

Copy link
Copy Markdown

Description

Inspect local video metadata using MediaExtractor/MediaFormat. Available platform properties are authoritative; unavailable facts remain unknown unless the existing bounded Media3 helper can fill the gap.

Changes

  • Read codec/profile, dimensions, crop, rotation, audio and HDR from platform properties. Remove duplicate metadata reconciliation and manual MP4 metadata/rotation parsing.
  • Keep a narrow initialization-header fallback only for missing profile, pixel and color facts. API 36 fixtures omit pixel format, and some ordinary SDR files omit transfer metadata; removing this fallback prevented valid output from passing validation. Platform values are never overridden or cross-checked.
  • Use platform channel count/mask for AAC layout. Unproven surround layouts remain unknown.
  • Keep ISO edit-list/timeline inspection in the dependent sample/validator PRs, matched by platform track ID. Effective duration and A/V offsets remain in NAT-546.

Validation

  • 100 tests pass in each debug/release variant; SDK/sample release builds, lint-vital and whitespace checks pass.
  • 20 external API 36.1 fixture checks pass against the updated stack, including iPhone/Pixel recordings and successful real-file AVC/HEVC output validation.
  • The complete dependent stack passes 295 tests in each variant and release builds. No live uploads or physical-device acceptance were rerun for this follow-up.

Fixture media, validation tooling and evidence remain outside product Git.


Note

Medium Risk
Introduces parsing of untrusted container/codec metadata that feeds upload standardization decisions; mitigated by bounded parsing and unknown fallbacks, but incorrect facts could affect accept/fallback policy.

Overview
Adds file-level metadata inspection for the upload standardization pipeline using MediaExtractor/MediaFormat, without reading media samples. Track-level reported duration, frame rate, and bitrate are kept separate from MediaFacts; timeline/sample-derived fields stay unknown until later work.

Platform metadata is authoritative for codec, profile, dimensions, crop, rotation, color/HDR, and AAC layout. A new CodecMetadataReader only fills gaps (profile, pixel format, color transfer) from bounded AVC/HEVC csd-* initialization data when platform keys are missing—never overriding platform values. Rotation is normalized to the shared Swift transform convention (documented on MediaFacts), with raw Android rotation retained for observation.

Includes defensive limits (max tracks, max CSD size, bounded HEVC SPS pre-checks) and conservative handling for ambiguous Dolby multi-view tracks. Robolectric tests cover platform vs header fallback, API-level behavior, rotation/crop, and planner integration for Dolby fallback.

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

@eugene-mux eugene-mux changed the title Inspect Android media metadata (NAT-545 Part A) NAT-545: Inspect Android media metadata (1 of 2) Oct 2, 2026
@eugene-mux
eugene-mux marked this pull request as ready for review October 2, 2026 22:58
@eugene-mux
eugene-mux requested a review from a team as a code owner October 2, 2026 22:58
@eugene-mux
eugene-mux requested a review from daytime-em October 2, 2026 22:58
@eugene-mux
eugene-mux added this pull request to stack #166 October 2, 2026 22:58

@daytime-em daytime-em left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You should be able to greatly simplify this code by relying on MediaFormat's prop-getters. Parsing csd buffers is cool, but those are also generated by MediaExtractor from the same container boxes that supply data for the higher-level property-getters (getInt(KEY_*), etc)

@eugene-mux
eugene-mux force-pushed the em/nat-545-metadata-inspection branch from 4f2ab02 to a109f27 Compare October 16, 2026 18:08
Base automatically changed from em/nat-544-standard-input-policy to feature/nat-534-hevc-standard-ingest October 16, 2026 18:09
@eugene-mux
eugene-mux force-pushed the em/nat-545-metadata-inspection branch from a109f27 to de0c618 Compare October 16, 2026 18:09

@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 de0c618. Configure here.

@eugene-mux

Copy link
Copy Markdown
Author

@daytime-em thanks for the review, I've updated the PR with your suggestions.

@eugene-mux
eugene-mux requested a review from daytime-em October 16, 2026 18:43

@daytime-em daytime-em left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! 👍

@eugene-mux
eugene-mux merged commit 25a3cf2 into feature/nat-534-hevc-standard-ingest Oct 16, 2026
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