Skip to content

WpSiAdapter

Julian Bouzas requested to merge julian/wireplumber:si-adapter into master

This MR delays the configuration of port format until 2 nodes are linked. The following changes have been done:

  • Renamed WpPortInfo interface to WpLinkable
  • Added new WpSiAdapter interface with an API to set and get the session item port format
  • Implemented such WpSiAdapter interface in both si-audio-adapter and si-audio-endpoint session items. The si-node session item does not implement the interface because it is not possible to set format in video nodes.
  • There is a wp_si_adapter_is_format_activable() API in WpSiAdapter, which is used by si-standard-link to determine which linkable item needs to be configured with a different/new format.
  • The si-audio-endpoint always return FALSE when wp_si_adapter_is_format_activable() is called, and never sets the format when the endpoint is activated. On the other hand, if using a si-audio-adapter, it will return TRUE if the node is a device node (and the item will automatically configure the ports with a sensible audio format on activation), or FALSE if the node is a client node (and the item won't configure ports on activation).
  • The linking logic in si-standard-link has been improved in the following way:
    • If both In and Out items are not adapters, just get the ports and create links like before (Used for video nodes)
    • If both In and Out items are WpSiAdapter, check wp_si_adapter_is_format_activable() return value in both items:
      • If value is FALSE in In item, and TRUE in Out item, configure In format using Out format, and then create the links (used for audio capture cases between client node and device node).
      • If value is FALSE in Out item, and TRUE in In item, configure Out format using In format, and then create the links (used for audio playback cases between client node and device node)
      • If both In and Out item values are TRUE, check if both formats are the same:
        • If both formats are the same, don't configure anything and just link nodes (used when linking 2 device nodes with same format)
        • If formats are not the same, configure In item with Out format, and then create the links (usually used when linking 2 device nodes with different format)
      • If both values are FALSE, configure Out and In node with Out default format, and create links (usually used when linking 2 client nodes)
    • If one item is an adapter, and the other item is not an adapter, throw an activation error and don't link anything
Edited by Julian Bouzas

Merge request reports