[vlc-devel] [PATCH 1/7] video_output: keep the filter lock outside of ThreadDisplayPreparePicture
Steve Lhomme
robux4 at ycbcr.xyz
Tue Oct 20 11:04:32 CEST 2020
And rename ThreadDisplayPreparePicture to ThreadGetPrerenderedLocked as it's
returning a (pre-rendered) picture and doesn't display or prepare anything.
---
src/video_output/video_output.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 57ee54e6e8b..bc2ba23ce09 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1061,14 +1061,12 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout)
/* */
VLC_USED
-static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reuse_decoded,
+static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse_decoded,
bool frame_by_frame, bool *paused)
{
vout_thread_sys_t *sys = vout;
bool is_late_dropped = sys->is_late_dropped && !frame_by_frame;
- vlc_mutex_lock(&sys->filter.lock);
-
picture_t *picture = filter_chain_VideoFilter(sys->filter.chain_static, NULL);
assert(!reuse_decoded || !picture);
@@ -1143,8 +1141,6 @@ static picture_t *ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reus
picture = filter_chain_VideoFilter(sys->filter.chain_static, sys->displayed.decoded);
}
- vlc_mutex_unlock(&sys->filter.lock);
-
return picture;
}
@@ -1470,7 +1466,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
sys->private.interlacing.has_deint = sys->filter.new_interlaced;
ThreadChangeFilters(vout);
}
- vlc_mutex_unlock(&sys->filter.lock);
if (deadline)
*deadline = VLC_TICK_INVALID;
@@ -1479,9 +1474,12 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
{
assert(!sys->displayed.next);
sys->displayed.current =
- ThreadDisplayPreparePicture(vout, true, frame_by_frame, &paused);
+ ThreadGetPrerenderedLocked(vout, true, frame_by_frame, &paused);
if (!sys->displayed.current)
+ {
+ vlc_mutex_unlock(&sys->filter.lock);
return VLC_EGENERIC; // wait with no known deadline
+ }
}
bool render_now;
@@ -1490,8 +1488,9 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
if (!sys->displayed.next)
{
sys->displayed.next =
- ThreadDisplayPreparePicture(vout, false, true, &paused);
+ ThreadGetPrerenderedLocked(vout, false, true, &paused);
}
+ vlc_mutex_unlock(&sys->filter.lock);
picture_Release(sys->displayed.current);
sys->displayed.current = sys->displayed.next;
@@ -1506,9 +1505,10 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
if (!sys->displayed.next)
{
sys->displayed.next =
- ThreadDisplayPreparePicture(vout, false, false, &paused);
+ ThreadGetPrerenderedLocked(vout, false, false, &paused);
}
}
+ vlc_mutex_unlock(&sys->filter.lock);
const vlc_tick_t system_now = vlc_tick_now();
const vlc_tick_t render_delay = vout_chrono_GetHigh(&sys->render) + VOUT_MWAIT_TOLERANCE;
--
2.26.2
More information about the vlc-devel
mailing list