Files
Ignacy Łątka 616265a6e1 fix(screen-recording): report the real length of a remote recording
The MoQ path claimed to reconstruct "an honest real-time timeline". Measured
against the actual ffmpeg invocation, it does not: `-fps_mode cfr` can hold a
picture only up to the next packet, and this transport sends nothing while the
screen is still, so the video ends at the last change. A recording stopped a few
seconds after the UI settled — the normal case, since tool-call latency alone is
seconds — returned a 1s file reporting 5s of `durationMs`, a field documented as
"length of the returned video". Interior still stretches are held correctly; it
is only the tail that has no packet to extend to.

Track when the last frame reached the encoder and report that, with a warning
naming the gap. The paced local path leaves the new field null and keeps
reporting wall clock, which its video genuinely covers.

Three transport failures were also indistinguishable from a quiet device:

- A session dropping right after connect left `waitForFirstFrame` to burn its
  full 10s and then blame the device's screen, discarding the real cause.
- A server that stops publishing mid-recording closes the track cleanly, which
  went unrecorded — so stop returned a video that freezes early with no warning
  and a duration covering time it never captured.
- `close()` during a pending wait left the caller waiting on a stream that was
  already gone.

Each now fails with the cause, mirroring `mjpeg-stream`'s `fail`. The connect
race also abandoned its loser: a session completing after the timeout fired
produced a live WebTransport connection nobody owned, for the life of the
tool-server. It is closed now, and the timer cleared on the success path.

Fixes the pre-consumer buffer trim from the previous commit, which dropped to
the newest GOP and would have taken the head with it. The head is where the
SPS/PPS live on a producer that sends its parameter sets once, so it is kept and
the middle goes instead.

Docs: both SKILL.md copies still listed remote simulators as unrecordable and
promised a wall-clock-accurate timeline; `trimStatic` was silently ignored on
remote while its description promised trimming; and the start tool's
frame-stream error still blamed a remote transport it can no longer reach.
2026-07-30 17:56:43 +02:00
..