From 479eb93d9eca84e696f08844ed92b369ab0e9c23 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Nov 2015 14:35:13 +0100 Subject: vo_opengl_cb: better underflow reporting This applies to unexpected freezes or deadlocks, not e.g. normal framedrops. The verbose messages also might remind an API user if the API usage is incorrect, such as not calling mpv_opengl_cb_draw() when a redraw request was issued. --- video/out/vo_opengl_cb.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'video') diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c index 15faa36c88..a78b6a7fb7 100644 --- a/video/out/vo_opengl_cb.c +++ b/video/out/vo_opengl_cb.c @@ -363,8 +363,10 @@ static void flip_page(struct vo *vo) // Wait until frame was rendered while (p->ctx->next_frame) { - if (pthread_cond_timedwait(&p->ctx->wakeup, &p->ctx->lock, &ts)) - break; + if (pthread_cond_timedwait(&p->ctx->wakeup, &p->ctx->lock, &ts)) { + MP_VERBOSE(vo, "mpv_opengl_cb_draw() not being called or stuck.\n"); + goto done; + } } // Unblock mpv_opengl_cb_draw(). @@ -377,15 +379,19 @@ static void flip_page(struct vo *vo) // Assume the user calls it consistently _if_ it's called at all. if (!p->ctx->flip_count) break; - if (pthread_cond_timedwait(&p->ctx->wakeup, &p->ctx->lock, &ts)) - break; + if (pthread_cond_timedwait(&p->ctx->wakeup, &p->ctx->lock, &ts)) { + MP_VERBOSE(vo, "mpv_opengl_cb_report_flip() not being called.\n"); + goto done; + } } - // The API user is not reacting, or is being unusually slow => drop. +done: + + // Cleanup after the API user is not reacting, or is being unusually slow. if (p->ctx->next_frame) { talloc_free(p->ctx->next_frame); p->ctx->next_frame = NULL; - p->ctx->present_count += 1; + p->ctx->present_count += 2; pthread_cond_signal(&p->ctx->wakeup); vo_increment_drop_count(vo, 1); } -- cgit v1.2.3