[pulseaudio-discuss] [PATCH 00/30] Routing: Add --routing option to pacat

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Jan 16 07:02:26 PST 2014


In an earlier mail[1] I proposed that the next routing patch set would
implement the following things:

1) pa_core_create_edge()/pa_core_delete_edge()
2) pa_node_activate()
3) Protocol extension & client API for setting the requested routing
   for new streams
4) --route option for pacat
5) Infrastructure support for passing the requested routing of new
   nodes to routing modules
6) Policy in module-experimental-router

I started working on that list, and after working for a while, I was
in a situation where items 3, 4 and 5 were implemented, and it felt
like a good place to stop and send out the work done so far.

So, this patch set implements the --routing option for pacat. The
option takes a list of node names, and the server will then do routing
of the pacat stream based on that list (if the list contains multiple
nodes, that sort of routing isn't supported yet, though). To make that
possible, there is a pile of infrastructure work first:

 * We now pass the requested connections of a new node to routing
   modules. This is not yet utilized by any routing modules, but...
 * ...a fallback initial routing implementation was added to node.c
   that uses the same interface as the routing modules, and uses the
   same requested connection information that is passed to routing
   modules.
 * Fallback routing (using the default sink/source) logic for sink
   inputs and source outputs was removed from sink-input.c and
   source-output.c, since node.c takes care of that now.
 * I added a device pointer to pa_device_port, which makes it easier
   to navigate from a port to a sink or source. (Useful in the
   fallback routing code.)
 * In order to ensure that a single device pointer in pa_device_port
   is sufficient, it's now impossible to create card profiles that
   contain multiple devices that share the same port.
 * Nodes now have an "active" property that is used by the fallback
   routing code to refuse streams that try to connect to an inactive
   port.
 * Instead of setting the sink or source or the "direct_on_input"
   thing during stream initialization, everything that is related to
   routing is now done with a node-based interface.
 * The protocol and the client API were extended so that pacat could
   set the initial routing for the stream that it creates.

Patches 16, 17 and 18 are totally unrelated to pacat's --routing
option. I wrote them at a point where I didn't yet know that pacat's
--routing option is really the next thing that I should implement. The
patches add an interface for routing modules to intercept port change
requests. Reviewers can skip those patches if they wish.

[1] http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/18925/focus=19083

Tanu Kaskinen (30):
  node: Add monitor and monitor_of fields to pa_node
  sink, source: Add get_node() convenience functions
  Pass the requested connections to pa_node_put()
  Allow pa_node_put() to fail
  node: Pass the requested connections to
    PA_CORE_HOOK_NODE_SET_INITIAL_ROUTING
  macosx: Fix a memory leak
  card: Use pa_card_free() in pa_card_new() on failure
  card: Prevent invalid profiles
  device-port: Add pa_device_port.device
  node: Implement fallback routing of new streams
  sink-input, source-output: Remove fallback routing code
  alsa: Fix return value check
  sink, source: Better error reporting for port change failures
  node: Add pa_node.active
  node: Simplify set_initial_routing_fallback()
  sink, source: Pass the port object instead of the port name to
    pa_sink/source_set_port()
  sink, source: Add PA_CORE_HOOK_DEVICE_SET_PORT
  skoa-router: Rescue streams on port changes
  PROTOCOL: Don't forbid bidirectional nodes
  stream: Add a comment
  sink-input, source-output: Remove
    pa_sink_input/source_output_new_data_is_passthrough()
  sink-input, source-output: Remove format negotiation using new data
  source-output: Add pa_source_output_set_direct_on_input()
  node: Support sink input as an initial route for source outputs
  sink-input, source-output: Use node-based initial routing
    configuration
  Add node-based stream initial routing support to the native protocol
  stream: Add pa_stream_set_initial_routing()
  dynarray: Add pa_dynarray_get_raw_array()
  pacat: Add --routing
  core-format, sink-input, source-output: Add some more logging

 PROTOCOL                                        |  13 +-
 man/pacat.1.xml.in                              |  26 +++
 src/Makefile.am                                 |   1 +
 src/map-file                                    |   1 +
 src/modules/alsa/alsa-ucm.c                     |   6 +-
 src/modules/alsa/module-alsa-card.c             |  21 +-
 src/modules/bluetooth/module-bluetooth-device.c |  21 +-
 src/modules/dbus/iface-device-port.c            |   6 +
 src/modules/dbus/iface-device-port.h            |   1 +
 src/modules/dbus/iface-device.c                 |   4 +-
 src/modules/echo-cancel/module-echo-cancel.c    |   4 +-
 src/modules/macosx/module-coreaudio-device.c    |   9 +-
 src/modules/module-combine-sink.c               |   2 +-
 src/modules/module-device-manager.c             |  16 +-
 src/modules/module-experimental-router.c        |  40 +++-
 src/modules/module-intended-roles.c             |  19 +-
 src/modules/module-ladspa-sink.c                |   2 +-
 src/modules/module-loopback.c                   |   4 +-
 src/modules/module-remap-sink.c                 |   2 +-
 src/modules/module-remap-source.c               |   2 +-
 src/modules/module-sine.c                       |   2 +-
 src/modules/module-skoa-router.c                |  59 ++++++
 src/modules/module-stream-restore.c             |  18 +-
 src/modules/module-switch-on-port-available.c   |   8 +-
 src/modules/module-virtual-sink.c               |   2 +-
 src/modules/module-virtual-source.c             |   2 +-
 src/modules/module-virtual-surround-sink.c      |   2 +-
 src/modules/rtp/module-rtp-recv.c               |   2 +-
 src/modules/rtp/module-rtp-send.c               |   2 +-
 src/pulse/internal.h                            |   2 +
 src/pulse/stream.c                              |  51 ++++-
 src/pulse/stream.h                              |  30 ++-
 src/pulsecore/card.c                            | 126 +++++++++---
 src/pulsecore/card.h                            |   4 +-
 src/pulsecore/cli-command.c                     |  16 +-
 src/pulsecore/core-format.c                     |   2 +
 src/pulsecore/core.h                            |  71 ++++++-
 src/pulsecore/device-port.c                     |  32 ++-
 src/pulsecore/device-port.h                     |   6 +
 src/pulsecore/dynarray.c                        |   6 +
 src/pulsecore/dynarray.h                        |   1 +
 src/pulsecore/edge.h                            |  27 +++
 src/pulsecore/node.c                            | 263 +++++++++++++++++++++++-
 src/pulsecore/node.h                            |  22 +-
 src/pulsecore/play-memblockq.c                  |   2 +-
 src/pulsecore/protocol-esound.c                 |   4 +-
 src/pulsecore/protocol-http.c                   |   2 +-
 src/pulsecore/protocol-native.c                 | 169 +++++++++++++--
 src/pulsecore/protocol-simple.c                 |   4 +-
 src/pulsecore/sink-input.c                      | 153 ++++----------
 src/pulsecore/sink-input.h                      |  13 +-
 src/pulsecore/sink.c                            |  81 ++++++--
 src/pulsecore/sink.h                            |  15 +-
 src/pulsecore/sound-file-stream.c               |   2 +-
 src/pulsecore/source-output.c                   | 193 ++++++-----------
 src/pulsecore/source-output.h                   |  20 +-
 src/pulsecore/source.c                          |  85 ++++++--
 src/pulsecore/source.h                          |   7 +-
 src/utils/pacat.c                               |  46 +++++
 59 files changed, 1308 insertions(+), 444 deletions(-)
 create mode 100644 src/pulsecore/edge.h

-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list