[vlc-commits] avcodec: do not initialize output format with a nul dimension

Rémi Denis-Courmont git at videolan.org
Sun Sep 27 21:55:01 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 27 13:32:13 2015 +0300| [6f7a7ea3a789bf0fd3a667e286479eb103728844] | committer: Rémi Denis-Courmont

avcodec: do not initialize output format with a nul dimension

This should never happen, and it would not work. We need the real
dimensions to initialize the video output thread.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f7a7ea3a789bf0fd3a667e286479eb103728844
---

 modules/codec/avcodec/video.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 5e2ac0c..3537b1e 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1125,6 +1125,11 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
         p_dec->fmt_out.video.i_chroma = vlc_va_GetChroma(hwfmt, swfmt);
         if (p_dec->fmt_out.video.i_chroma == 0)
             continue; /* Unknown brand of hardware acceleration */
+        if (p_context->width == 0 || p_context->height == 0)
+        {   /* should never happen */
+            msg_Err(p_dec, "unspecified video dimensions");
+            continue;
+        }
         if (lavc_UpdateVideoFormat(p_dec, p_context, true))
             continue; /* Unsupported brand of hardware acceleration */
 
@@ -1138,10 +1143,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
         if (va == NULL)
             continue; /* Unsupported codec profile or such */
 
-        /* We try to call vlc_va_Setup when possible to detect errors when
-         * possible (later is too late) */
-        if( p_context->width > 0 && p_context->height > 0
-         && vlc_va_Setup(va, p_context, &p_dec->fmt_out.video.i_chroma))
+        if (vlc_va_Setup(va, p_context, &p_dec->fmt_out.video.i_chroma))
         {
             msg_Err( p_dec, "acceleration setup failure" );
             vlc_va_Delete(va, p_context);



More information about the vlc-commits mailing list