[vlc-devel] [PATCH v2 04/18] video_output: set the deadline directly when the next frame date is known
Steve Lhomme
robux4 at ycbcr.xyz
Wed Sep 16 13:14:30 CEST 2020
We already know the deadline from the previous frame timeout, the deadline for
the next frame takes precedence if there is one.
date_next can never be invalid now.
We replace the test on frame_by_frame by a test on deadline not being NULL, as
it makes more sense when setting its value.
---
src/video_output/video_output.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 4eb60894431..b92bc4ded1f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1501,7 +1501,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
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;
/* FIXME/XXX we must redisplay the last decoded picture (because
* of potential vout updated, or filters update or SPU update)
@@ -1527,19 +1526,19 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
sys->displayed.next->date, sys->rate);
if (likely(next_system_pts != INT64_MAX))
{
- date_next = next_system_pts - render_delay;
+ const vlc_tick_t date_next = next_system_pts - render_delay;
if (date_next <= system_now)
drop_next_frame = true;
+
+ if (deadline != NULL) {
+ if (*deadline == VLC_TICK_INVALID || date_next < *deadline)
+ *deadline = date_next;
+ }
}
}
bool force_refresh = !drop_next_frame && refresh;
- if (!frame_by_frame) {
- if (date_next != VLC_TICK_INVALID && date_next < *deadline)
- *deadline = date_next;
- }
-
if (!first && !refresh && !drop_next_frame) {
return VLC_EGENERIC;
}
--
2.26.2
More information about the vlc-devel
mailing list