[vlc-devel] commit: Fixed segfault when doing rendering without respecting ffmpeg requirements . (Laurent Aimar )

git version control git at videolan.org
Fri Aug 29 12:19:25 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Aug 29 12:10:43 2008 +0200| [07c44496532d7e2cb58c58443b26b59c0f3c654c] | committer: Laurent Aimar 

Fixed segfault when doing rendering without respecting ffmpeg requirements.

It fixes at least SVQ1 segfaults.

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

 modules/codec/avcodec/video.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index fe544ee..1ec058f 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -852,9 +852,16 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
     }
 
     /* Some codecs set pix_fmt only after the 1st frame has been decoded,
-     * so this check is necessary. */
+     * so we need to check for direct rendering again. */
+
+    int i_width = p_sys->p_context->width;
+    int i_height = p_sys->p_context->height;
+    avcodec_align_dimensions( p_sys->p_context, &i_width, &i_height );
+
     if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS ||
-        p_sys->p_context->width % 16 || p_sys->p_context->height % 16 )
+        p_sys->p_context->width % 16 || p_sys->p_context->height % 16 ||
+        /* We only pad picture up to 16 */
+        PAD(p_sys->p_context->width,16) < i_width || PAD(p_sys->p_context->height,16) < i_height )
     {
         msg_Dbg( p_dec, "disabling direct rendering" );
         p_sys->b_direct_rendering = 0;




More information about the vlc-devel mailing list