tests/screen-cast: Add debug logs to screen cast client

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2727>
This commit is contained in:
Jonas Ådahl 2022-12-01 21:04:19 +01:00 committed by Marge Bot
parent 425c7652cf
commit 2d7e5e7671
2 changed files with 25 additions and 4 deletions

View File

@ -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,

View File

@ -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,14 +346,20 @@ 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)
{
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;
}