Sunshine v2026.319.132152
Self-hosted game stream host for Moonlight.
portal::session_cache_t Class Reference

Singleton cache for portal session data. More...

Public Member Functions

int get_or_create_session (int &pipewire_fd, int &pipewire_node, int &width, int &height)
 Get or create a portal session.
 
void invalidate () noexcept
 Invalidate the cached session.
 

Static Public Member Functions

static session_cache_tinstance ()
 

Detailed Description

Singleton cache for portal session data.

This prevents creating multiple portal sessions during encoder probing, which would show multiple screen recording indicators in the system tray.

Member Function Documentation

◆ get_or_create_session()

int portal::session_cache_t::get_or_create_session ( int & pipewire_fd,
int & pipewire_node,
int & width,
int & height )
inline

Get or create a portal session.

If a cached session exists and is valid, returns the cached data. Otherwise, creates a new session and caches it.

Returns
0 on success, -1 on failure

◆ invalidate()

void portal::session_cache_t::invalidate ( )
inlinenoexcept

Invalidate the cached session.

Call this when the session becomes invalid (e.g., on error).


The documentation for this class was generated from the following file: