From 48e95a7b2c62a8843a036aa73a449d2daaa61834 Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Wed, 24 Jun 2026 00:49:22 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20correct=20hevc.rs=20doc=20comments=20?= =?UTF-8?q?=E2=80=94=20non-seamless=20BD=20join=20is=20connection=5Fcondit?= =?UTF-8?q?ion=200x05/0x06=20not=200x01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comments at lines ~63 and ~102 misidentified 0x01 (first-item/seamless) as the non-seamless trigger and labelled 0x05/0x06 as seamless — inverted vs the BD-ROM spec and mpls.rs (which documents 1=seamless, 5/6=non-seamless). Corrected all affected doc blocks; no logic change. --- src/mux/codec/hevc.rs | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/mux/codec/hevc.rs b/src/mux/codec/hevc.rs index 0ac169e..592243a 100644 --- a/src/mux/codec/hevc.rs +++ b/src/mux/codec/hevc.rs @@ -61,8 +61,8 @@ pub struct HevcParser { // Splice-aware CRA→BLA rewrite (non-seamless BD clip boundaries). // // When a BD title concatenates clips at a NON-SEAMLESS join (MPLS - // connection_condition 0x01), the next clip opens with a CRA whose RASL - // leading pictures reference frames from before the splice — gone after + // connection_condition 0x05 or 0x06), the next clip opens with a CRA whose + // RASL leading pictures reference frames from before the splice — gone after // concatenation. The caller (the code that crosses the join) sets this flag // via `mark_clip_boundary`; the parser then rewrites the FIRST CRA it sees // at/after that point from CRA_NUT (21) to BLA_W_LP (16) so a linear decoder @@ -72,9 +72,11 @@ pub struct HevcParser { // // SAFETY: defaults to `false` and is ONLY ever set through // `mark_clip_boundary`, which the caller invokes ONLY for a non-seamless - // (0x01) join. A stream with no boundary marker (single-clip title, any - // seamless-joined UHD/BD) never has this set, so the rewrite branch is never - // reached and output is byte-identical to a parser without this field. + // (0x05/0x06) join. connection_condition 0x01 is the first-item/seamless + // case and must NOT trigger this flag. A stream with no boundary marker + // (single-clip title, or seamless-joined 0x01 UHD/BD) never has this set, + // so the rewrite branch is never reached and output is byte-identical to a + // parser without this field. pending_clip_boundary: bool, } @@ -99,19 +101,23 @@ impl HevcParser { } /// Mark that the NEXT IRAP this parser sees begins a NON-SEAMLESS BD clip - /// (MPLS connection_condition 0x01). The first CRA at/after this point is - /// rewritten CRA_NUT (21) → BLA_W_LP (16) so a linear decoder sets - /// NoRaslOutput and discards the now-dangling RASL leading pictures with no - /// "could not find ref" error. + /// join. MPLS connection_condition 0x05 and 0x06 are the non-seamless + /// values (per the BD-ROM spec: 0x01 = first item / seamless, 0x05/0x06 = + /// non-seamless). The first CRA at/after this point is rewritten CRA_NUT + /// (21) → BLA_W_LP (16) so a linear decoder sets NoRaslOutput and discards + /// the now-dangling RASL leading pictures with no "could not find ref" + /// error. /// - /// MUST be called ONLY when MPLS reports the join as non-seamless. It is a - /// no-op for the rewrite unless a CRA actually follows: an IDR/IDR_W_RADL - /// boundary needs no fix (it carries no cross-splice references), and the - /// flag is cleared by the first IRAP-class CRA it reaches. + /// MUST be called ONLY when MPLS reports connection_condition as 0x05 or + /// 0x06 (non-seamless). It is a no-op for the rewrite unless a CRA actually + /// follows: an IDR/IDR_W_RADL boundary needs no fix (it carries no + /// cross-splice references), and the flag is cleared by the first + /// IRAP-class CRA it reaches. /// - /// SAFETY: never call this for a seamless join (0x05/0x06) or within a - /// single-clip title — doing so could convert a legitimate mid-content CRA - /// to BLA. The default (never called) path leaves output byte-identical. + /// SAFETY: never call this for connection_condition 0x01 (seamless/first + /// item) or within a single-clip title — doing so could convert a + /// legitimate mid-content CRA to BLA. The default (never called) path + /// leaves output byte-identical. pub fn mark_clip_boundary(&mut self) { self.pending_clip_boundary = true; }