[vlc-devel] [PATCH] video_output: handle draining of interactive filters before using prerendered pics

Steve Lhomme robux4 at ycbcr.xyz
Thu Oct 15 13:37:09 CEST 2020


Interactive/User filters are allowed to output more than one frame at a time.
(it could also be deinterlacers or fps filters added manually)

This introduces some timing differences in the processing time we use to adjust
the estimated display time. The drain may be faster or slower than the regular
filtering call.

Filter (chains) that only output one picture at the time won't be affected.

Before this patch, extra pictures from interactive filters were simply dropped
and never displayed.
---
 src/video_output/video_output.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 0233e214d9e..f3efd2f82c2 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1223,14 +1223,22 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool is_forced)
 {
     vout_thread_sys_t *sys = vout;
 
-    picture_t *torender = picture_Hold(sys->displayed.current);
-
     vout_chrono_Start(&sys->render);
 
     vlc_mutex_lock(&sys->filter.lock);
-    picture_t *filtered = filter_chain_VideoFilter(sys->filter.chain_interactive, torender);
+    picture_t *filtered = filter_chain_VideoFilter(sys->filter.chain_interactive, NULL);
     vlc_mutex_unlock(&sys->filter.lock);
 
+    if (filtered == NULL)
+    {
+        // hold it as the filter chain will release it or return it and we release it
+        picture_t *torender = picture_Hold(sys->displayed.current);
+
+        vlc_mutex_lock(&sys->filter.lock);
+        filtered = filter_chain_VideoFilter(sys->filter.chain_interactive, torender);
+        vlc_mutex_unlock(&sys->filter.lock);
+    }
+
     if (!filtered)
         return VLC_EGENERIC;
 
-- 
2.26.2



More information about the vlc-devel mailing list