From 2d7e5e767143baec795a238652c3b446c2ea4991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 1 Dec 2022 21:04:19 +0100 Subject: [PATCH] tests/screen-cast: Add debug logs to screen cast client Part-of: --- src/tests/native-screen-cast.c | 6 ++++-- src/tests/screen-cast-client.c | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/tests/native-screen-cast.c b/src/tests/native-screen-cast.c index bcde15665..1db09ce44 100644 --- a/src/tests/native-screen-cast.c +++ b/src/tests/native-screen-cast.c @@ -50,8 +50,7 @@ meta_test_screen_cast_record_virtual (void) GSubprocess *subprocess; GMainLoop *loop; - launcher = g_subprocess_launcher_new ((G_SUBPROCESS_FLAGS_STDIN_PIPE | - G_SUBPROCESS_FLAGS_STDOUT_PIPE)); + launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE); test_client_path = g_test_build_filename (G_TEST_BUILT, "src", @@ -61,6 +60,9 @@ meta_test_screen_cast_record_virtual (void) g_subprocess_launcher_setenv (launcher, "XDG_RUNTIME_DIR", getenv ("XDG_RUNTIME_DIR"), TRUE); + g_subprocess_launcher_setenv (launcher, + "G_MESSAGES_DEBUG", "all", + TRUE); subprocess = g_subprocess_launcher_spawn (launcher, &error, test_client_path, diff --git a/src/tests/screen-cast-client.c b/src/tests/screen-cast-client.c index afd6f17b0..d7ed3f99b 100644 --- a/src/tests/screen-cast-client.c +++ b/src/tests/screen-cast-client.c @@ -214,6 +214,10 @@ on_stream_state_changed (void *user_data, { Stream *stream = user_data; + g_debug ("New PipeWire stream (%u) state '%s'", + stream->pipewire_node_id, + pw_stream_state_as_string (state)); + switch (state) { case PW_STREAM_STATE_ERROR: @@ -342,13 +346,19 @@ on_stream_process (void *user_data) struct pw_buffer *buffer = NULL; next_buffer = pw_stream_dequeue_buffer (stream->pipewire_stream); + if (next_buffer) + g_debug ("Dequeued buffer, queue previous"); while (next_buffer) { + buffer = next_buffer; next_buffer = pw_stream_dequeue_buffer (stream->pipewire_stream); if (next_buffer) - pw_stream_queue_buffer (stream->pipewire_stream, buffer); + { + g_debug ("Dequeued another buffer, queuing previous"); + pw_stream_queue_buffer (stream->pipewire_stream, buffer); + } } if (!buffer) return; @@ -740,31 +750,37 @@ main (int argc, Session *session; Stream *stream; + g_debug ("Initializing PipeWire"); init_pipewire (); + g_debug ("Creating screen cast session"); remote_desktop = remote_desktop_new (); screen_cast = screen_cast_new (); session = screen_cast_create_session (remote_desktop, screen_cast); stream = session_record_virtual (session, 50, 40); + g_debug ("Starting screen cast stream"); session_start (session); /* Check that the display server handles events being emitted too early. */ session_notify_absolute_pointer (session, stream, 2, 3); /* Check that we receive the initial frame */ - + g_debug ("Waiting for stream to be established"); stream_wait_for_node (stream); stream_wait_for_render (stream); stream_wait_for_streaming (stream); session_notify_absolute_pointer (session, stream, 6, 5); session_notify_absolute_pointer (session, stream, 5, 6); + + g_debug ("Waiting for frame"); stream_wait_for_render (stream); stream_wait_for_cursor_position (stream, 5, 6); g_assert_cmpint (stream->spa_format.size.width, ==, 50); g_assert_cmpint (stream->spa_format.size.height, ==, 40); /* Check that resizing works */ + g_debug ("Resizing stream"); stream_resize (stream, 70, 60); while (TRUE) { @@ -781,6 +797,7 @@ main (int argc, /* Check that resizing works */ stream_resize (stream, 60, 60); + g_debug ("Stopping session"); session_stop (session); stream_free (stream); @@ -790,5 +807,7 @@ main (int argc, release_pipewire (); + g_debug ("Done"); + return EXIT_SUCCESS; }