[PATCH] virtual sources and sinks: Don't double attach a sink input or source output on filter load

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2017-05-16 at 15:14 +0200, Georg Chini wrote:
> When a filter is loaded and module-switch-on-connect is present, switch-on-connect
> will make the filter the default sink or source and move streams from the old
> default to the filter. This is done from the sink/source put hook, therefore streams
> are moved to the filter before the module init function of the filter calls
> sink_input_put() or source_output_put(). The move succeeds because the asyncmsq
> already points to the queue of the master sink or source. When the master sink or
> source is attached to the sink input or source output, the attach callback will call
> pa_{sink,source}_attach_within_thread(). These functions assume that all streams
> are detached. Because streams were already moved to the filter by switch-on-connect,
> this assumption leads to an assertion in pa_{sink_input,source_output}_attach().
> 
> This patch fixes the problem by reverting the order of the pa_{sink,source}_put()
> calls and the pa_{sink_input,source_output}_put calls and creating the sink input
> or source output corked. The initial rewind that is done for the master sink is
> moved to the sink message handler. The order of the unlink calls is swapped as well
> to prevent that the filter appears to be moving during module unload.
> 
> The patch also seems to improve user experience, the move of a stream to the filter
> sink is now done without any audible interruption on my system.
> 
> The patch is only tested for module-echo-cancel.
> 
> Bug-Link: https://bugs.freedesktop.org/show_bug.cgi?id=100065
> ---
>  src/modules/echo-cancel/module-echo-cancel.c | 92 ++++++++++++++++++++--------
>  src/modules/module-equalizer-sink.c          | 64 +++++++++++--------
>  src/modules/module-ladspa-sink.c             | 64 +++++++++++--------
>  src/modules/module-remap-sink.c              | 65 ++++++++++++--------
>  src/modules/module-remap-source.c            | 36 +++++++----
>  src/modules/module-virtual-sink.c            | 64 +++++++++++--------
>  src/modules/module-virtual-source.c          | 35 ++++++++---
>  src/modules/module-virtual-surround-sink.c   | 64 +++++++++++--------
>  8 files changed, 306 insertions(+), 178 deletions(-)

Looks good to me.

-- 
Tanu

https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux