Skip to content

Live window capture session #30

Description

@jpka

Parent

Part of #25 (Screen Solver v1: implementation spec), itself under the map #1.

What to build

A live, correct capture of whatever window is currently the configured target, held open rather than re-grabbed per solve — and the signals needed to know when a capture isn't good enough to spend a model call on.

In the hidden renderer: turn a desktopCapturer source for the target window into a live MediaStream via getUserMedia (Windows.Graphics.Capture-backed — not PrintWindow, which silently returns black frames on GPU-composited Chrome/Edge with no error signal), draw frames to a canvas, downscale to 1568px on the long edge with no crop, encode, and send the bytes to main over IPC on request. One session is opened the moment a target is selected (consuming ticket 2's change signal) and stays open while idle; a target change tears down the old session and opens a new one immediately under the same rule — never a fresh session per solve, which would make the OS capture-indicator border flicker. The module also exposes the signals a caller needs before spending a call: whether the target is minimized (isMinimized/IsIconic), whether it has vanished from window enumeration (treated as ambiguous between closed and moved-to-another-desktop, not a definitive failure), and whether a freshly captured frame is black or zero-size (a non-black-pixel ratio check).

Acceptance criteria

  • Selecting a target window (via ticket 2) opens exactly one capture session for it; changing the target tears down the old session and opens exactly one new one.
  • Requesting a frame while a session is open returns a downscaled (≤1568px long edge), uncropped, encoded image.
  • The target window being minimized is detectable via the exposed signal without requiring a frame grab first.
  • A frame captured from a minimized or black/zero-size window is flagged as such by the exposed check, distinguishable from a normal frame.
  • The target window vanishing from enumeration is exposed as its own ambiguous signal, distinct from "confirmed closed."
  • Manual verification against a real GPU-composited Chrome/Edge window confirms a non-black frame is captured (documented as a manual check, not automated — this needs a real composited desktop).

Blocked by

#28 (Target window config surface) — needs a target window identity and its change signal to react to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentImplementation-ready spec, ready to be picked up by an agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions