Browse code

Only allocate stats_out when needed in ffv1

Originally committed as revision 25579 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2010/10/27 08:01:00
Showing 1 changed files
... ...
@@ -945,6 +945,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
945 945
         return -1;
946 946
 
947 947
 #define STATS_OUT_SIZE 1024*30
948
+    if(avctx->flags & CODEC_FLAG_PASS1)
948 949
     avctx->stats_out= av_mallocz(STATS_OUT_SIZE);
949 950
 
950 951
     return 0;
... ...
@@ -1099,7 +1100,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
1099 1099
             p+= strlen(p);
1100 1100
         }
1101 1101
         snprintf(p, end-p, "\n");
1102
-    } else
1102
+    } else if(avctx->flags&CODEC_FLAG_PASS1)
1103 1103
         avctx->stats_out[0] = '\0';
1104 1104
 
1105 1105
     f->picture_number++;