diff --git a/rs/moq-mux/src/container/ts/passthrough.rs b/rs/moq-mux/src/container/ts/passthrough.rs index 0e2ff52ee8..8835960fd5 100644 --- a/rs/moq-mux/src/container/ts/passthrough.rs +++ b/rs/moq-mux/src/container/ts/passthrough.rs @@ -167,6 +167,9 @@ pub struct Passthrough { /// Held until the first group is written, so the first catalog already names the track with /// its final `randomAccess`. reservation: Option>, + /// The import's timestamp base on the catalog: the first object anchors it, and every object + /// shifts by its offset onto the catalog clock. + clock: crate::catalog::Timebase, media: crate::container::Producer, /// The section as last written to the catalog, `None` before the first group. section: Option>, @@ -293,6 +296,7 @@ impl Passthrough { )?; Ok(Self { catalog, + clock: reserved.timebase(), reservation: Some(reserved), media, section: None, @@ -601,7 +605,11 @@ impl Passthrough { // Extrapolating past the last PCR before a small flagged jump can overshoot the jump. let ticks = ticks.max(self.written); self.written = ticks; - let timestamp = moq_net::Timestamp::from_micros(ticks / (PCR_HZ / 1_000_000))?; + // The first object starts a group, so it anchors the import before the reservation below + // publishes. + let timestamp = self + .clock + .shift(moq_net::Timestamp::from_micros(ticks / (PCR_HZ / 1_000_000))?)?; let size = object.payload.len() as u64; let start = object.start.or_else(|| { self.group @@ -617,10 +625,6 @@ impl Passthrough { if start != Start::RandomAccess || !self.single { self.all_random_access = false; } - if self.reservation.is_some() { - // The first object of the import is live on arrival. - self.catalog.anchor(timestamp)?; - } self.group = Some(Group { ticks, bytes: 0,