summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-11 00:08:32 +0200
committerwm4 <wm4@nowhere>2014-04-17 22:58:48 +0200
commit0e2fe55fded99bff4f9ec7a01318b864dc1737f6 (patch)
tree113c77f91b14b74836ad59c8558a5c21815c172b
parent22cfb48b5292e563f5586048598c5d25a629326e (diff)
downloadmpv-0e2fe55fded99bff4f9ec7a01318b864dc1737f6.tar.bz2
mpv-0e2fe55fded99bff4f9ec7a01318b864dc1737f6.tar.xz
encode: write 2-pass stats only per-packet
The stats were retrieved and written on every encode call, instead of every encode call that actually returned a packet. ffmpeg.c also does it this way, so it must be "more correct". Fixes 2-pass encoding.
-rw-r--r--video/out/vo_lavc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c
index c0b317da94..fcd1d4b487 100644
--- a/video/out/vo_lavc.c
+++ b/video/out/vo_lavc.c
@@ -267,7 +267,8 @@ static int encode_video(struct vo *vo, AVFrame *frame, AVPacket *packet)
frame->pts * (double) vc->stream->codec->time_base.num /
(double) vc->stream->codec->time_base.den, size);
- encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
+ if (got_packet)
+ encode_lavc_write_stats(vo->encode_lavc_ctx, vc->stream);
return size;
}
}