1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 09:32:40 +00:00

video: avoid unnecessary frame dropping

If duration<0, it means the duration is unknown. Disable framedropping,
because end_time makes no sense in this case.

Also, strictly never drop the first frame.

This fixes weird behavior with the cover-art case (for the 100th time).
This commit is contained in:
wm4 2014-08-23 12:43:09 +02:00
parent 39b42814e0
commit 1cedb323ad

View File

@ -128,6 +128,7 @@ struct vo_internal {
bool hasframe;
bool hasframe_rendered;
bool request_redraw;
bool paused;
@ -384,6 +385,7 @@ static void forget_frames(struct vo *vo)
{
struct vo_internal *in = vo->in;
in->hasframe = false;
in->hasframe_rendered = false;
in->drop_count = 0;
mp_image_unrefp(&in->frame_queued);
mp_image_unrefp(&in->dropped_image);
@ -560,7 +562,8 @@ static bool render_frame(struct vo *vo)
int64_t next_vsync = prev_sync(vo, mp_time_us()) + in->vsync_interval;
int64_t end_time = pts + duration;
in->dropped_frame = end_time < next_vsync;
in->dropped_frame = duration >= 0 && end_time < next_vsync;
in->dropped_frame &= in->hasframe_rendered;
in->dropped_frame &= !!(vo->global->opts->frame_dropping & 1);
in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP) &&
!vo->driver->untimed && !vo->driver->encode;
@ -572,6 +575,7 @@ static bool render_frame(struct vo *vo)
in->drop_count += 1;
in->dropped_image = img;
} else {
in->hasframe_rendered = true;
pthread_mutex_unlock(&in->lock);
MP_STATS(vo, "start video");