HydraIssues

A head screenshot is black during a stream: capture the video for interface verification
open feature Project: hydraheadipad Reporter: 9 Nov 2026 13:49

Description

A head screenshot during a stream returns black plus the floating menu button.
Measured 2026-11-09: a 92 KB JPEG, entirely black, while the operator at the
iPad could see the game.

Cause, confirmed

AppState.captureAndUploadScreenshot uses window.drawHierarchy(in:afterScreenUpdates:).
The video is in an AVSampleBufferDisplayLayer (VideoDecoderRenderer.m:44,
added as a sublayer at line 70). drawHierarchy and CALayer.render(in:) walk
the Core Animation tree the application owns. The render server composites that
layer, so neither call can read it, and the result is the layer's own black
backgroundColor set at line 45. No flag changes this. The menu button
survives because it is an ordinary UIButton, so a black image with one button
is proof the interface half of the capture path is correct.

Two corrections to the obvious plan

There is no decoded pixel buffer to tap. submitDecodeBuffer: builds a
CMSampleBuffer holding compressed H.264 access units and hands it to
enqueueSampleBuffer:. The layer decodes internally and never returns the
pixels. Any head side capture must decode a second time with a session this
application owns.

submitDecodeBuffer: runs on the MAIN thread. Connection.m:517 sets
CAPABILITY_PULL_RENDERER, so the renderer owns the frame loop through a
CADisplayLink on the main run loop (VideoDecoderRenderer.m:105). The hazard
is therefore not a data race but the display link budget, 16.6 ms at 60 frames
per second, with frame pacing on. Slow work there drops frames in front of a
visitor.

Rejected mechanisms

  • AVSampleBufferDisplayLayer has no public readback. copyDisplayedPixelBuffer
    exists and is private staging SPI, used by WebKit behind a build flag. This
    app ships to TestFlight and the App Store. Not worth the lane.
  • ReplayKit shows a consent alert to a person at the device, again after 8
    idle minutes, and allows one app at a time. A kiosk has nobody in front of it.
  • Decoding every frame twice doubles decode load for a picture wanted
    occasionally.
  • Replacing the render path with Metal rewrites the one part that works
    reliably in the field, for a screenshot.

Recommended mechanism

On request, call LiRequestIdrFrame(), which setHdrMode: already calls, so it
is a known safe event. When the next FRAME_TYPE_IDR reaches
submitDecodeBuffer:, retain that sample buffer and hand it to a private serial
queue, which creates a VTDecompressionSession, decodes the one self contained
frame, converts it and encodes JPEG. Steady state cost is one boolean test per
frame. Peak memory about 12 MB for a few tens of milliseconds.

Draw the frame into a window shaped canvas at the display layer's rectangle on
the letterbox background, rather than returning a bare video frame. A bare frame
hides the head's orientation and letterboxing, which are two of the faults this
lane exists to catch.

Scope this to interface verification only

This is not the way to operate a head remotely. The body already captures
its own desktop and that lane is cheaper, serves every head type, and works when
the head is asleep or absent. See #1161 and #1160.

The justification for this issue is the roughly 45 unwalked testbook steps
across #1150, #1151, #1153 and #1154 that ask what the person in front of the
iPad sees. No body capture can answer any of them:

  • the keyboard raised over a stream (#1153)
  • the red failure panel and "Session interrupted" (#1154)
  • the selection ring and focus on the grid
  • orientation, letterbox bars, a sheet over video

Honest objections

  • It touches submitDecodeBuffer:, the hot loop of the only feature that
    matters, on the main thread. A mistake there is a frozen game, not a red test.
  • A screenshot gains the power to disturb a live stream: it spends a key frame
    and starts a second decoder. The rate limit is part of the feature, not an
    optimisation.
  • Capture is not the binding constraint. Nothing shipped today is device
    verified. A perfect screenshot changes nothing until a head is reachable.

Estimate about 270 lines in the submodule plus about 70 in the app, one focused
day plus a walk on real hardware. The new file pair needs six
project.pbxproj entries, not four, because there are two files.

Full design note including the thread ownership table, memory figures, the HDR
path when HEVC is re-enabled, and sources was produced on 2026-11-09.

Session Context

Venue
cloud-seven