[MPlayer-cvslog] r33347 - trunk/libmpcodecs/vd_ffmpeg.c

iive subversion at mplayerhq.hu
Sun May 1 22:21:00 CEST 2011


Author: iive
Date: Sun May  1 22:21:00 2011
New Revision: 33347

Log:
Fix segfault with -lavdopts vstats and some codecs.
The vstats option relies on avctx->coded_frame been filled.
Unfortunately not all codecs do that (e.g. VP8) thus causing
NULL dereference.
FFmpeg code seem to always check if coded_frame != NULL,
so we should do the same.

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Sun May  1 20:07:59 2011	(r33346)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun May  1 22:21:00 2011	(r33347)
@@ -469,7 +469,7 @@ static void uninit(sh_video_t *sh){
     vd_ffmpeg_ctx *ctx = sh->context;
     AVCodecContext *avctx = ctx->avctx;
 
-    if(lavc_param_vstats){
+    if(lavc_param_vstats && avctx->coded_frame){
         int i;
         for(i=1; i<32; i++){
             mp_msg(MSGT_DECVIDEO, MSGL_INFO, "QP: %d, count: %d\n", i, ctx->qp_stat[i]);
@@ -866,6 +866,8 @@ static mp_image_t *decode(sh_video_t *sh
         AVFrame *pic= avctx->coded_frame;
         double quality=0.0;
 
+        if(!pic) break;
+
         if(!fvstats) {
             time_t today2;
             struct tm *today;


More information about the MPlayer-cvslog mailing list