Repository navigation
Description
Follow-up to #132 as requested. We compared our (now retiring) client-side P7→8.1 implementation line-by-line against DoviRpuConverter/MP4SegmentMuxer/CodecRoutePolicy on 5.6.2, then confirmed the engine path on device. The cores are identical (libdovi dovi_convert_rpu_with_mode(rpu, 2), EL NAL 63 dropped, dvcC rewritten to profile 8 / bl_compat 1 / el_present 0, supplemental codec string from the source dv_level), so RPU output should be byte-identical. Differences that may be worth hardening:
-
In-band VPS still declares dual-layer after EL strip. Ours rewrites VPS max_layers_minus1 1→0 per keyframe; we added that after diagnosing a black screen on device. Caveat: our sample entry was dvh1-primary (forces the DV decode pipeline), while the engine routes hvc1 + dvvC with DV as a supplemental brand — and our 5.6.2 device confirmation shows that shape decodes fine with the stale VPS. Likely moot in your architecture; noting it because it was load-bearing in ours.
-
FEL is indistinguishable from MEL in the logs. Ours parses the first RPU and warns on FEL ("enhancement layer discarded, quality loss expected"). The converted output is the same either way, but a one-line log would help users triage why a FEL disc looks flatter than on a UHD player. Our confirmation source was MEL.
-
Conversion-failure posture. On a libdovi failure the producer logs once and muxes the packet unconverted, so a P7 RPU rides inside a stream declared 8.1 for the rest of the session. Ours kept per-session failure counters. Suggestion: after N failures, drop the RPU NAL instead — degrading to clean HDR10 beats shipping mixed-profile DV to the decoder.
-
Small shared gaps, for completeness: a source whose dvcC carries dv_level 0 produces "dvh1.08.00" (neither side recomputes level from the bitstream); Annex-B-framed input passes the NAL walk untouched (both assume length-prefixed framing, which the MKV demuxer guarantees).
Per-packet conversion cost on our side (same libdovi call) measured 0.2-0.4 ms/frame on AppleTV14,1 — comfortably inside a 41.7 ms frame budget — in case that's useful for the AdvancedStats work.
Activity
fix(dovi): degrade to HDR10 on P7 conversion failure; log FEL sources (…
docs: 5.8.1 changelog + P7 degrade/FEL notes; sweep version refs (#135)
Merge feat/135-dv-p7-hardening: DV P7 failure degrade + FEL logging (#…
superuser404notfound commentedon Jul 18, 2026
Thanks for the field notes, this is exactly the kind of follow-up worth folding in. I went through all four against the current engine path; two are now in 5.8.1, the other two turned out to be non-issues here for reasons worth writing down.
Shipped in 5.8.1
3. Conversion-failure posture. Agreed, and this was the real gap. The producer previously logged once and muxed the packet unconverted, so a failed P7 RPU rode inside a container already declared 8.1. It now drops the offending RPU (and its EL NAL) on any libdovi failure, so the frame degrades to the clean HDR10 base instead of handing mixed-profile DV to the decoder. I went with a per-packet drop rather than a session N-failure counter: it is strictly safer from the first failure, degrades per frame instead of cutting the whole session over, and a sporadic missing RPU is held by last-good metadata anyway. (Our docs already claimed "any per-packet conversion failure falls back to the HDR10 strip", which turns out to have been aspirational until now.)
2. FEL vs MEL logging. Added. The first RPU's
el_typeis probed once via libdovi and a FEL source emits a one-line log noting the enhancement layer is discarded. Also surfaced onDoviConvertProbeResult.enhancementLayerType, soaetherctl dovitestnow prints FEL/MEL for offline validation against a real remux.Non-issues here
1. In-band VPS still declaring dual-layer. Moot in this architecture, and your own 5.6.2 device confirmation is the proof. The engine routes the base layer as an
hvc1sample entry with DV carried as aSUPPLEMENTAL-CODECSbrand, not thedvh1-primary entry that forces the layered DV decode path, so nothing walks the VPSmax_layers_minus1to instantiate a second layer and the EL NALs are already gone. Your rewrite was load-bearing precisely because your sample entry wasdvh1-primary. I left the VPS untouched.4. Shared gaps. The
dv_level 0todvh1.08.00case is already guarded: the level derivation floors a zerodv_levelto 6 (sodvh1.08.06), and the engine never emits.00, though like you it does not recompute the level from the bitstream. Annex-B framing does not occur on this path (the loopback producer only sees length-prefixed MP4/MKV packets, as you note the MKV demuxer guarantees), so the AVCC-only NAL walk is safe here; I kept that as a documented assumption rather than add a start-code branch that can never fire.On the perf note: 0.2 to 0.4 ms/frame matches what we see, thanks for the AppleTV14,1 figure. No per-packet DV cost surfaced in AdvancedStats yet, but it is on the list.
And thanks for retiring your client-side path on the strength of the 5.6.2 confirmation, that is the outcome we were hoping for. Closing this as shipped in 5.8.1.
fix(dovi): refuse hostile RPUs before libdovi can abort the process