[vlc-devel] [PATCH 11/17] video_output: handle the filter change in ThreadDisplayPrerenderNext()

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 20 15:45:01 CET 2020


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 and
also displayed.current which is the prerendered picture we had so far.

In push mode we want to redo the filter chain(s) and the display module which
might take some time and will change displayed.current.
---
 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 8b0821ac9ce..5ff0a7d1bef 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, we keep 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.26.2



More information about the vlc-devel mailing list