aboutsummaryrefslogtreecommitdiffhomepage
path: root/video
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-07-07 13:59:33 +0200
committerGravatar wm4 <wm4@nowhere>2015-07-07 13:59:33 +0200
commitdc33eb56f4ae28b75ddc4127bd9e766606096c25 (patch)
treeba491ecd25737116ba61b2a51ce7454bf3460e16 /video
parent459124f66f7df6dc109c8399ee3d78424c288321 (diff)
vo_opengl_cb: drop frames eagerly if frames are not rendered
libmpv users might stop calling the frame render callback for stupid reasons, at which point video frames would pile up.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_opengl_cb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c
index 7cd44c2c29..217e15d76a 100644
--- a/video/out/vo_opengl_cb.c
+++ b/video/out/vo_opengl_cb.c
@@ -82,6 +82,7 @@ struct mpv_opengl_cb_context {
struct mp_csp_equalizer eq;
int64_t recent_flip;
int64_t approx_vsync;
+ bool frozen; // libmpv user is not redrawing frames
// --- All of these can only be accessed from the thread where the host
// application's OpenGL context is current - i.e. only while the
@@ -309,6 +310,7 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h)
struct vo *vo = ctx->active;
ctx->force_update |= ctx->reconfigured;
+ ctx->frozen = false;
if (ctx->vp_w != vp_w || ctx->vp_h != vp_h)
ctx->force_update = true;
@@ -432,8 +434,12 @@ static void flip_page(struct vo *vo)
break;
case FRAME_DROP_BLOCK: ;
struct timespec ts = mp_rel_time_to_timespec(0.2);
- if (pthread_cond_timedwait(&p->ctx->wakeup, &p->ctx->lock, &ts))
+ if (p->ctx->frozen ||
+ pthread_cond_timedwait(&p->ctx->wakeup, &p->ctx->lock, &ts))
+ {
frame_queue_drop_all(p->ctx);
+ p->ctx->frozen = true;
+ }
break;
}
}