[pulseaudio-discuss] [PATCH 00/11] Routing: Move routing policy code out of module-alsa-card

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Sat Nov 23 21:57:57 PST 2013


module-alsa-card does currently a bit of routing: it moves streams
during profile switches with the goal of keeping streams connected to
the same card before and after the profile switch. This doesn't
belong to module-alsa-card, it should be in a policy module, so this
patch set removes that code from module-alsa-card.

This patch set introduces a new router module: module-skoa-router.
The new module implements the routing policy that module-alsa-card
used to have, but this time the policy won't be specific to ALSA, it
will also be used with the Bluetooth cards.

module-skoa-router is added to the default configuration to avoid
regressions due to the functionality being removed from
module-alsa-card.

Moving the policy to a separate module required some additions to the
core that were previously available only to module-alsa-card:

    - Different card back ends have different behaviour regarding
      whether to recreate sinks and sources that are part of both the
      new and old profile. This behaviour can now be checked from the
      pa_card.recreate_devices_on_profile_change flag.

    - When a profile is not active, its sinks and sources don't exist.
      The "potential" sinks and sources of the inactive profile are
      needed for planning the routing during profile switches, and
      those potential devices are now exposed as "device prototype"
      objects.

There's one part missing from this patch set: support for device
prototypes in module-coreaudio-device. This omission *probably*
doesn't break anything on OS X, but I really want to make all card
back ends behave in a uniform way, so fixing module-coreaudio-device
is in my plans. Adding the device prototypes for
module-coreaudio-device isn't straightforward, because the number of
sinks and sources isn't currently known at the card initialization
time. Some refactoring is hence needed. I might be able to delegate
this refactoring to Sjors Gielen, but this may take some more time,
so I decided to submit this patch set without the OS X bits.

Tanu Kaskinen (11):
  Pass the profile object instead of the profile name to
    pa_card_set_profile()
  Allow router modules to intercept profile switch requests
  New module: module-skoa-router
  Add names to routers
  card: Add recreate_devices_on_profile_change flag
  Introduce pa_device_prototype
  Add device prototype support to the core
  alsa: Add device prototype support
  bluetooth: Add device prototype support
  skoa-router: Implement a stream rescue policy for profile switch
    situations
  alsa: Remove the stream rescue policy from module-alsa-card

 src/Makefile.am                                 |   9 ++
 src/daemon/default.pa.in                        |   3 +
 src/daemon/system.pa.in                         |   3 +
 src/modules/alsa/alsa-mixer.c                   |  13 ++
 src/modules/alsa/alsa-mixer.h                   |   2 +
 src/modules/alsa/alsa-sink.c                    |   3 +
 src/modules/alsa/alsa-source.c                  |   3 +
 src/modules/alsa/module-alsa-card.c             |  25 +---
 src/modules/bluetooth/module-bluetooth-device.c |  69 ++++++++--
 src/modules/bluetooth/module-bluetooth-policy.c |   2 +-
 src/modules/dbus/iface-card-profile.c           |   6 +
 src/modules/dbus/iface-card-profile.h           |   1 +
 src/modules/dbus/iface-card.c                   |   2 +-
 src/modules/module-card-restore.c               |   2 +-
 src/modules/module-experimental-router.c        |   2 +-
 src/modules/module-skoa-router.c                | 162 ++++++++++++++++++++++++
 src/modules/module-switch-on-port-available.c   |   2 +-
 src/pulsecore/card.c                            |  35 +++--
 src/pulsecore/card.h                            |  12 +-
 src/pulsecore/cli-command.c                     |   8 +-
 src/pulsecore/core.c                            |  12 +-
 src/pulsecore/device-prototype.c                |  52 ++++++++
 src/pulsecore/device-prototype.h                |  40 ++++++
 src/pulsecore/protocol-native.c                 |  12 +-
 src/pulsecore/router.c                          |  16 ++-
 src/pulsecore/router.h                          |  16 ++-
 src/pulsecore/sink.c                            |  15 +++
 src/pulsecore/sink.h                            |   6 +
 src/pulsecore/source.c                          |  15 +++
 src/pulsecore/source.h                          |   6 +
 30 files changed, 503 insertions(+), 51 deletions(-)
 create mode 100644 src/modules/module-skoa-router.c
 create mode 100644 src/pulsecore/device-prototype.c
 create mode 100644 src/pulsecore/device-prototype.h

-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list