summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-09 17:57:17 +0200
committerAlessandro Ghedini <alessandro@ghedini.me>2014-10-11 14:01:21 +0200
commitf66e320d7b08c78e05b8a3a523c85809ee7cc6ae (patch)
tree0d54add828a5dbdbd5aea62e058bc718531cd632
parentfa2381765e6a9acb5b7ab4402b82b58d32ed3b03 (diff)
downloadmpv-f66e320d7b08c78e05b8a3a523c85809ee7cc6ae.tar.bz2
mpv-f66e320d7b08c78e05b8a3a523c85809ee7cc6ae.tar.xz
video: try harder to decode cover art picture only once
For cover art, we pretend that the video stream is infinite, but also stop decoding once we have an image on the VO (this seems advantageous for the case when strange filters are inserted or the VO image gets lost). Since a while ago, the video chain started decoding 2 images though ("Non-monotonic video pts: 0.000000 <= 0.000000"), which is annoying and wasteful. Improve this by handling a certain corner case at initialization, which will decode a second image while the first one is still stuck in the filter chain. Also, just in case there are filters which buffer a lot, also force EOF filtering (which means we tell the filters to flush buffered frames). CC: @mpv-player/stable
-rw-r--r--player/video.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/player/video.c b/player/video.c
index 80acbf7b72..fc56bea72e 100644
--- a/player/video.c
+++ b/player/video.c
@@ -55,6 +55,7 @@ enum {
VD_PROGRESS = 1, // progress, but no output; repeat call with no waiting
VD_NEW_FRAME = 2, // the call produced a new frame
VD_WAIT = 3, // no EOF, but no output; wait until wakeup
+ VD_RECONFIG = 4,
};
static const char av_desync_help_text[] =
@@ -433,7 +434,7 @@ static int video_filter(struct MPContext *mpctx, bool eof)
if (vf->initialized < 1)
return VD_ERROR;
init_filter_params(mpctx);
- return VD_PROGRESS;
+ return VD_RECONFIG;
}
// If something was decoded, and the filter chain is ready, filter it.
@@ -468,7 +469,10 @@ static int video_decode_and_filter(struct MPContext *mpctx)
}
bool eof = !d_video->waiting_decoded_mpi && (r == VD_EOF || r < 0);
- return video_filter(mpctx, eof);
+ r = video_filter(mpctx, eof);
+ if (r == VD_RECONFIG) // retry feeding decoded image
+ r = video_filter(mpctx, eof);
+ return r;
}
/* Modify video timing to match the audio timeline. There are two main
@@ -520,6 +524,7 @@ static int video_output_image(struct MPContext *mpctx, double endpts)
if (mpctx->next_frame[0])
return VD_NEW_FRAME;
int r = video_decode_and_filter(mpctx);
+ video_filter(mpctx, true); // force EOF filtering (avoid decoding more)
mpctx->next_frame[0] = vf_read_output_frame(mpctx->d_video->vfilter);
if (mpctx->next_frame[0])
mpctx->next_frame[0]->pts = MP_NOPTS_VALUE;