summaryrefslogtreecommitdiffstats
path: root/player/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-01-11 11:02:23 +0100
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commit7498fa0b3d50d9a8b0f63568b5c5dd88795b596d (patch)
treea934cee6ab4e0d07683dd8a5e3a54cdb80d39f2a /player/video.c
parent2bf1862bc1d53b7aa60a229c4a8ae0d00df4b5c8 (diff)
downloadmpv-7498fa0b3d50d9a8b0f63568b5c5dd88795b596d.tar.bz2
mpv-7498fa0b3d50d9a8b0f63568b5c5dd88795b596d.tar.xz
video: fix player not exiting if no video frame was rendered
E.g. "mpv null:// --demuxer=rawvideo" will "hang" by waiting for video EOF forever. It's not signalled correctly because of the last-frame corner case, which attempts to wait until the current frame is finally displayed (which is signalled by whether a new frame can be queued, see commit 1a339fa09d for some details). If no frame was ever queued, the VO is not configured, and vo_is_ready_for_frame() never returns true. Fix this by using vo_has_frame(), which seems to be exactly the correct thing we need.
Diffstat (limited to 'player/video.c')
-rw-r--r--player/video.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/video.c b/player/video.c
index ab8490542d..4d8d5d0260 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1030,12 +1030,13 @@ void write_video(struct MPContext *mpctx)
// Wait for the VO to signal actual EOF, then exit if the frame timer
// has expired.
+ bool has_frame = vo_has_frame(vo); // maybe not configured
if (mpctx->video_status == STATUS_DRAINING &&
- vo_is_ready_for_frame(vo, -1))
+ (vo_is_ready_for_frame(vo, -1) || !has_frame))
{
mpctx->time_frame -= get_relative_time(mpctx);
mp_set_timeout(mpctx, mpctx->time_frame);
- if (mpctx->time_frame <= 0) {
+ if (mpctx->time_frame <= 0 || !has_frame) {
MP_VERBOSE(mpctx, "video EOF reached\n");
mpctx->video_status = STATUS_EOF;
encode_lavc_stream_eof(mpctx->encode_lavc_ctx, STREAM_VIDEO);