From e9f288fd0912cde18cddd78eae030e0e877c228c Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Sun, 15 Oct 2023 20:17:22 +0200 Subject: Initial implementation of wlr capturing --- main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 2e0ddc4..e848536 100644 --- a/main.c +++ b/main.c @@ -52,6 +52,7 @@ struct Contexts { struct InputHandler* input_handler; struct CaptureContext* capture_context; struct EncodeContext* encode_context; + bool drop_client; }; static int CreateServerSocket(const char* arg) { @@ -144,7 +145,10 @@ static void OnCaptureContextFrameReady(void* user, return; drop_client: - MaybeDropClient(contexts); + // TODO(mburakov): Can't drop client here, because leftover code in capturing + // functions would fail in this case. Instead just schedule dropping client + // here, and execute that in the event loop of the main function. + contexts->drop_client = true; } static void OnClientWriting(void* user) { @@ -296,6 +300,10 @@ int main(int argc, char* argv[]) { LOG("Failed to iterate io muxer (%s)", strerror(errno)); g_signal = SIGABRT; } + if (contexts.drop_client) { + MaybeDropClient(&contexts); + contexts.drop_client = false; + } } MaybeDropClient(&contexts); -- cgit v1.2.3