Skip to content

Draft: implement the session.initialized property

This is an attempt at addressing the race condition some applications see at startup:

  • pipewire is potentially socket-activated (or just about to start)
  • application connects
  • pipewire starts and starts pipewire-pulse and the session-manager
  • application does things before the session manager is ready and fails because none of the expected pieces are available.

The idea of addressing this race (partially) is to have a new property: "session.initialized". This property is set to zero at startup of a session manager, once the SM has completed its initialization period and assumes it is "done", the property is set to the current timestamp.

The application can thus do two things:

  • if there are no clients with "session.initialized", things may not work as expected. It may be worth waiting...
  • if there are clients with "session.initialized" of zero, things aren't ready yet. It may be worth waiting...
  • if all clients with "session.initialized" have it at nonzero, it's worth querying the graph for information

Note that this still requires the applications to do most of the tricky bit, the new property is merely there to make it easier to identify whether it's a good idea to fail.

See pipewire#1553, cc @wtaymans

Notes:

  • definitely a Draft, I have no idea whether wireplumber has (or can figure out) a state when it's "done for now"
  • filing this here since the pipewire patch for this is merely a PW_KEY_SESSION_INITIALIZED

Merge request reports