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

Tanu Kaskinen tanuk at iki.fi
Wed Jan 9 15:50:31 UTC 2019


On Mon, 2019-01-07 at 22:20 +0100, Georg Chini wrote:
> On 07.01.19 18:07, Tanu Kaskinen wrote:
> > On Wed, 2019-01-02 at 08:25 -0500, Joe wrote:
> > > On 1/2/19 7:55 AM, Hui Wang wrote:
> > > > On 2019/1/1 上午2:10, Tanu Kaskinen wrote:
> > > > > 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.
> > > > > 
> > > > Understand what you mean here, will have a try to provide a new
> > > > function name and address the rest comments of this patch.
> > > > 
> > > > Thanks.
> > > Don't know the code at all, but from a purely English standpoint, how about
> > > 
> > > "pa_sink_move_streams_to_newly_available_preferred_sink()"
> > > 
> > > if it's not too impossibly long for a name.
> > I'd be fine with that. It has the issue that the newly available sink
> > may not actually be preferred by any stream, so it's slightly
> > misleading, but it's nevertheless one of the better alternatives, if
> > not the best so far.
> > 
> How about pa_sink_move_stream_to_new_sink_if_preferred()?

That sounds very good to me (just replace "stream" with "streams").

-- 
Tanu

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



More information about the pulseaudio-discuss mailing list