[pulseaudio-discuss] [PATCH 3/7] device-manager, filter-apply: don't reroute streams that have a filter

Tanu Kaskinen tanuk at iki.fi
Tue Mar 22 13:54:44 UTC 2016


On Tue, 2016-03-22 at 15:41 +0200, Tanu Kaskinen wrote:
> device-manager reroutes all streams whenever a new device appears.
> When filter-apply has loaded a filter for some stream, the filter
> device may not be what device-manager considers the best device for
> the stream, which means that when an unrelated device appears,
> device-manager may break the filtering that filter-apply had set up.
> 
> This patch changes filter-apply so that it saves the filter device
> name to the stream proplist when it sets up a filter. device-manager
> can then check the proplist when it does rerouting, and skip the
> rerouting for streams that have a filter applied to them.
> 
> The proplist isn't cleaned up when the stream moves away from the
> filter device, so before doing any decisions based on the
> filter_device property, it should be checked that the stream is
> currently routed to the filter device. It seemed simpler to do it this
> way compared to setting up stream move monitoring in filter-apply and
> removing the property when the stream moves away from the filter
> device.
> ---
>  src/modules/module-device-manager.c | 14 ++++++++++
>  src/modules/module-filter-apply.c   | 53 +++++++++++++++++++++++++++++++++++--
>  2 files changed, 65 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
> index 1a0a53e..76363f3 100644
> --- a/src/modules/module-device-manager.c
> +++ b/src/modules/module-device-manager.c
> @@ -649,6 +649,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
>  }
>  
>  static void route_sink_input(struct userdata *u, pa_sink_input *si) {
> +    const char *filter_device;
>      const char *role;
>      uint32_t role_index, device_index;
>      pa_sink *sink;
> @@ -663,6 +664,12 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) {
>      if (!si->sink)
>          return;
>  
> +    /* If module-filter-apply has loaded a filter for the stream, let's not
> +     * break the filtering. */
> +    filter_device = pa_proplist_gets(si->proplist, "module-filter-apply.filter_device");
> +    if (filter_device && pa_streq(filter_device, si->sink->name))
> +        return;

There should be a comment explaining the pa_streq() check.

-- 
Tanu


More information about the pulseaudio-discuss mailing list