Fix stale frame in API CSS preview when source is inactive
Server: send initial frame immediately after metadata for api_input sources so the client gets the current buffer (fallback color if inactive) instead of never receiving a frame when push_generation stays at 0. Frontend: clear all test modal canvases on open to prevent stale pixels from previous sessions. Reset FPS timestamps after metadata so the initial bootstrap frame isn't counted in the FPS chart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -890,6 +890,14 @@ async def test_color_strip_ws(
|
||||
meta["layer_infos"] = layer_infos
|
||||
await websocket.send_text(_json.dumps(meta))
|
||||
|
||||
# For api_input: send the current buffer immediately so the client
|
||||
# gets a frame right away (fallback color if inactive) rather than
|
||||
# leaving the canvas blank/stale until external data arrives.
|
||||
if is_api_input:
|
||||
initial_colors = stream.get_latest_colors()
|
||||
if initial_colors is not None:
|
||||
await websocket.send_bytes(initial_colors.tobytes())
|
||||
|
||||
# For picture sources, grab the live stream for frame preview
|
||||
_frame_live = None
|
||||
if is_picture and hasattr(stream, 'live_stream'):
|
||||
|
||||
Reference in New Issue
Block a user