summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_android.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/context_android.c')
-rw-r--r--video/out/opengl/context_android.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/video/out/opengl/context_android.c b/video/out/opengl/context_android.c
index dec420a120..ca41b7e8b8 100644
--- a/video/out/opengl/context_android.c
+++ b/video/out/opengl/context_android.c
@@ -136,12 +136,24 @@ fail:
static bool android_reconfig(struct ra_ctx *ctx)
{
+ struct priv *p = ctx->priv;
void *tmp = talloc_new(NULL);
struct android_opts *opts = mp_get_config_group(tmp, ctx->global, &android_conf);
+ int w = opts->w, h = opts->h;
+
+ if (!w)
+ eglQuerySurface(p->egl_display, p->egl_surface, EGL_WIDTH, &w);
+ if (!h)
+ eglQuerySurface(p->egl_display, p->egl_surface, EGL_HEIGHT, &h);
+
+ if (!w || !h) {
+ MP_FATAL(ctx, "Failed to get height and width!\n");
+ return false;
+ }
- ctx->vo->dwidth = opts->w;
- ctx->vo->dheight = opts->h;
- ra_gl_ctx_resize(ctx->swapchain, opts->w, opts->h, 0);
+ ctx->vo->dwidth = w;
+ ctx->vo->dheight = h;
+ ra_gl_ctx_resize(ctx->swapchain, w, h, 0);
talloc_free(tmp);
return true;