Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screencast session restore for Wayland / PipeWire #5559

Merged
merged 2 commits into from
Nov 24, 2021

Conversation

GeorgesStavracas
Copy link
Member

Description

Implement restoring screencast sessions using portals. Do so by storing the restore token received by the portal in the source data, and using it next time the source is loaded. This feature is only available in the v4 version of the ScreenCast portal [1] - if an older version is running in the host system, the current behavior is preserved.

Motivation and Context

Currently OBS Studio has to recreate screencast sessions from scratch each time a PipeWire source is loaded. This can be annoying,

Use the new screencast restore options provided by xdg-desktop-portal to restore previous sessions.

How Has This Been Tested?

  • Have xdg-desktop-portal and xdg-desktop-portal-gnome installed from the master/main branches [2]
  • Run this branch of OBS Studio on Wayland, or X11 with OBS_USE_EGL=1
  • Add a PipeWire source, and select a window or a monitor
  • Close OBS Studio
  • Open it again
  • Notice that the sources were restored automatically

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

[1] flatpak/xdg-desktop-portal#638
[2] This is not a GNOME-specific feature; it's just the only implementation available at this point. KDE folks reviewed and approved this new feature, and might be working on their implementation.

This will be used by the next commit to verify whether or not
to pass the restore token and persist mode options.
With the version 4 of the screencast portal, it is now possible
to request and use restore tokens [1] so that apps can restore a
previously configured screencast session without user interaction.

Add the corresponding code to linux-capture's PipeWire source.
Store the restore token in the source data, since each restore
token corresponds to an OBS source, and use it as soon as we try
to create a new session. Implement the obs_source_info.save vfunc,
and save the restore token when it's received by the Start()
response using obs_source_save().

[1] flatpak/xdg-desktop-portal#638
@GeorgesStavracas GeorgesStavracas added Enhancement Improvement to existing functionality Linux Affects Linux labels Nov 21, 2021
@GeorgesStavracas GeorgesStavracas changed the title Implement screencast session restore for Wayland / PipeWire Screencast session restore for Wayland / PipeWire Nov 21, 2021
@kkartaltepe
Copy link
Collaborator

Are there any issues tracking implementation on other platforms you can link?

@GeorgesStavracas
Copy link
Member Author

Are there any issues tracking implementation on other platforms you can link?

I just opened https://bugs.kde.org/show_bug.cgi?id=445875 and emersion/xdg-desktop-portal-wlr#170 - not entirely sure it's a good idea for them to be in the commit message, do you have any preference?

@kkartaltepe
Copy link
Collaborator

I agree it doesnt make sense in the commit message. I just wanted to know if other implementations actually were tracking the effort of implementing this functionality or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality Linux Affects Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants