summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-27 21:50:59 +0100
committerwm4 <wm4@nowhere>2015-11-27 21:50:59 +0100
commit9afd62bfcd4ddf2a8339b3ac3c95d607be610ce4 (patch)
tree549f270e53ff4e55974fa4595e9ef86818a7b0b2 /video
parenteec844a06e13f582fdfd3b73cbd37899991d9029 (diff)
downloadmpv-9afd62bfcd4ddf2a8339b3ac3c95d607be610ce4.tar.bz2
mpv-9afd62bfcd4ddf2a8339b3ac3c95d607be610ce4.tar.xz
vo: fix audio-timing framedrop regressions
Commit 12eb8b2d accidentally disabled framedropping in the audio timing case. It tried to replace the last_flip field with the prev_vsync one, which didn't work because prev_sync is reset to 0 if the timing code is used. Fix it by always setting it properly. This field must (or should) be reinitialized to something sensible when switching to display sync timing mode; since prev_vsync is not reset anymore, the check when to reinitialize this field has to be adjusted as well. It's a bit weird that update_vsync_timing_after_swap() now does some minor work for timing mode too, but I guess it's ok, if only to avoid additional fields and timer calls.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 808f543f1f..c117e5fccf 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -325,7 +325,6 @@ static void reset_vsync_timings(struct vo *vo)
struct vo_internal *in = vo->in;
in->num_vsync_samples = 0;
in->drop_point = 0;
- in->prev_vsync = 0;
in->estimated_vsync_interval = 0;
in->estimated_vsync_jitter = -1;
in->base_vsync = 0;
@@ -348,12 +347,14 @@ static void update_vsync_timing_after_swap(struct vo *vo)
{
struct vo_internal *in = vo->in;
- if (!in->expecting_vsync || !in->prev_vsync) {
+ int64_t now = mp_time_us();
+
+ if (!in->expecting_vsync) {
+ in->prev_vsync = now; // for normal system-time framedrop
reset_vsync_timings(vo);
return;
}
- int64_t now = mp_time_us();
int max_samples = 200;
if (in->num_vsync_samples >= max_samples)
in->num_vsync_samples -= 1;
@@ -764,7 +765,7 @@ static bool render_frame(struct vo *vo)
in->current_frame->num_vsyncs -= 1;
in->expecting_vsync = in->current_frame->display_synced && !in->paused;
- if (in->expecting_vsync && !in->prev_vsync)
+ if (in->expecting_vsync && !in->num_vsync_samples) // first DS frame in a row
in->prev_vsync = mp_time_us();
if (in->dropped_frame) {