mirror of
http://100.103.83.12:3003/fegger/screen_cast.git
synced 2026-09-17 09:42:44 +00:00
fix(render): keep the whole SDL lifecycle on the render thread
The receiver window never appeared on Wayland. Two causes: - The window was created on the main thread while event pumping and presenting ran on the render thread. SDL's Wayland backend requires a window's creation, event processing, drawing, and destruction to happen on one thread; a cross-thread surface simply never maps, with no error reported. The renderer now lives entirely on the render thread, with a condition-variable handshake so ReceiverPipeline:: start() still reports renderer failures and timeouts. - On Wayland a window is invisible until the first render commit, so even a healthy receiver showed nothing while waiting for a stream. The renderer presents one blank frame at init: the window is visible immediately, black until video arrives. Also log 'stream started (WxH)' when the first frame decodes and the first rendering failure, which is what made the remaining debugging observable. Validated headlessly end-to-end: a synthetic solid-color RTP feed drove the real receiver over localhost UDP; the window mapped, reported 'stream started (320x240)', and a grim screenshot of the window region showed the fed color (V=198, SATAVG=74 during the red feed). Phase 5 marked complete in docs/PHASES.md; current phase is now Phase 6.
This commit is contained in:
@@ -47,6 +47,17 @@ class SdlRenderer final : public Renderer {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Commit the surface once: on Wayland a window only becomes visible
|
||||
// after the first present, and the receiver must be visible while it
|
||||
// waits for the stream to start.
|
||||
SDL_SetRenderDrawColor(renderer_, 0, 0, 0, 255);
|
||||
if (!SDL_RenderClear(renderer_)) {
|
||||
last_error_ = std::string{"SDL_RenderClear failed: "} + SDL_GetError();
|
||||
shutdown();
|
||||
return false;
|
||||
}
|
||||
SDL_RenderPresent(renderer_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user