changeset 33260:e180057420a5

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.
author iive
date Sun, 01 May 2011 20:21:00 +0000
parents 04dc3e55cd90
children fc608eb62185
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Sun May 01 18:07:59 2011 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Sun May 01 20:21:00 2011 +0000
@@ -469,7 +469,7 @@
     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 @@
         AVFrame *pic= avctx->coded_frame;
         double quality=0.0;
 
+        if(!pic) break;
+
         if(!fvstats) {
             time_t today2;
             struct tm *today;