mirror of
https://github.com/mpv-player/mpv
synced 2025-03-23 11:47:45 +00:00
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.
This commit is contained in:
parent
f12a8d9b8f
commit
91fe4fa020
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user