[vlc-devel] [PATCH 6/7] vout/control: keep waiting until new commands / woken up / deadline

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 14 11:33:47 CEST 2020


On 2020-08-14 11:04, Thomas Guillem wrote:
> vout_control_Pop() was already called from a loop.

It doesn't have the same purpose.

> A spirious wakeup caused the picture to be rendered again. This is not the case anymore.

Indeed, the vout_control_Wake() sets the can_sleep to false, forcing the 
exit of the loop.

I don't have a preference between the while and the if.

> You should document it and explain why is it needed.
> 
> On Thu, Aug 13, 2020, at 14:12, Steve Lhomme wrote:
>> ---
>>   src/video_output/control.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/video_output/control.c b/src/video_output/control.c
>> index 93bf7c3f92a..a4f92771eda 100644
>> --- a/src/video_output/control.c
>> +++ b/src/video_output/control.c
>> @@ -134,10 +134,10 @@ int vout_control_Pop(vout_control_t *ctrl,
>> vout_control_cmd_t *cmd,
>>   {
>>       vlc_mutex_lock(&ctrl->lock);
>>   
>> -    if (ctrl->cmd.i_size <= 0) {
>> -        /* Spurious wakeups are perfectly fine */
>> -        if (deadline != INVALID_DEADLINE && ctrl->can_sleep) {
>> -            vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, deadline);
>> +    if (deadline != INVALID_DEADLINE) {
>> +        while (ctrl->cmd.i_size <= 0 && ctrl->can_sleep) {
>> +            if (vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, deadline))
>> +                break;
>>           }
>>       }
>>   
>> -- 
>> 2.26.2
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list