[vlc-devel] [PATCH 11/17] video_output: only apply the render delay if we know the next render deadline

Steve Lhomme robux4 at ycbcr.xyz
Tue Sep 15 06:27:34 CEST 2020


On 2020-09-14 17:37, Rémi Denis-Courmont wrote:
> Le maanantaina 14. syyskuuta 2020, 17.03.22 EEST Steve Lhomme a écrit :
>> If deadline is VLC_TICK_INVALID we should not do any math on it.
>>
>> Do the math outside of ThreadDisplayPicture, it's not needed/used in frame
>> by frame mode
>> ---
>>   src/video_output/video_output.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/video_output/video_output.c
>> b/src/video_output/video_output.c index dc5e602002e..758df6e017d 100644
>> --- a/src/video_output/video_output.c
>> +++ b/src/video_output/video_output.c
>> @@ -1498,7 +1498,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t
>> *vout, vlc_tick_t *deadline) ;
>>
>>       const vlc_tick_t system_now = vlc_tick_now();
>> -    const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->render) +
>> VOUT_MWAIT_TOLERANCE;
>>
>>       bool drop_next_frame = frame_by_frame;
>>       vlc_tick_t date_next = VLC_TICK_INVALID;
>> @@ -1514,7 +1513,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t
>> *vout, vlc_tick_t *deadline) paused = true;
>>           }
>>           {
>> -            date_next = next_system_pts - render_delay;
>> +            date_next = next_system_pts;
>>               if (date_next <= system_now)
>>                   drop_next_frame = true;
>>           }
>> @@ -1533,7 +1532,7 @@ static int ThreadDisplayPicture(vout_thread_sys_t
>> *vout, vlc_tick_t *deadline)
>>
>>       vlc_tick_t date_refresh = VLC_TICK_INVALID;
>>       if (sys->displayed.date != VLC_TICK_INVALID) {
>> -        date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY -
>> render_delay;
>> +        date_refresh = sys->displayed.date +
>> VOUT_REDISPLAY_DELAY;
>> refresh = date_refresh <= system_now;
> 
> Uh, the refresh predicate looks now very different. If it's intended, it should
> be accounted for in the description (and maybe a separate patch anyway).

Indeed, good catch !

Reviewing the patchset I already submitted before, I found many 
loopholes I didn't see before. That's why I split some of the changes 
into smaller patches, so it's more readable and errors are easier to spot.

>>       }
>>       bool force_refresh = !drop_next_frame && refresh;
>> @@ -1903,6 +1902,8 @@ static void *Thread(void *object)
>>           }
>>
>>           wait = ThreadDisplayPicture(vout, &deadline) != VLC_SUCCESS;
>> +        if (deadline != VLC_TICK_INVALID)
>> +            deadline -= vout_chrono_GetHigh(&sys->render) +
>> VOUT_MWAIT_TOLERANCE;
>>
>>           const bool picture_interlaced = sys->displayed.is_interlaced;
> 
> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> 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