Skip to content

Surface stream's device being destroyed to the user #77

@mbernat

Description

@mbernat

Problem Statement

Streams need to be linked to devices before they can be used. There is a set of rules that determines what happens when a device is not found or destroyed called linking policy.

By default pipewire silently switches to some compatible or a default device, which is likely undesirable in most cases. It would be better to surface the problem to the user and let them decide whether they want to wait, reconfigure, or terminate the stream.

Proposed Solution

Use the following linking policy for non-default devices.

  • node.dont-reconnect: true (default false) <- we get an error when the device is destroyed.
  • node.dont-fallback: true (default false) <- we get an error when the device is not found; this should only happen if the device is destroyed right after enumeration, so it's much less important.
  • node.dont-move: false (default false)
  • node.linger: false (default false)

These errors need to be surfaced to the user in some way. The obvious choice would be to accept a new error callback, invoked in these situations; cpal also has an API of this form.

Alternative Solutions

Expose the linking policy configuration to the user. This would need to be made pipewire-specific or we would need to find a portable way to do it (presumably other drivers also have similar settings).

It might be desirable to let users specify a general Properties value so that they can tune any stream properties themselves but that's a bigger can of worms.

Example Usage

TBD

Provide an example of how this feature would be used:

// Your example code here

Additional Context

N/A

Checklist

  • I have searched for existing issues that may be similar
  • I have explained the feature's value proposition
  • I have provided concrete examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions