Skip to content

Screen sharing inconsistencies with different portal backends on Niri #2808

Description

@pietrobondioli

Screen sharing inconsistencies with different portal backends on niri

Summary

I've been experiencing inconsistent screen sharing behavior on niri with different applications. After systematic testing of both xdg-desktop-portal-wlr and xdg-desktop-portal-gnome, I found that different portal backends have opposite failure modes with the same applications, particularly affecting Google Meet and other WebRTC-based apps.

This appears related to issue #2254, but I've collected comprehensive test data that might help narrow down the root cause.

Environment

  • OS: NixOS
  • niri version: 25.08
  • Display resolution: 3840x2160@60Hz (scaled to 1.60)
  • PipeWire version: 1.4.9
  • WirePlumber: Active
  • xdg-desktop-portal: 1.20.3
  • Tested portal backends:
    • xdg-desktop-portal-wlr 0.8.0
    • xdg-desktop-portal-gnome 49.0

What I Tested

I created a systematic testing protocol and tested 5 different screen sharing applications with both portal backends:

  1. OBS Studio
  2. Vesktop (Discord client)
  3. Google Meet (Zen browser)
  4. teams-for-linux

Each test included monitoring 3 log streams: xdg-desktop-portal, portal backend (-wlr or -gnome), and pipewire.

Key Findings

🔥 Critical: Google Meet has opposite behavior between portals

With xdg-desktop-portal-gnome:

  • ❌ Completely broken
  • PipeWire format negotiation fails
  • Error: pw.link: negotiating -> error (no more input formats)
  • Portal picker appears but sharing never starts

With xdg-desktop-portal-wlr:

  • ✅ Works perfectly... but ONLY ONCE
  • ❌ Subsequent attempts fail with session state bug
  • Portal picker doesn't appear after first use
  • Workaround: systemctl --user restart xdg-desktop-portal-wlr
  • Error: Failed to close session implementation: Unknown object '/org/freedesktop/portal/desktop/session/...'

Application Compatibility Summary

Application wlr Portal gnome Portal
OBS Studio ✅ Works (with errors) ✅ Works perfectly
Vesktop ✅ Works (no errors!) ✅ Works (minor warnings)
Google Meet ⚠️ Works once (session bug) ❌ Broken (PipeWire error)
teams-for-linux ❌ App bug ❌ App bug

Error Patterns

xdg-desktop-portal-wlr specific:

Realtime error: Could not get pidns for pid XXXXX: pidns required but no pidfd provided
A backend call failed: No such device or address
Failed to close session implementation: GDBus.Error:org.freedesktop.DBus.Error.UnknownObject

xdg-desktop-portal-gnome specific:

Failed to associate portal window with parent window (cosmetic - doesn't break functionality)
pw.context: params Spa:Enum:ParamId:EnumFormat: Invalid argument (no more input formats)
pw.link: negotiating -> error (no more input formats)

Documentation

I've created comprehensive test documentation that I can provide:

  1. Testing Protocol screenshare-testing-protocol.md screenshare-testing-checklist.md

    • Step-by-step testing procedure
    • Exact commands used
    • Log collection methodology
  2. Scenario A Results test-results-scenario-a-wlr.md

    • Complete results with xdg-desktop-portal-wlr
    • All errors and logs captured
  3. Scenario B Results test-results-scenario-b-gnome.md

    • Complete results with xdg-desktop-portal-gnome
    • All errors and logs captured
  4. Comparison Report screenshare-comparison-report.md

    • Side-by-side comparison
    • Error pattern analysis
    • Recommendations

Questions

  1. Is the Google Meet PipeWire format negotiation issue a known problem with gnome portal + niri? The error suggests the portal and PipeWire can't agree on a compatible format.

  2. Should wlr portal work with niri, or is gnome the only officially supported backend? The niri wiki suggests gnome, but wlr actually solves the Google Meet PipeWire issue (despite introducing the session bug).

  3. Are there any PipeWire configuration options that might help with format negotiation for the gnome portal case?

Reproducibility

For Google Meet + gnome portal PipeWire error:

  1. Configure niri with xdg-desktop-portal-gnome
  2. Open Google Meet in any browser
  3. Try to share screen
  4. Portal picker appears and allows selection
  5. "Starting presentation..." hangs forever
  6. Check logs: journalctl --user -u pipewire -f shows format negotiation errors

For Google Meet + wlr portal session bug:

  1. Configure niri with xdg-desktop-portal-wlr
  2. Open Google Meet in browser
  3. Share screen - works perfectly
  4. Close browser
  5. Open browser again and try to share
  6. Portal picker never appears, share button stuck in "waiting" state
  7. Restart portal: systemctl --user restart xdg-desktop-portal-wlr
  8. Works again (once)

Willing to Help

I'm happy to:

  • Provide any additional logs or debugging information
  • Test patches or configuration changes
  • Help develop a fix (though I'd need some guidance as I'm not deeply familiar with portal/PipeWire internals)
  • Run git bisect if there's a suspected regression

This is affecting my daily workflow, so I'm very motivated to help resolve it! Let me know what additional information would be useful.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions