Skip to content

Recording: correct the first part's event startedAt by the late track's offset so input parts align within 1 s (OL-32 AC 3) #577

Closed

Description

@birme

Summary

Prerequisite for #569 (OL-32 AC 3), filed by daily-backlog-pr Phase 2 from acceptance run attempt 5 (#569 (comment)).

With #576 in place, every part after a split is startedAtSource:chained and exact. But a recorder's first part still takes its startedAt from rule 2 (event, receipt of RecorderFileChanged). For an input recorder, that receipt can come up to one GOP after the file's t=0. chained then carries the error into every later part.

Evidence (attempt 5, activation 40a6b370, local open-live at e421e4b, dev Strom :8082 v0.7.1)

  • SRT input video_in_1, p0: startedAt 12:25:51.451 (event). Program p0: 12:25:50.419 (event). That is +1.03 s, and the bound is 1 s.
  • The media lengths match (628.31 s of audio against 628.27 s), and both stopped at the same deactivate. So the gap is a start-time error, not real skew.
  • The stored end is impossible. SRT p2 endedAt is 12:36:19.764, but the object was registered at 12:36:18.214.
  • In SRT p0 the first video frame is at 1.717 s while audio starts at 0. Program has both at 0. Live Recorder appears to emit RecorderFileChanged only once both tracks are present, so after the first IDR (the test feed's GOP is 2 s).
  • Attempt 4 got +0.17 s on the same path, so the error depends on where the GOP falls when the input connects. The 50-80 ms in spec §6 does not hold for input recorders.
  • The WHIP input was +0.22 s. Program's own timeline also looks 0.1-0.8 s late (its p2 endedAt comes after its registration).

Proposed fix (option b from the run; team-decidable, spec §6 precedence)

For a recorder's first part, when the start comes from rule 2 (event), correct it by the file's earliest track start: startedAt = eventReceipt − (offset of the latest-starting track's first sample in the fMP4), or equivalently anchor on the earliest track. Do this at registration time in resolvePartTimings (src/lib/recording-parts.ts) or in the code that reads the part's duration, so chained inherits a correct base. Keep rule 1 (Eyevinn/strom#1057 start_utc_us) ahead of this when it becomes available. That is option (a), the long-term fix, and it needs no change here.

Alternative (c), accepting a one-GOP bound for inputs and restating AC 3, changes the acceptance criterion set by @svensson00, so it is not this team's call. Prefer (b).

Acceptance criteria

  1. Unit test: a first part whose video track starts N ms into the file gets startedAt corrected by that amount, with chained later parts following it. Parts with rule 1 or chained are unchanged.
  2. The endedAt of a recorder's last part is never later than its registration time in the test fixtures that model attempt 5.
  3. The next OL-32: ISO recording: record chosen inputs to their own files beside the program recording #569 acceptance run shows every input part within 1 s of program (AC 3).

Activity

  1. birme commented on Oct 26, 2026

    @birme
    ContributorAuthor

    Prerequisite for #569: filed by daily-backlog-pr Phase 2 (2026-10-26) from #569 acceptance run attempt 5, where AC 3 failed only on the SRT input's first-part startedAt (+1.03 s). #569 has no other code left. Once this merges, its next acceptance run re-checks AC 3.

  2. self-assigned this
    on Oct 26, 2026
  3. added a commit that references this issue on Oct 26, 2026
    eda71bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions