[pulseaudio-discuss] [PATCH] null-sink: update timestamp when state changes from SUSPENDED to IDLE

Georg Chini georg at chini.tk
Sat Oct 24 02:51:34 PDT 2015


On 24.10.2015 11:16, Tanu Kaskinen wrote:
> On Fri, 2015-10-23 at 12:08 +0200, Georg Chini wrote:
>> When the null sink changes state from suspended to idle (for example
>> when attaching a loopback module to the monitor source), u->timestamp
>> must also be updated.
>> Thanks to Olivier Delbeke for reporting the bug and teting the patch.
>>
>> ---
>>   src/modules/module-null-sink.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
>> index 0270ba2..e6d261a 100644
>> --- a/src/modules/module-null-sink.c
>> +++ b/src/modules/module-null-sink.c
>> @@ -95,6 +95,8 @@ static int sink_process_msg(
>>   
>>               if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING)
>>                   u->timestamp = pa_rtclock_now();
>> +            if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED && PA_PTR_TO_UINT(data) == PA_SINK_IDLE)
>> +                u->timestamp = pa_rtclock_now();
>>   
>>               break;
> I guess the goal is that the timestamp should be reset to "now" when
> the sink transitions from INIT or SUSPENDED to IDLE or RUNNING, and not
> at any other time. Now the timestamp is reset also in the IDLE ->
> RUNNING transition, and INIT -> IDLE isn't handled. I guess this should
> be changed?
>
> -- 
> Tanu
INIT -> something should not be a problem because the timestamp
is set to "now" when the thread starts up.
The IDLE -> RUNNING case is handled like it was before the patch,
but I was also thinking that this is not completely correct. I can
change it if you prefer.
Bug report is here: 
http://lists.freedesktop.org/archives/pulseaudio-discuss/2015-October/024553.html



More information about the pulseaudio-discuss mailing list