[pulseaudio-discuss] [PATCH 3/4] move streams to new appeared sinks if they prefer these sinks

Tanu Kaskinen tanuk at iki.fi
Mon Dec 31 18:10:47 UTC 2018


On Mon, 2018-12-31 at 20:01 +0200, Tanu Kaskinen wrote:
> On Mon, 2018-11-05 at 09:47 +0800, Hui Wang wrote:
> > diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
> > index 63a3456e7..a2a390beb 100644
> > --- a/src/pulsecore/sink.c
> > +++ b/src/pulsecore/sink.c
> > @@ -722,6 +722,8 @@ void pa_sink_put(pa_sink* s) {
> >      /* This function must be called after the PA_CORE_HOOK_SINK_PUT hook,
> >       * because module-switch-on-connect needs to know the old default sink */
> >      pa_core_update_default_sink(s->core, false);
> > +
> > +    pa_sink_bind_preferred_stream_to_a_sink(s);
> >  }
> >  
> >  /* Called from main context */
> > @@ -3919,3 +3921,32 @@ void pa_sink_move_streams_from_oldsink_to_newsink(pa_sink *old_sink, pa_sink *ne
> >  
> >      return;
> >  }
> > +
> > +void pa_sink_bind_preferred_stream_to_a_sink(pa_sink *s) {
> 
> "Bind" is new terminology, and I'd like to avoid introducing new
> terminology if possible. Also, "preferred stream" as a term doesn't
> really make sense. So some better name for the function would be
> desirable, but I can't immediately think of any obvious names... The
> function is about moving streams to a sink that just became available.
> "Move" and "streams" should be included in the name... Maybe
> "pa_sink_move_streams_to_newly_available_sink()"? I also suggest moving
> it away from the pa_sink namespace, because the function operates on
> streams, not on a sink.

That last sentence can be objected to - the function takes the sink as
an argument, so it can be said to operate on the sink. But then the
verb should be something that the sink does, like "take" ("move" is
something that streams do). So pa_sink_take_streams()? Or
pa_sink_take_streams_that_prefer_it()? I don't know. My weak preference
at this point is pa_core_move_streams_to_newly_available_sink(). It's
quite descriptive, but unfortunately lacks the distinction that only
those streams that prefer the newly available sink are moved.

-- 
Tanu

https://www.patreon.com/tanuk
https://liberapay.com/tanuk



More information about the pulseaudio-discuss mailing list