summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-10 14:35:13 +0100
committerwm4 <wm4@nowhere>2015-11-10 14:35:13 +0100
commit479eb93d9eca84e696f08844ed92b369ab0e9c23 (patch)
treeb85dd31490f5dd4f15ef88c5a566a4cd413d926b /video
parent9d9f863f55ecca1f4926d5334bd7fe33ebac81df (diff)
downloadmpv-479eb93d9eca84e696f08844ed92b369ab0e9c23.tar.bz2
mpv-479eb93d9eca84e696f08844ed92b369ab0e9c23.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_opengl_cb.c18
1 files changed, 12 insertions, 6 deletions
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);
}