Skip to content

test(recording): a Dolby Vision recording keeps its configuration record - #1096

Merged
superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
MistyKuu:test/recording-keeps-dolby-vision
Nov 19, 2026
Merged

superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
MistyKuu:test/recording-keeps-dolby-vision

Conversation

@MistyKuu

Copy link
Copy Markdown
Contributor

Summary

The engine test for FFmpegBuild#11, as asked there: a live recording of a Dolby Vision stream keeps its configuration record. Test only; main already has the FFmpegBuild 3.16.0 pin (572a8f7) and the CHANGELOG entry.

What changed

  • LiveRecordingWriterTests: "a Dolby Vision recording keeps its configuration record", parameterized over Profile 8.1, 8.4 and 5. It writes an HEVC stream whose codecpar carries an AV_PKT_DATA_DOVI_CONF record through LiveRecordingWriter, opens the file again and checks the profile and compatibility id that AetherEngine.dvConfig(stream:) reads back.

Test plan

  • Device / OS: Mac (Apple silicon), macOS 27.2, Xcode 27.2, Swift 6.4.2.
  • Source media: synthetic, written by the test (MPEG-TS, HEVC with a Dolby Vision record, 3840x2160, level 6).
  • Result:
    • FFmpegBuild 3.16.0 (as pinned on main): swift test --filter LiveRecordingWriterTests 11 tests passed, the new one with all 3 cases.
    • FFmpegBuild 3.15.0 (exact: "3.15.0" locally, not committed): all 3 cases fail on the profile and on the compatibility id, the other 8 tests pass.
    • Full swift test on 3.16.0: the new test and the rest of the suite pass, except SoftwarePacketReadAheadParkTests (AE#1053 spike case) and SubtitleOCRTests (Vision, 180 s limit), which also fail on their own on this machine while it was under heavy load from other jobs. Neither touches the recording writer, and CI on 572a8f7 is green.
    • Scripts/check-test-hygiene.py, check-doc-links.py, check-source-map.py clean.

Refs superuser404notfound/FFmpegBuild#11

Checklist

  • CHANGELOG.md updated (the entry is already on main)
  • Commit messages follow Conventional Commits (feat(...), fix(...), chore(...))
  • The fix lives in the engine, not in a host-side workaround (test only)
  • Public API changes are intentional and documented (no public API change)
  • Docs updated for every changed behaviour, in the page that owns the topic, in plain short sentences (no behaviour change)

Records an HEVC stream whose parameters carry a Dolby Vision configuration
record (Profile 8.1, 8.4 and 5) through LiveRecordingWriter, opens the
written file again and reads the record back through dvConfig, the probe
playback routes on. It pins the mpegts muxer's Dolby Vision descriptors
(FFmpegBuild#11), which main has since 572a8f7 with FFmpegBuild 3.16.0.
Against 3.15.0 all three cases fail, the file has no record; against
3.16.0 they pass.

@quint-aether quint-aether 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.

Automated review

Status: 🟡 Minor follow-ups. Only small touch-ups left.

This PR adds the engine-side test asked for in FFmpegBuild#11. It writes an HEVC stream that carries a Dolby Vision configuration record (Profile 8.1, 8.4 and 5) through LiveRecordingWriter, then reads the file back through AetherEngine.dvConfig(stream:), the same probe routing uses. That is the right thing to test. The writer copies coded_side_data with avcodec_parameters_copy, and the probe reads AV_PKT_DATA_DOVI_CONF from the demuxed codecpar, so the test covers the whole path. The PR body says all three cases fail on FFmpegBuild 3.15.0, so the test can fail without the fix.

Findings

  • Nit: the HEVC NAL header comment says "layer 0, tid 1", but annexBPayload writes only one header byte. The second byte is the 0x88 filler, which gives layer 17 and tid_plus1 0. The muxer reads only the first byte, so the test still works, but the comment is wrong. (Tests/AetherEngineTests/LiveRecordingWriterTests.swift:471)
  • Nit: the result of av_packet_side_data_add is thrown away. If it ever fails, the record leaks and the test fails later on a confusing nil profile. (Tests/AetherEngineTests/LiveRecordingWriterTests.swift:433)

Checklist: CHANGELOG yes (the entry is already on main under [Unreleased]), docs n.a., tests yes, traits both ways n.a.

Needs a device run: nothing beyond CI

Thanks for following up on FFmpegBuild#11 with a test that pins the fix.

Automated review by Quint (Claude) of 5ef09fa. It reads the code, it does not build or run it; a maintainer reviews and merges.

onFailure: { _ in }
)
for i in 0..<10 {
// HEVC NAL header: type 19 (IDR_W_RADL) then type 1 (TRAIL_R), layer 0, tid 1.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: this comment does not match the bytes written. annexBPayload writes only one NAL header byte (0x26 or 0x02). The second HEVC header byte is then the 0x88 filler, which decodes as nuh_layer_id 17 and nuh_temporal_id_plus1 0, not "layer 0, tid 1". The TS muxer only looks at the first byte to decide whether to insert an AUD, so the test is unaffected. Either fix the comment to name only the NAL type, or append a real second byte (0x01) for these HEVC packets.

dovi.pointee.rpu_present_flag = 1
dovi.pointee.bl_present_flag = 1
dovi.pointee.dv_bl_signal_compatibility_id = compatibility
_ = av_packet_side_data_add(&p.pointee.coded_side_data, &p.pointee.nb_coded_side_data,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: the return value of av_packet_side_data_add is discarded. If the call fails, it does not take ownership of dovi, so the record leaks. The test then fails later with a nil profile that points at the muxer instead of the setup. A #require(av_packet_side_data_add(...) != nil) (or a precondition, since this helper does not throw) puts the failure in the right place.

superuser404notfound pushed a commit that referenced this pull request Nov 19, 2026
…ix the NAL comment

Follow-up to PR #1096 from Quint's review: the record attach no longer
drops its result (a failure would have leaked the record and failed later
on a nil profile), the codecpar goes through avcodec_parameters_free so
its side data is released, and the NAL header comment describes the one
byte annexBPayload writes.

Refs superuser404notfound/FFmpegBuild#11

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SeT6NgMt1vv32kPBhUmsUz
@superuser404notfound
superuser404notfound merged commit 0a01c6a into superuser404notfound:main Nov 19, 2026
6 checks passed
@superuser404notfound

Copy link
Copy Markdown
Owner

Merged, thanks @MistyKuu. Having all three profiles pinned, and checked against 3.15.0 so we know the test actually catches the old muxer, is exactly what FFmpegBuild#11 needed.

I added one small follow-up on top (e64807f) for Quint's two nits: the result of av_packet_side_data_add is checked now, the codecpar is released with avcodec_parameters_free so its side data goes with it, and the NAL comment only describes the one header byte the helper writes.

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