[vlc-commits] [Git][videolan/vlc][master] 13 commits: video_output: decide the redisplay based on current time
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Jun 11 17:24:20 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
6ee30979 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: decide the redisplay based on current time
We shouldn't use a previous time for that but the situation at the time the
decision is done.
The max_deadline can use the same value.
- - - - -
8323e1fa by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: move the next picture fetching in a function
No logical changes.
- - - - -
fa852ac4 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: handle the case of getting the first picture early
No logical changes.
- - - - -
d5799346 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: return early on pause
On pause we don't need to get the next picture, we keep showing the same one.
No logical changes.
- - - - -
35edda78 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: reindent after previous change
No functional changes.
- - - - -
5319157a by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: handle GetNewCurrentPicture case where the clock is paused early
This should probably not happen since we have sys->pause.is_on for that.
No logical changes.
- - - - -
97797a03 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: reindent after previous change
No functional changes.
- - - - -
f72c6ec0 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: invert the system_prepare_current test
No logical changes.
- - - - -
753dee25 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: simplify GetNewCurrentPicture()
- vout and sys are the same thing, sys is used more often
- return the value directly rather than using next
No logical changes.
- - - - -
f7d6f7be by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: set the displayed.current when there's a new one
No need to do in the caller. This is really the displayed.current we want to
update in this function.
If we need to tweak how we get the next picture it should be in here.
No logical changes.
- - - - -
d726deff by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: return whether the current picture has changed or not
DisplayPicture() doesn't need to get the actual picture anymore.
No logical changes.
- - - - -
387d6387 by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: move the render_delay where it's used
- - - - -
e0a4b82e by Steve Lhomme at 2022-06-11T16:57:38+00:00
video_output: do the rendering when the current frame is not late
Otherwise we will trigger a redisplay and then the current frame might be late.
- - - - -
1 changed file:
- src/video_output/video_output.c
Changes:
=====================================
src/video_output/video_output.c
=====================================
@@ -1362,46 +1362,57 @@ static int DisplayNextFrame(vout_thread_sys_t *sys)
return RenderPicture(sys, true);
}
+static bool UpdateCurrentPicture(vout_thread_sys_t *sys)
+{
+ assert(sys->clock);
+
+ if (sys->displayed.current == NULL)
+ {
+ sys->displayed.current = PreparePicture(sys, true, false);
+ return sys->displayed.current != NULL;
+ }
+
+ if (sys->pause.is_on)
+ return false;
+
+ const vlc_tick_t system_now = vlc_tick_now();
+ const vlc_tick_t system_swap_current =
+ vlc_clock_ConvertToSystem(sys->clock, system_now,
+ sys->displayed.current->date, sys->rate);
+ if (unlikely(system_swap_current == VLC_TICK_MAX))
+ // the clock is paused but the vout thread is not ?
+ return false;
+
+ 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;
+ 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
+ return true;
+
+ // the current frame will be late, look for the next not late one
+ picture_t *next = PreparePicture(sys, false, false);
+ if (next == NULL)
+ return false;
+
+ picture_Release(sys->displayed.current);
+ sys->displayed.current = next;
+
+ return true;
+}
+
static vlc_tick_t DisplayPicture(vout_thread_sys_t *vout)
{
vout_thread_sys_t *sys = vout;
- bool paused = sys->pause.is_on;
assert(sys->clock);
UpdateDeinterlaceFilter(sys);
- const vlc_tick_t system_now = vlc_tick_now();
- const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->chrono.render) + VOUT_MWAIT_TOLERANCE;
- const bool first = !sys->displayed.current;
-
- picture_t *next = NULL;
- if (first)
- {
- next = PreparePicture(vout, true, false);
- }
- else if (!paused)
- {
- const vlc_tick_t system_swap_current =
- vlc_clock_ConvertToSystem(sys->clock, system_now,
- sys->displayed.current->date, sys->rate);
- if (likely(system_swap_current != VLC_TICK_MAX))
- {
- vlc_tick_t system_prepare_current = system_swap_current - render_delay;
- if (system_prepare_current <= system_now)
- {
- // the current frame will be late, look for the next not late one
- next = PreparePicture(vout, false, false);
- }
- }
- }
- if (next != NULL)
+ bool current_changed = UpdateCurrentPicture(sys);
+ if (current_changed)
{
- if (likely(sys->displayed.current != NULL))
- picture_Release(sys->displayed.current);
- sys->displayed.current = next;
-
// next frame will still need some waiting before display, we don't need
// to render now
// display forced picture immediately
@@ -1414,8 +1425,10 @@ 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;
+ 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)
* For now a high update period is needed but it could be removed
@@ -1427,7 +1440,7 @@ static vlc_tick_t DisplayPicture(vout_thread_sys_t *vout)
*/
if (date_refresh > system_now) {
// nothing changed, wait until the next deadline or a control
- vlc_tick_t max_deadline = vlc_tick_now() + VOUT_REDISPLAY_DELAY;
+ vlc_tick_t max_deadline = system_now + VOUT_REDISPLAY_DELAY;
return __MIN(date_refresh, max_deadline);
}
RenderPicture(vout, true);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/716ff4b79ee52227010ff2f39ca61cb6316923c9...e0a4b82efbf7e6c184afc4ae7a78fcffa69649e8
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/716ff4b79ee52227010ff2f39ca61cb6316923c9...e0a4b82efbf7e6c184afc4ae7a78fcffa69649e8
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