[vlc-commits] [Git][videolan/vlc][master] 5 commits: video_output: pass a single system vlc_tick to IsPictureLate
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Jul 16 10:59:03 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e19b48f3 by Steve Lhomme at 2024-07-16T10:14:15+00:00
video_output: pass a single system vlc_tick to IsPictureLate
No functional changes.
- - - - -
c5daf86b by Steve Lhomme at 2024-07-16T10:14:15+00:00
video_output: pass a video format to get the frame rate
The frame rate is not a rationale number, so pass the whole video format.
- - - - -
8e6006e9 by Steve Lhomme at 2024-07-16T10:14:15+00:00
video_output: use an intermediate function to check if a picture is late
...to do static filtering and rendering.
- - - - -
5e93f2cd by Steve Lhomme at 2024-07-16T10:14:15+00:00
video_output: rename IsPictureLate to IsPictureLateToProcess
And also parameter names.
No functional changes.
- - - - -
838393e6 by Steve Lhomme at 2024-07-16T10:14:15+00:00
video_output: add helper to get the time allowed to do rendering+display
- - - - -
1 changed file:
- src/video_output/video_output.c
Changes:
=====================================
src/video_output/video_output.c
=====================================
@@ -936,18 +936,17 @@ static void ChangeFilters(vout_thread_sys_t *vout)
sys->filter.changed = false;
}
-static bool IsPictureLate(vout_thread_sys_t *vout, picture_t *decoded,
- vlc_tick_t system_now, vlc_tick_t system_pts)
+static bool IsPictureLateToProcess(vout_thread_sys_t *vout, const video_format_t *fmt,
+ vlc_tick_t time_until_display,
+ vlc_tick_t process_duration)
{
vout_thread_sys_t *sys = vout;
- const vlc_tick_t prepare_decoded_duration = vout_chrono_GetHigh(&sys->chrono.render) +
- vout_chrono_GetHigh(&sys->chrono.static_filter);
- vlc_tick_t late = system_now + prepare_decoded_duration - system_pts;
+ vlc_tick_t late = process_duration - time_until_display;
vlc_tick_t late_threshold;
- if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base) {
- late_threshold = vlc_tick_from_samples(decoded->format.i_frame_rate_base, decoded->format.i_frame_rate);
+ if (fmt->i_frame_rate && fmt->i_frame_rate_base) {
+ late_threshold = vlc_tick_from_samples(fmt->i_frame_rate_base, fmt->i_frame_rate);
}
else
late_threshold = VOUT_DISPLAY_LATE_THRESHOLD;
@@ -962,6 +961,21 @@ static bool IsPictureLate(vout_thread_sys_t *vout, picture_t *decoded,
return false;
}
+static inline vlc_tick_t GetRenderDelay(vout_thread_sys_t *sys)
+{
+ return vout_chrono_GetHigh(&sys->chrono.render) + VOUT_MWAIT_TOLERANCE;
+}
+
+static bool IsPictureLateToStaticFilter(vout_thread_sys_t *vout, const video_format_t *fmt,
+ vlc_tick_t time_until_display)
+{
+ vout_thread_sys_t *sys = vout;
+ const vlc_tick_t prepare_decoded_duration =
+ vout_chrono_GetHigh(&sys->chrono.render) +
+ vout_chrono_GetHigh(&sys->chrono.static_filter);
+ return IsPictureLateToProcess(vout, fmt, time_until_display, prepare_decoded_duration);
+}
+
/* */
VLC_USED
static picture_t *PreparePicture(vout_thread_sys_t *vout, bool reuse_decoded,
@@ -1005,7 +1019,7 @@ static picture_t *PreparePicture(vout_thread_sys_t *vout, bool reuse_decoded,
}
if (is_late_dropped && !decoded->b_force
- && IsPictureLate(vout, decoded, system_now, system_pts))
+ && IsPictureLateToStaticFilter(vout, &decoded->format, system_pts - system_now))
{
picture_Release(decoded);
vout_statistic_AddLost(&sys->statistic, 1);
@@ -1495,8 +1509,7 @@ static bool UpdateCurrentPicture(vout_thread_sys_t *sys)
sys->displayed.current->date, sys->rate, NULL);
vlc_clock_Unlock(sys->clock);
- const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->chrono.render) + VOUT_MWAIT_TOLERANCE;
- vlc_tick_t system_prepare_current = system_swap_current - render_delay;
+ vlc_tick_t system_prepare_current = system_swap_current - GetRenderDelay(sys);
if (unlikely(system_prepare_current > system_now))
// the current frame is not late, we still have time to display it
// no need to get a new picture
@@ -1547,9 +1560,8 @@ static vlc_tick_t DisplayPicture(vout_thread_sys_t *vout)
}
else if (likely(sys->displayed.date != VLC_TICK_INVALID))
{
- const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->chrono.render) + VOUT_MWAIT_TOLERANCE;
// next date we need to display again the current picture
- vlc_tick_t date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY - render_delay;
+ vlc_tick_t date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY - GetRenderDelay(sys);
const vlc_tick_t system_now = vlc_tick_now();
/* FIXME/XXX we must redisplay the last decoded picture (because
* of potential vout updated, or filters update or SPU update)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fb777c8410d8041400152a794e0124159895f741...838393e66c7c03987f8927766b99359f12ef8a75
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fb777c8410d8041400152a794e0124159895f741...838393e66c7c03987f8927766b99359f12ef8a75
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list