[vlc-devel] [PATCH 10/17] video_output: update displayed.current directly in ThreadDisplayPreparePicture()
Steve Lhomme
robux4 at ycbcr.xyz
Fri Nov 20 15:45:00 CET 2020
Now that there is no mix up possible with displayed.next we can centralize the
setting of this value.
Rename ThreadDisplayPreparePicture() to ThreadDisplayPrerenderNext().
---
src/video_output/video_output.c | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index e74aae0b928..8b0821ac9ce 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1052,8 +1052,7 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout)
/* */
-VLC_USED
-static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reuse_decoded,
+static bool ThreadDisplayPrerenderNext(vout_thread_sys_t *vout, bool reuse_decoded,
bool frame_by_frame, bool *paused)
{
vout_thread_sys_t *sys = vout;
@@ -1141,7 +1140,13 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus
vlc_mutex_unlock(&sys->filter.lock);
- return picture;
+ if (picture == NULL)
+ return false;
+
+ if (sys->displayed.current != NULL)
+ picture_Release(sys->displayed.current);
+ sys->displayed.current = picture;
+ return true;
}
static vlc_decoder_device * VoutHoldDecoderDevice(vlc_object_t *o, void *opaque)
@@ -1474,24 +1479,16 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
bool render_now;
if (frame_by_frame)
{
- picture_t *next;
- next = ThreadDisplayPreparePicture(vout, first, true, &paused);
- if (next == NULL)
+ if (!ThreadDisplayPrerenderNext(vout, first, true, &paused))
return VLC_EGENERIC;
- if (likely(sys->displayed.current != NULL))
- picture_Release(sys->displayed.current);
- sys->displayed.current = next;
-
render_now = true;
}
else
{
if (first)
{
- sys->displayed.current =
- ThreadDisplayPreparePicture(vout, first, false, &paused);
- if (!sys->displayed.current)
+ if (!ThreadDisplayPrerenderNext(vout, first, false, &paused))
return VLC_EGENERIC; // wait with no known deadline
}
@@ -1528,18 +1525,12 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
if (pic_render_deadline <= system_now)
{
// not enough (predicted) time to render current, get non-late pic
- picture_t *next;
- next = ThreadDisplayPreparePicture(vout, false, false, &paused);
- if (likely(next != NULL))
+ if (ThreadDisplayPrerenderNext(vout, false, false, &paused))
{
// next frame will still need some waiting before display
dropped_current_frame = true;
render_now = false;
- if (likely(sys->displayed.current != NULL))
- picture_Release(sys->displayed.current);
- sys->displayed.current = next;
-
pic_system_pts =
vlc_clock_ConvertToSystem(sys->clock, vlc_tick_now(),
sys->displayed.current->date, sys->rate);
--
2.26.2
More information about the vlc-devel
mailing list