[vlc-devel] [PATCH 05/13] decoder: ensure we don't use invalid decoder sizes for the chroma in use

Steve Lhomme robux4 at ycbcr.xyz
Tue Feb 19 10:38:18 CET 2019


---
 src/input/decoder.c         | 12 ------------
 src/input/decoder_helpers.c | 12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 16e88702b7..f87e418551 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -456,18 +456,6 @@ static int vout_update_format( decoder_t *p_dec )
 
         video_format_t fmt = p_dec->fmt_out.video;
 
-        if( vlc_fourcc_IsYUV( fmt.i_chroma ) )
-        {
-            const vlc_chroma_description_t *dsc = vlc_fourcc_GetChromaDescription( fmt.i_chroma );
-            for( unsigned int i = 0; dsc && i < dsc->plane_count; i++ )
-            {
-                while( fmt.i_width % dsc->p[i].w.den )
-                    fmt.i_width++;
-                while( fmt.i_height % dsc->p[i].h.den )
-                    fmt.i_height++;
-            }
-        }
-
         if( !fmt.i_visible_width || !fmt.i_visible_height )
         {
             if( p_dec->fmt_in.video.i_visible_width &&
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index b738525b1e..36043753ca 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -96,6 +96,18 @@ int decoder_UpdateVideoFormat( decoder_t *dec )
 
     dec->fmt_out.video.i_chroma = fmt_out.i_chroma = dec->fmt_out.i_codec;
 
+    if( vlc_fourcc_IsYUV( fmt_out.i_chroma ) )
+    {
+        const vlc_chroma_description_t *dsc = vlc_fourcc_GetChromaDescription( fmt_out.i_chroma );
+        for( unsigned int i = 0; dsc && i < dsc->plane_count; i++ )
+        {
+            while( fmt_out.i_width % dsc->p[i].w.den )
+                fmt_out.i_width++;
+            while( fmt_out.i_height % dsc->p[i].h.den )
+                fmt_out.i_height++;
+        }
+    }
+
     video_format_t original = dec->fmt_out.video;
     dec->fmt_out.video = fmt_out;
     int err = dec->cbs->video.format_update( dec );
-- 
2.17.1



More information about the vlc-devel mailing list