[vlc-devel] [PATCH 12/13] decoder: check the decoding sizes early

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


And for all decoder owners.
---
 src/input/decoder.c         | 9 ---------
 src/input/decoder_helpers.c | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9772660097..c4350fa785 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -445,15 +445,6 @@ static int vout_update_format( decoder_t *p_dec )
     {
         vout_thread_t *p_vout;
 
-        if( !p_dec->fmt_out.video.i_width ||
-            !p_dec->fmt_out.video.i_height ||
-            p_dec->fmt_out.video.i_width < p_dec->fmt_out.video.i_visible_width ||
-            p_dec->fmt_out.video.i_height < p_dec->fmt_out.video.i_visible_height )
-        {
-            /* Can't create a new vout without display size */
-            return -1;
-        }
-
         video_format_t fmt = p_dec->fmt_out.video;
 
         vlc_mutex_lock( &p_owner->lock );
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index b210309fd4..9e77f2d31c 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -80,6 +80,14 @@ int decoder_UpdateVideoFormat( decoder_t *dec )
                   dec->cbs->video.format_update == NULL) )
         return -1;
 
+    if( !dec->fmt_out.video.i_width || !dec->fmt_out.video.i_height ||
+        dec->fmt_out.video.i_width < dec->fmt_out.video.i_visible_width ||
+        dec->fmt_out.video.i_height < dec->fmt_out.video.i_visible_height )
+    {
+        /* Can't create a decoder without buffer sizes */
+        return -1;
+    }
+
     fmt_out = dec->fmt_out.video;
     if ( fmt_out.color_range == COLOR_RANGE_UNDEF )
         fmt_out.color_range = dec->fmt_in.video.color_range;
-- 
2.17.1



More information about the vlc-devel mailing list