summaryrefslogtreecommitdiffstats
path: root/video/decode/dec_video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-02 14:38:47 +0100
committerwm4 <wm4@nowhere>2015-12-02 14:38:47 +0100
commit344d44681efaf180e7bd2e523f2add547b451bec (patch)
tree8754baeaa6b2865bc7be1c5e00b207db7c191aac /video/decode/dec_video.c
parent03d311823d2f96d057c7c6afc5dd888185c5ab3c (diff)
downloadmpv-344d44681efaf180e7bd2e523f2add547b451bec.tar.bz2
mpv-344d44681efaf180e7bd2e523f2add547b451bec.tar.xz
video: readd codec delay estimation
Approximately reverts commit 3ccac74d. This failed with some avi files, which do pseudo-VFR by sending packets with empty frames (or repeat frames, depending on point of view). Specifically, these packets are not 0 bytes, so they don't get skipped by libavformat, as with the usual VFR avi hack. Instead, the packet contains a VOP with vop_coded=0, so libavcodec will just return no frame. We could probably distinguish such skipped frames and delayed frames by explicitly measuring the codec delay by counting how long it takes to get the very first frame (and then treat skips as explicit drops), but we may as well simply reinstate the old code. To appease to at least one semi-broken case, do not enable this logic on the RPI, as the FFmpeg MMAL wrapper has arbitrary buffering (and MMAL itself is asynchronous).
Diffstat (limited to 'video/decode/dec_video.c')
-rw-r--r--video/decode/dec_video.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index af55c66811..509daf7cd8 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -211,6 +211,10 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
static void add_avi_pts(struct dec_video *d_video, double pts)
{
if (pts != MP_NOPTS_VALUE) {
+ int delay = -1;
+ video_vd_control(d_video, VDCTRL_QUERY_UNSEEN_FRAMES, &delay);
+ if (delay >= 0 && delay < d_video->num_buffered_pts)
+ d_video->num_buffered_pts = delay;
if (d_video->num_buffered_pts == MP_ARRAY_SIZE(d_video->buffered_pts)) {
MP_ERR(d_video, "Too many buffered pts\n");
} else {