[vlc-devel] [PATCH 2/5] video_output: defactorize the first displayed.current filling
Steve Lhomme
robux4 at ycbcr.xyz
Thu Jan 21 12:13:12 UTC 2021
And move some code around.
No functional changes.
---
src/video_output/video_output.c | 46 ++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f7943264527..a2d25194504 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1481,18 +1481,18 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
if (deadline)
*deadline = VLC_TICK_INVALID;
- if (!sys->displayed.current)
- {
- assert(!sys->displayed.next);
- sys->displayed.current =
- ThreadDisplayPreparePicture(vout, true, frame_by_frame, &paused);
- if (!sys->displayed.current)
- return VLC_EGENERIC; // wait with no known deadline
- }
-
bool render_now;
if (frame_by_frame)
{
+ if (!sys->displayed.current)
+ {
+ assert(!sys->displayed.next);
+ sys->displayed.current =
+ ThreadDisplayPreparePicture(vout, true, true, &paused);
+ if (!sys->displayed.current)
+ return VLC_EGENERIC; // wait with no known deadline
+ }
+
if (!sys->displayed.next)
{
sys->displayed.next =
@@ -1511,15 +1511,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
}
else
{
- if (!paused)
- {
- if (!sys->displayed.next)
- {
- sys->displayed.next =
- ThreadDisplayPreparePicture(vout, false, false, &paused);
- }
- }
-
const vlc_tick_t system_now = vlc_tick_now();
const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->render) + VOUT_MWAIT_TOLERANCE;
@@ -1537,6 +1528,25 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
bool refresh = false;
vlc_tick_t date_refresh = VLC_TICK_INVALID;
+
+ if (!sys->displayed.current)
+ {
+ assert(!sys->displayed.next);
+ sys->displayed.current =
+ ThreadDisplayPreparePicture(vout, true, false, &paused);
+ if (!sys->displayed.current)
+ return VLC_EGENERIC; // wait with no known deadline
+ }
+
+ if (!paused)
+ {
+ if (!sys->displayed.next)
+ {
+ sys->displayed.next =
+ ThreadDisplayPreparePicture(vout, false, false, &paused);
+ }
+ }
+
if (sys->displayed.date != VLC_TICK_INVALID) {
date_refresh = sys->displayed.date + VOUT_REDISPLAY_DELAY - render_delay;
refresh = date_refresh <= system_now;
--
2.29.2
More information about the vlc-devel
mailing list