[vlc-commits] video_output: defactorize the first displayed.current filling
Steve Lhomme
git at videolan.org
Fri Jan 29 14:54:25 UTC 2021
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jan 21 10:24:23 2021 +0100| [e73099ccca6c453595f1038f42e089c9ad4d09fb] | committer: Steve Lhomme
video_output: defactorize the first displayed.current filling
And move some code around.
No functional changes.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e73099ccca6c453595f1038f42e089c9ad4d09fb
---
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 f794326452..a2d2519450 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;
More information about the vlc-commits
mailing list