[vlc-devel] [RFC PATCH] display: fix useless display filter creation

Thomas Guillem thomas at gllm.fr
Wed Oct 7 19:04:33 CEST 2015


When decoding a 1280x720 video with avcodec, the i_width/i_height will be
aligned (1280x738). Therefore the comparison in VoutDisplayCreateRender will
always fail and a filter will be created for nothing (swscale in my case).

It's easy to reproduce with any 720p videos when forcing sw rendering and
xcb_xv video output.

My first idea to fix this issue is to compare the visible size and not the
buffer size.

Though, I don't know if it's the right fix.

---
 src/video_output/display.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index e9f27fd..7e177e1 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -421,6 +421,12 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
     video_format_t v_src = vd->source;
     v_src.i_sar_num = 0;
     v_src.i_sar_den = 0;
+    /* compare with visible size if available */
+    if (v_src.i_visible_width && v_src.i_visible_height)
+    {
+        v_src.i_width = v_src.i_visible_width;
+        v_src.i_height = v_src.i_visible_height;
+    }
 
     video_format_t v_dst = vd->fmt;
     v_dst.i_sar_num = 0;
-- 
2.1.4



More information about the vlc-devel mailing list