summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-02-18 09:08:23 +0100
committerAnton Khirnov <anton@khirnov.net>2012-02-19 08:22:48 +0100
commit5455384219d873d0d2ddaeb7098da659f4207058 (patch)
tree688a7094a477acd196a613db0c2f5f176e13d505 /libavcodec/mpegvideo_enc.c
parent5be805d38cb43e6f0b85941f75946d09bc8cc13f (diff)
mpegvideo_enc: force encoding delay of at least 1 frame when low_delay=0
This allows the following commit to extrapolate better dts for the first frame. Pts difference between the first two frames is reused as the difference between pts and dts of the first frame.
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 10323fc8c0..d8a7c70637 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -890,7 +890,8 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
AVFrame *pic = NULL;
int64_t pts;
int i;
- const int encoding_delay = s->max_b_frames;
+ const int encoding_delay = s->max_b_frames ? s->max_b_frames :
+ (s->low_delay ? 0 : 1);
int direct = 1;
if (pic_arg) {