path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2014-07-22 21:08:42 +0200
committerwm4 <wm4@nowhere>2014-07-22 21:08:42 +0200
commit104185052362fc196e4dd676b72f092ff63c6ba2 (patch)
treec9f441fbd52af0043023fdd5c0e9ca6ecb6bceac /player/video.c
parent8f8d5241122c0085dcd317c072b683eec0e7b353 (diff)
video: fix corner case with accidental EOF
The video flushing logic was broken: if there are no more packets, decode_image() will feed flush packets to the decoder. Even if an image was produced, it will return the demuxer EOF state, and since commit 7083f88c, this EOF state is returned to the caller, which is incorrect. Revert this part of the change, and explicitly check for VD_WAIT (the bogus change was intended to forward this error code to the caller). Also, turn the "r < 1" into something equivalent that doesn't rely on the exact value of VD_EOF. "r < 0" is ok, because at least here, errors are always negative.
Diffstat (limited to 'player/video.c')
1 files changed, 5 insertions, 5 deletions
diff --git a/player/video.c b/player/video.c
index eef7153fd8..81f45ec3d8 100644
--- a/player/video.c
+++ b/player/video.c
@@ -389,19 +389,19 @@ static int video_decode_and_filter(struct MPContext *mpctx)
- int r = VD_PROGRESS;
if (!d_video->waiting_decoded_mpi) {
// Decode a new image, or at least feed the decoder a packet.
- r = decode_image(mpctx);
+ int r = decode_image(mpctx);
+ if (r == VD_WAIT)
+ return r;
if (d_video->waiting_decoded_mpi)
d_video->decoder_output = d_video->waiting_decoded_mpi->params;
- if (!d_video->waiting_decoded_mpi && r < 1)
+ if (!d_video->waiting_decoded_mpi && (r == VD_EOF || r < 0))
return VD_EOF; // true EOF
// Image will be filtered on the next iteration.
- return r;
+ return VD_PROGRESS;
static void init_vo(struct MPContext *mpctx)