[pulseaudio-discuss] [PATCH] echo-cancel: Avoid segfaults due to invalid master sink or source

Tanu Kaskinen tanuk at iki.fi
Sun May 7 11:23:21 UTC 2017


On Sun, 2017-05-07 at 12:37 +0200, Georg Chini wrote:
> On 07.05.2017 11:16, Tanu Kaskinen wrote:
> > On Sat, 2017-05-06 at 22:15 +0200, Georg Chini wrote:
> > > On 06.05.2017 22:06, Tanu Kaskinen wrote:
> > > > I made a strange interpretation, because what you really meant seemed
> > > > even more crazy. I forgot that module-switch-on-connect only moves
> > > > streams if they are routed to the default sink, and because of that
> > > > missing piece your explanation made no sense to me at all. I understand
> > > > the logic now.
> > > > 
> > > > Implementing your proposal doesn't seem that simple: what if the user
> > > > has set a filter sink as the default sink? Would you change the default
> > > >    sink just for the duration of the filter sink move?
> > > > 
> > > 
> > > I already implemented it and it is quite simple (using part of your
> > > patch).
> > > 
> > > The default sink will be set to the new sink by switch-on-connect
> > > anyway (even the configured default sink), so the previous user
> > > choice is irrelevant. I think however, that the simple logic of
> > > switch-on-connect should at least be changed so that in the case
> > > that the previous default sink was a filter then the streams should
> > > not be moved away from it (unless the new sink also is a filter).
> > > But this would be a matter of a different patch.
> > > 
> > > BTW did you see my other remark about switch-on-connect? It is
> > > somewhat hidden in another topic.
> > 
> > I forgot to reply to the last part... No, I don't think I saw that
> > other remark. What was that remark?
> > 
> 
> I just copy&paste what I wrote in my previous mail:
> 
> Another similar point, while reading the code of 
> module-switch-on-connect, i
> found a possible issue:
> When a new sink turns up, pa_core_update_default_sink() is called from
> sink_put(). After that, PA_CORE_HOOK_SINK_PUT is fired. Within the hook
> in module switch-on-connect, it is checked, if the new sink is the default
> sink. If yes, the hook does nothing. Doesn't that mean that if the new
> sink has highest priority (and no user default is set), the streams will
> not be moved away from the old default sink, because the old default
> is lost when pa_core_update_default_sink() is called before the hook?

Yes, that seems to be a real problem. I think we can just move the
update_default_sink() call happen after the hook, and add a comment
about why the order is important.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list