summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-04-30 01:42:59 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-04-30 03:54:34 +0300
commitce35ed0209a01e43f67f16abcd898cf69df078f2 (patch)
tree0159c2da5c5d860e6dbc2c8bd075ef6f4f1f6cc0
parent017fafac4423fe2d868da7622f5d8d968a1b9fe7 (diff)
downloadmpv-ce35ed0209a01e43f67f16abcd898cf69df078f2.tar.bz2
mpv-ce35ed0209a01e43f67f16abcd898cf69df078f2.tar.xz
vd_ffmpeg.c: Use FFmpeg-mt compatible code for codec delay
This code to calculate codec delay should work with both with regular FFmpeg and FFmeg-mt. This MPlayer version is not completely compatible with current FFmpeg-mt though, since it has a build system change which matches upstream FFmpeg but hasn't been integrated in FFmpeg-mt yet (RUNTIME_CPUDETECT -> CONFIG_RUNTIME_CPUDETECT rename).
-rw-r--r--libmpcodecs/vd_ffmpeg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 708254304d..3ae46f56be 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -126,8 +126,14 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...){
case VDCTRL_RESYNC_STREAM:
avcodec_flush_buffers(avctx);
return CONTROL_TRUE;
- case VDCTRL_QUERY_UNSEEN_FRAMES:
- return avctx->has_b_frames + 10;
+ case VDCTRL_QUERY_UNSEEN_FRAMES:;
+ int delay = avctx->has_b_frames;
+#ifdef FF_THREAD_FRAME
+ // FFmpeg-mt has extra delay when using frame threading
+ if (avctx->thread_type & FF_THREAD_FRAME)
+ delay += avctx->thread_count - 1;
+#endif
+ return delay + 10;
}
return CONTROL_UNKNOWN;
}