Skip to content

[Feature] Run Replay HQ orchestration and encoding in a dedicated Worker #484

Description

@chdenat

Context

Replay HQ export uses fixed frame timestamps and an isolated Cesium render
target, but the isolated renderer and export orchestration currently run on the
main thread. The capture lifecycle also hides the standard Studio UI. This
prevents the user from continuing to work in the standard workspace while an
HQ export is running and leaves timeline, readiness, composition, and encoding
work competing with UI tasks.

The HQ camera must remain the dedicated export camera. This issue does not add
or restore a Visible map camera mode.

Requested behavior

Move HQ frame scheduling, export state transitions, progress, cancellation, and
encoding coordination to a dedicated Worker. Keep the existing isolated Cesium
HQ renderer on the main thread for this option.

The Worker must consume an immutable, serializable export snapshot. The main
thread must render only through the dedicated HQ render target and must never
use the interactive Studio camera as an HQ authority.

The standard workspace must remain visible and usable during export. Changes to
the interactive camera or scene must not change the export timeline, crop
rectangle, dedicated camera, or captured widget state.

Acceptance criteria

  • The standard Studio workspace remains available during an HQ export.
  • The interactive Studio camera is not used to resolve or apply HQ camera
    frames.
  • The Worker owns fixed frame iteration, export progress, cancellation, and
    encoding coordination.
  • The main thread owns only the dedicated HQ render request and returns
    transfer-friendly frame data to the Worker.
  • The export snapshot contains serializable timeline, render-spec, crop, camera,
    and widget-composition inputs and cannot change after the first frame.
  • Widget output is frozen or snapshotted before export and remains stable even
    when the user edits the standard workspace.
  • Back-pressure prevents unbounded pending render requests or frame buffers.
  • Success, cancellation, readiness failure, and encoding failure release the
    render target and all Worker resources.
  • Progress, remaining time, errors, and cancellation are exposed to the
    existing recording monitor without making the monitor a replay authority.
  • The benchmark in the replay quality validation document records export time,
    main-thread task duration, memory, frame count, and visual output for the
    supported reference journeys.

Notes or questions

  • The implementation must preserve the existing canonical replay frame
    contract; the Worker is not a second replay clock.
  • The crop board remains capture infrastructure even when its editor UI is
    hidden.
  • A real HQ visual run is required because this changes frame scheduling,
    composition, and encoding ownership.

Technical notes

  • Define versioned Worker request/event contracts with serializable payloads.
  • Prefer transferables and VideoFrame where supported; avoid copying the
    same pixel buffer multiple times.
  • Keep Cesium, DOM, React, and Valtio objects on the main thread in this issue.
  • Add focused protocol, cancellation, back-pressure, and lifecycle tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions