[pulseaudio-discuss] [PATCH 1/8] devices: Set certain sink/source flags automatically.

Colin Guthrie gmane at colin.guthr.ie
Wed Jul 13 07:37:32 PDT 2011


'Twas brillig, and Tanu Kaskinen at 13/07/11 14:29 did gyre and gimble:
>>>> diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
>>>> index 45761a6..15c07a5 100644
>>>> --- a/src/pulsecore/sink.c
>>>> +++ b/src/pulsecore/sink.c
>>>> @@ -462,8 +462,19 @@ void pa_sink_put(pa_sink* s) {
>>>>      pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
>>>>  
>>>>      /* Generally, flags should be initialized via pa_sink_new(). As a
>>>> -     * special exception we allow volume related flags to be set
>>>> -     * between _new() and _put(). */
>>>> +     * special exception we allow some volume related flags to be set
>>>> +     * between _new() and _put(). However some are dictated by what
>>>> +     * callbacks were registered so we set those here.
>>>> +     *
>>>> +     * Note: All of these flags set here can change over the life time
>>>> +     * of the sink. */
>>>> +    s->flags &= ~(PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL|PA_SINK_SYNC_VOLUME|PA_SINK_FLAT_VOLUME);
>>>
>>> This breaks the "force flat volume" feature of module-virtual-sink.
>>> Would it do any harm to leave PA_SINK_FLAT_VOLUME out of this list?
>>
>> So it does. I'll work something out (probably leaving it out and
>> duplicating the flat volume flag setting to the alsa-sink/source code,
>> but if I can find something that reduces duplication then all the better).
> 
> Another thing came to my mind: what about having assertions for checking
> that none of PA_SINK_HW_VOLUME_CTRL, PA_SINK_HW_MUTE_CTRL or
> PA_SINK_SYNC_VOLUME are set? If the sink implementations can't control
> the flags anyway, wouldn't it make sense to prevent them from trying?

Not really sure where you suggest such a check goes.

Do you mean e.g. before the initial call to
pa_sink_set_flags_from_callbacks() inside pa_sink_put()?

I guess that makes sense as it ensures implementations are not setting
things expecting it to do something that is overwritten later.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the pulseaudio-discuss mailing list