[pulseaudio-discuss] [PATCH] Fix deferred volume not being applied if sink is closed

David Henningsson david.henningsson at canonical.com
Thu Oct 13 23:16:12 PDT 2011


On 10/13/2011 06:34 PM, Maarten Bosmans wrote:
> 2011/10/13 David Henningsson<david.henningsson at canonical.com>:
>> Signed-off-by: David Henningsson<david.henningsson at canonical.com>
>> ---
>>   src/modules/alsa/alsa-sink.c   |    8 ++++++--
>>   src/modules/alsa/alsa-source.c |    8 ++++++--
>>   2 files changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
>> index c868453..3a95251 100644
>> --- a/src/modules/alsa/alsa-sink.c
>> +++ b/src/modules/alsa/alsa-sink.c
>> @@ -1751,8 +1751,12 @@ static void thread_func(void *userdata) {
>>          if (u->sink->flags&  PA_SINK_DEFERRED_VOLUME) {
>>              pa_usec_t volume_sleep;
>>              pa_sink_volume_change_apply(u->sink,&volume_sleep);
>> -            if (volume_sleep>  0)
>> -                rtpoll_sleep = PA_MIN(volume_sleep, rtpoll_sleep);
>> +            if (volume_sleep>  0) {
>> +                if (rtpoll_sleep>  0)
>> +                    rtpoll_sleep = PA_MIN(volume_sleep, rtpoll_sleep);
>> +                else
>> +                    rtpoll_sleep = volume_sleep;
>> +            }
>
> Why not simply:
>    if (volume_sleep>  0) {
>      if (rtpoll_sleep<= 0 || rtpoll_sleep>  volume_sleep)
>        rtpoll_sleep = volume_sleep;
>    }
>
> Or even:
>    if (0<  volume_sleep&&  (rtpoll_sleep<  0 || volume_sleep<  rtpoll_sleep))
>      rtpoll_sleep = volume_sleep;

I guess this is a matter of personal preference. I don't mind either 
version. (Except possibly, I personally prefer "volume_sleep > 0" over 
"0 < volume_sleep".)

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list