Skip to content

Instantly share code, notes, and snippets.

@columbarius
Last active August 17, 2023 07:43
Show Gist options
  • Save columbarius/50239ea3c4c70df8f240aa50f88e801a to your computer and use it in GitHub Desktop.
Save columbarius/50239ea3c4c70df8f240aa50f88e801a to your computer and use it in GitHub Desktop.
PipeWire Screencast Info
#!/bin/sh
pw-dump | jq -r '[.[] | select(.info.props."node.name" | IN("firefox","gnome-shell","kwin_wayland","obs","xdg-desktop-portal-wlr","xdp-screencast.py")) | .id] as $pw_node_ids | [ .[] | select(.info.props."node.id" | IN($pw_node_ids[])) | .id ] as $pw_port_ids | .[] | select(.id | IN(($pw_node_ids + $pw_port_ids)[]))'
@mvdan
Copy link

mvdan commented Aug 10, 2023

Thanks for clarifying. To be clear, I had checked both with and without an active screenshare, and the output was the same. I just checked again. I already went through the rest of the troubleshooting steps, so I can at least verify that all the pieces are running.

I assume that for some reason the screenshare isn't even starting properly. I tried seeing if firefox or xdg-desktop-portal-wlr showed any errors, because they did with previous issues I had before, but there's nothing I can see. I did capture wlr's debug logs, in case they shed any light - clearly it's trying to do something:

wlr debug logs
$ /usr/lib/xdg-desktop-portal-wlr -l DEBUG
2023/08/10 22:37:07 [INFO] - config: no config file found, using the default config
2023/08/10 22:37:07 [DEBUG] - config: outputname:  (null)
2023/08/10 22:37:07 [DEBUG] - config: max_fps:  0.000000
2023/08/10 22:37:07 [DEBUG] - config: exec_before:  (null)
2023/08/10 22:37:07 [DEBUG] - config: exec_after:  (null)
2023/08/10 22:37:07 [DEBUG] - config: chooser_cmd: (null)
2023/08/10 22:37:07 [DEBUG] - config: chooser_type: default
2023/08/10 22:37:07 [DEBUG] - config: force_mod_linear: 0
2023/08/10 22:37:07 [DEBUG] - dbus: connected
2023/08/10 22:37:07 [DEBUG] - wlroots: wl_display connected
2023/08/10 22:37:07 [DEBUG] - pipewire: pw_loop created
2023/08/10 22:37:07 [DEBUG] - pipewire: establishing connection to core
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_shm  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: |-- registered to interface wl_shm (Version 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_drm  (Version: 2)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_linux_dmabuf_v1  (Version: 4)
2023/08/10 22:37:07 [DEBUG] - wlroots: |-- registered to interface zwp_linux_dmabuf_v1 (Version 4)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_compositor  (Version: 5)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_subcompositor  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_data_device_manager  (Version: 3)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_gamma_control_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zxdg_output_manager_v1  (Version: 3)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register org_kde_kwin_idle  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register ext_idle_notifier_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_idle_inhibit_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_layer_shell_v1  (Version: 4)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register xdg_wm_base  (Version: 2)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_tablet_manager_v2  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register org_kde_kwin_server_decoration_manager  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zxdg_decoration_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_relative_pointer_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_pointer_constraints_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wp_presentation  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_output_manager_v1  (Version: 4)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_output_power_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_input_method_manager_v2  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_text_input_manager_v3  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_foreign_toplevel_manager_v1  (Version: 3)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register ext_session_lock_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wp_drm_lease_device_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_export_dmabuf_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_screencopy_manager_v1  (Version: 3)
2023/08/10 22:37:07 [DEBUG] - wlroots: |-- registered to interface zwlr_screencopy_manager_v1 (Version 3)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_data_control_manager_v1  (Version: 2)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_primary_selection_device_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wp_viewporter  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wp_single_pixel_buffer_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zxdg_exporter_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zxdg_importer_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zxdg_exporter_v2  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zxdg_importer_v2  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register xdg_activation_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_virtual_keyboard_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_virtual_pointer_manager_v1  (Version: 2)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwlr_input_inhibit_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_keyboard_shortcuts_inhibit_manager_v1  (Version: 1)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_seat  (Version: 8)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register zwp_pointer_gestures_v1  (Version: 3)
2023/08/10 22:37:07 [DEBUG] - wlroots: interface to register wl_output  (Version: 4)
2023/08/10 22:37:07 [DEBUG] - wlroots: |-- registered to interface wl_output (Version 4)
2023/08/10 22:37:07 [DEBUG] - wayland: registry listeners run
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_handle_main_device called
2023/08/10 22:37:07 [INFO] - xdpw: Using render node /dev/dri/renderD128
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_format_table called
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_tranche_target_devices called
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_tranche_flags called
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_tranche_formats called
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_tranche_done called
2023/08/10 22:37:07 [DEBUG] - wlroots: linux_dmabuf_feedback_handle_done called
2023/08/10 22:37:07 [DEBUG] - wayland: dmabuf_feedback listeners run
2023/08/10 22:37:15 [INFO] - dbus: create session method invoked
2023/08/10 22:37:15 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_28/webrtc_107886671
2023/08/10 22:37:15 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_28/webrtc_session557058456
2023/08/10 22:37:15 [INFO] - dbus: app_id: 
2023/08/10 22:37:15 [INFO] - dbus: select sources method invoked
2023/08/10 22:37:15 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_28/webrtc1001353819
2023/08/10 22:37:15 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_28/webrtc_session557058456
2023/08/10 22:37:15 [INFO] - dbus: app_id: 
2023/08/10 22:37:15 [DEBUG] - dbus: select sources: found matching session /org/freedesktop/portal/desktop/session/1_28/webrtc_session557058456
2023/08/10 22:37:15 [INFO] - dbus: option types:3
2023/08/10 22:37:15 [INFO] - dbus: option multiple: 0
2023/08/10 22:37:15 [INFO] - dbus: option persist_mode:1
2023/08/10 22:37:15 [INFO] - wlroots: capturable output: Chimei Innolux Corporation model: 0x140A: id: 44 name: eDP-1
2023/08/10 22:37:15 [DEBUG] - wlroots: output chooser called
2023/08/10 22:37:15 [DEBUG] - wlroots: output chooser called
2023/08/10 22:37:16 [DEBUG] - wlroots: output chooser selects eDP-1
2023/08/10 22:37:16 [INFO] - xdpw: screencast instance 0x55664db234b0 has 1 references
2023/08/10 22:37:16 [INFO] - xdpw: 1 active screencast instances
2023/08/10 22:37:16 [INFO] - wlroots: output: eDP-1
2023/08/10 22:37:16 [INFO] - dbus: session closed
2023/08/10 22:37:16 [DEBUG] - dbus: destroying session 0x55664db0db00
2023/08/10 22:37:16 [DEBUG] - xdpw: screencast instance 0x55664db234b0 now has 0 references
2023/08/10 22:37:16 [DEBUG] - xdpw: destroying cast instance

@mvdan
Copy link

mvdan commented Aug 10, 2023

What's really interesting is that Chromium's "share entire screen" preview works - I can see the small screen there after selecting it. But then, once I start the screenshare, nothing - just like on Firefox.

@mvdan
Copy link

mvdan commented Aug 12, 2023

Finally found the culprit: an assertion is failing over on PipeWire:

'loop->recurse > 0' failed at ../pipewire/src/pipewire/thread-loop.c:426 pw_thread_loop_wait()

I also found that OBS can screenshare just fine. It seems like jumping from the "preview" to the actual screenshare on firefox/chromium is what causes the error. I filed a pipewire issue to see if the failed assertion can get us anywhere: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3428

@mvdan
Copy link

mvdan commented Aug 17, 2023

Ah, this is fixed in Firefox Beta 117.0b8, so it was clearly a problem on their side. I initially thought it was https://bugzilla.mozilla.org/show_bug.cgi?id=1841851, but updating regular firefox to 116.0.3 did not fix it. Either way, apologies for the noise, I was just frantically trying to debug the breakage :)

@rpigott
Copy link

rpigott commented Aug 17, 2023

Nice. Glad you got it sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment