[pulseaudio-discuss] [PATCH] sink/source: Don't update default sink/source before calling PA_CORE_HOOK_{SINK, SOURCE}_PUT

Tanu Kaskinen tanuk at iki.fi
Thu May 11 10:05:17 UTC 2017


On Wed, 2017-05-10 at 12:05 +0200, Georg Chini wrote:
> In sink_put() and source_put(), pa_core_update_default_{sink,source}() was called
> before the PA_CORE_HOOK_{SINK,SOURCE}_PUT hook. Therefore module-switch-on-connect
> could not correctly determine the old default sink/source if no user default was
> set and a sink/source with higher priority than any other sink/source turned up.
> 
> This patch corrects the problem by swapping the order of the hook call and the
> pa_core_update_default_sink() call.
> 
> Additionally it corrects a problem in module-switch-on-connect. If, after the
> change above, the new sink/source was the first sink/source to appear, pulseaudio
> would crash because module-switch-on-connect assumed that the default sink/source
> was not NULL. The patch checks if the default sink/source is NULL and only sets
> the new default sink/source in that case.
> ---
>  src/modules/module-switch-on-connect.c | 12 ++++++++++++
>  src/pulsecore/sink.c                   |  6 ++++--
>  src/pulsecore/source.c                 |  6 ++++--
>  3 files changed, 20 insertions(+), 4 deletions(-)

Looks good to me.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list