[pulseaudio-discuss] [PATCH 1/2] udev-detect, alsa-card: Adopt avoid resampling option from daemon.conf

Tanu Kaskinen tanuk at iki.fi
Tue May 22 15:13:41 UTC 2018


On Tue, 2018-05-22 at 23:55 +0900, Sangchul Lee wrote:
> 2018-05-17 0:54 GMT+09:00 Tanu Kaskinen <tanuk at iki.fi>:
> > Also, the commit message says that the intention is to use the module
> > argument with external devices, but I don't understand how you're
> > really planning to use the option. The option for module-udev-detect
> > isn't very useful, because it will apply to all detected sound cards,
> > so it's basically the same as the option in daemon.conf. If you're not
> > using module-udev-detect, how do you load module-alsa-card instances?
> > You could have a static module-alsa-card in default.pa for the internal
> > sound card, but how do you load module-alsa-card for USB sound cards
> > without using module-udev-detect?
> 
> My intention is to set the avoid-resampling option to module-udev-detect or
> module-alsa-card without setting it true of daemon.conf for applying it only to
> external devices. With the patch 2/2, it can even be set only to
> particular alsa-mapping.

That didn't help me understand much... Are you going to use the module-
udev-detect argument or the module-alsa-card argument or the mapping
option? Or all of them? How do you plan to make the option apply only
to external cards and not to the internal card?

> A precondition of these patches is that avoid-resampling option of daemon.conf
> is false. Because if it(daemon.conf's) is set to true, all other
> options(udev-detect,alsa-card,
> alsa-mapping) will get ignored. This was my intention.
> 
> > >      s->inputs = pa_idxset_new(NULL, NULL);
> > >      s->n_corked = 0;
> > >      s->input_to_master = NULL;
> > > @@ -1444,7 +1446,7 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
> > >      pa_sink_input *i;
> > >      bool default_rate_is_usable = false;
> > >      bool alternate_rate_is_usable = false;
> > > -    bool avoid_resampling = s->core->avoid_resampling;
> > > +    bool avoid_resampling = s->core->avoid_resampling || s->avoid_resampling;
> > 
> > Oh, this is how you planned to solve the "daemon.conf gets ignored"
> > problem. I think it's better to treat the daemon.conf option as a
> > default and override it with more fine-grained options, rather than
> > merging all options together. Your approach makes it impossible to
> > enable avoid-resampling by default and disabling it on per-card basis
> > (which is what I thought you wanted to do in the first place).
> 
> Yes, as your comments, it is impossible to "enable avoid-resampling by default
> and disabling it on per-card basis". rather it is possible to "disable
> avoid-resampling
> by default and enabling on per-card basis". I think there is a different view.
> I'm willing to revise it as per your comment. But actually it is
> difficult to think the
> options to be treated all together in daemon.conf. Could you let me know some
> more advices on this?

pa_alsa_sink_new() should set pa_sink_new_data.avoid_resampling to the
value of pa_core.avoid_resampling by default. If the avoid_resampling
module argument is in the module arguments, then pa_alsa_sink_new()
should set pa_sink_new_data.avoid_resampling to the module argument
value.

When module-udev-detect loads module-alsa-card, it should set the
avoid_resampling module argument to the value of
pa_core.avoid_resampling by default. If the avoid_resampling module
argument is passed to module-udev-detect, then module-udev-detect
should pass that on to module-alsa-card.

-- 
Tanu

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


More information about the pulseaudio-discuss mailing list