From 6589c5424ec16849c9665e8ea365d9e5ce0a88cb Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 3 May 2014 15:37:00 +0200 Subject: [PATCH] video: remove a corner case by introducing another one When loading a video, and a script reacts to MPV_EVENT_VIDEO_RECONFIG, and the script inserts a video filter, the first frame can be skipped. This happens simply because the first frame is (usually) still queued in the video filter chain, and changing the filter chain will drop all queued frames. So this is just a corner case that just happens in a weird situation. But it's still annoying when having such a script, and starting something where the first frame is very visible, and not starting in paused mode. (All in all, a corner case.) Do this by immediately queuing 1 filtered frame to the VO immediately after reconfig, instead of leaving it to the video loop doing it as "incremental" work. Simply fallthrough to the next case. We must not overwrite "r" in this case, because that contains the current status. Note that the first frame will not be filtered using the inserted filter. --- player/video.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/player/video.c b/player/video.c index 1bb06ad0cc..d2c605bbe9 100644 --- a/player/video.c +++ b/player/video.c @@ -463,13 +463,12 @@ static int video_output_image(struct MPContext *mpctx, bool reconfig_ok) info->name, p.w, p.h, p.d_w, p.d_h, vo_format_name(p.imgfmt)); MP_VERBOSE(mpctx, "VO: Description: %s\n", info->description); - r = vo_reconfig(vo, &p, 0); - if (r < 0) { + int vo_r = vo_reconfig(vo, &p, 0); + if (vo_r < 0) { vf->initialized = -1; return -1; } init_vo(mpctx); - return 1; } // Queue new frame, if there's one.