[vlc-devel] [PATCH] video_output: handle the filter change in ThreadDisplayPrerenderNext()
Steve Lhomme
robux4 at ycbcr.xyz
Tue Jan 19 12:42:55 UTC 2021
If the source format changed we must update the filters. Only decoder format
change is allowed. Filters cannot change the output format once they are
settled.
We keep the displayed.decoded with the next format to update the filters.
We used to do the filter change before calling ThreadDisplayPrerenderNext(),
so the filter.chain_static was reset and pending pictures were lost. Now
We drain it before doing the filter change so no pictures created by these
filters will be lost, even after a new source format is detected. The downside
is that dynamic/user filters are not applied to these pending pictures.
---
src/video_output/video_output.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index d848e2fae1b..7d98ff43575 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1064,6 +1064,13 @@ static bool ThreadDisplayPrerenderNext(vout_thread_sys_t *vout, bool reuse_decod
assert(!reuse_decoded || !picture);
while (!picture) {
+ if (sys->filter.changed ||
+ sys->private.interlacing.has_deint != sys->filter.new_interlaced)
+ {
+ sys->private.interlacing.has_deint = sys->filter.new_interlaced;
+ ThreadChangeFilters(vout);
+ }
+
picture_t *decoded;
if (reuse_decoded && sys->displayed.decoded) {
decoded = picture_Hold(sys->displayed.decoded);
@@ -1132,7 +1139,7 @@ static bool ThreadDisplayPrerenderNext(vout_thread_sys_t *vout, bool reuse_decod
if (sys->filter.changed)
- ThreadChangeFilters(vout);
+ continue; // filter+display update needed, keep new displayed.decoded
picture_Hold(sys->displayed.decoded);
picture = filter_chain_VideoFilter(sys->filter.chain_static, sys->displayed.decoded);
@@ -1464,15 +1471,6 @@ static int ThreadDisplayPicture(vout_thread_sys_t *vout, vlc_tick_t *deadline)
assert(sys->clock);
- vlc_mutex_lock(&sys->filter.lock);
- if (sys->filter.changed ||
- sys->private.interlacing.has_deint != sys->filter.new_interlaced)
- {
- sys->private.interlacing.has_deint = sys->filter.new_interlaced;
- ThreadChangeFilters(vout);
- }
- vlc_mutex_unlock(&sys->filter.lock);
-
if (deadline)
*deadline = VLC_TICK_INVALID;
--
2.29.2
More information about the vlc-devel
mailing list