changeset 32860:77dd2bb3fd02

Make sure we don't store the same stats twice by nulling the first byte of the stats_out string once we have written it. I've verified that this is necessary, without it at normally at least the last stats line is duplicated, it could also happen when we call encode_video more often due to encoder delay as Reimar noted. Sample encode was with default -ovc lavc -lavcopts vpass=1: --- pass1stats.log 2011-02-21 15:44:42.314259000 +0100 +++ pass1stats.log.dedup_patch 2011-02-21 15:41:51.262778000 +0100 @@ -6421,4 +6421,3 @@ in:6420 out:6420 type:2 q:239 itex:0 ptex:15905 mv:441 misc:1911 fcode:1 bcode:1 mc-var:989 var:350603 icount:0 skipcount:373 hbits:55; in:6421 out:6421 type:2 q:247 itex:0 ptex:13020 mv:422 misc:1863 fcode:1 bcode:1 mc-var:953 var:352607 icount:0 skipcount:379 hbits:55; in:6422 out:6422 type:2 q:252 itex:0 ptex:3162 mv:258 misc:1293 fcode:1 bcode:1 mc-var:837 var:352872 icount:0 skipcount:449 hbits:55; -in:6422 out:6422 type:2 q:252 itex:0 ptex:3162 mv:258 misc:1293 fcode:1 bcode:1 mc-var:837 var:352872 icount:0 skipcount:449 hbits:55;
author ranma
date Mon, 21 Feb 2011 14:52:25 +0000
parents 93610fbf278c
children 100f9895b11a
files libmpcodecs/ve_lavc.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ve_lavc.c	Mon Feb 21 11:03:33 2011 +0000
+++ b/libmpcodecs/ve_lavc.c	Mon Feb 21 14:52:25 2011 +0000
@@ -813,8 +813,11 @@
 	    pic);
 
     /* store stats if there are any */
-    if(lavc_venc_context->stats_out && stats_file)
+    if(lavc_venc_context->stats_out && stats_file) {
         fprintf(stats_file, "%s", lavc_venc_context->stats_out);
+        /* make sure we can't accidentally store the same stats twice */
+        lavc_venc_context->stats_out[0] = 0;
+    }
 
     if(pts != MP_NOPTS_VALUE)
         dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base);