google/ExoPlayer · error · GlException
eglChooseConfig failed.
Error message
eglChooseConfig failed.
What it means
Thrown by GlUtil.getEglConfig when EGL14.eglChooseConfig returns false — the EGL implementation itself rejected the attribute list rather than returning zero matching configs (which would surface differently as a null config). The attribute lists in play are GlUtil's presets (EGL_CONFIG_ATTRIBUTES_RGBA_8888, EGL_CONFIG_ATTRIBUTES_RGBA_1010102, or recording-surface variants), so a false return almost always means the device's EGL does not understand one of the attributes, typically the 10-bit/color-space ones on the RGBA_1010102 path.
Source
Thrown at library/common/src/main/java/com/google/android/exoplayer2/util/GlUtil.java:837
}
EGL14.eglDestroySurface(eglDisplay, eglSurface);
checkEglException("Error destroying surface");
}
@DoNotInline
private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] attributes)
throws GlException {
EGLConfig[] eglConfigs = new EGLConfig[1];
if (!EGL14.eglChooseConfig(
eglDisplay,
attributes,
/* attrib_listOffset= */ 0,
eglConfigs,
/* configsOffset= */ 0,
/* config_size= */ 1,
/* unusedNumConfig */ new int[1],
/* num_configOffset= */ 0)) {
throw new GlException("eglChooseConfig failed.");
}
return eglConfigs[0];
}
}
}
View on GitHub (pinned to dd430f7053)
Solutions
- Fall back to EGL_CONFIG_ATTRIBUTES_RGBA_8888 (8-bit SDR) when 10-bit config selection fails, and tone-map the content instead
- Enumerate configs defensively first: call eglChooseConfig yourself with the desired attributes, and if it fails or yields none, downgrade the attribute list before invoking GlUtil APIs that require a config
- Check EGL extension strings (eglQueryString(display, EGL_EXTENSIONS)) for the 10-bit/color-space extensions before choosing the 1010102 path
- Report/upgrade: vendor EGL false-return bugs are worked around in newer media3 patches — update the dependency
Example fix
// before
EGLContext ctx = GlUtil.createEglContext(null, eglDisplay, 3,
GlUtil.EGL_CONFIG_ATTRIBUTES_RGBA_1010102); // eglChooseConfig failed
// after
int[] attrs = has10bitEglSupport(eglDisplay)
? GlUtil.EGL_CONFIG_ATTRIBUTES_RGBA_1010102
: GlUtil.EGL_CONFIG_ATTRIBUTES_RGBA_8888;
EGLContext ctx = GlUtil.createEglContext(null, eglDisplay, 3, attrs); Defensive patterns
Strategy: fallback
Validate before calling
String exts = EGL14.eglQueryString(eglDisplay, EGL10.EGL_EXTENSIONS);
boolean has10bit = exts != null && exts.contains("EGL_EXT_pixel_format_float"); Try / catch
try { ... 1010102 config path ... } catch (GlException e) { /* retry with EGL_CONFIG_ATTRIBUTES_RGBA_8888 and tone-map */ } Prevention
- Query EGL extension strings before choosing 10-bit configs
- Maintain a per-device capability cache keyed by Build.MODEL to skip known-bad GPUs
- Update media3 regularly — device-specific EGL workarounds land frequently
When it happens
Trigger: Running createEglContext/createEglSurface with EGL_CONFIG_ATTRIBUTES_RGBA_1010102 (EGL_COLOR_COMPONENT_TYPE_EXT / 1010102 pixel formats) on devices lacking EXT_color_space / 10-bit EGL config support; using an EGL version-14 API on a display not initialized with eglGetDisplay; or a driver bug where certain attribute combos return false instead of empty.
Common situations: HDR (PQ/HLG) effects or 10-bit Transformer export on mid/low-tier devices whose EGL enumerates no 10-bit configs; emulator or VM renderers with partial EGL extensions; OEM EGL bugs on specific Android versions returning false for unsupported attrib lists.
Related errors
- Unsupported color transfer: {colorTransfer}
- eglCreateContext() failed to create a valid context. The dev
- No call to setSamplerTexId() before bind.
- Unexpected uniform type: {type}
- glError: {gluErrorString(error)}
AI-assisted analysis of google/ExoPlayer@dd430f7053 (2026-08-14).
Data as JSON: /api/errors/1739661d2d384950.
Report an issue: GitHub.