Skip to content

Fix EGL error code reporting in GLException messages - #213

Open
NamtarR wants to merge 1 commit into
webrtc-sdk:m137_releasefrom
NamtarR:m137_release
Open

Fix EGL error code reporting in GLException messages#213
NamtarR wants to merge 1 commit into
webrtc-sdk:m137_releasefrom
NamtarR:m137_release

Conversation

@NamtarR

@NamtarR NamtarR commented Jan 13, 2026

Copy link
Copy Markdown

Problem

In all cases when GLException is thrown, eglGetError() is being called twice - once for the exception constructor and once for the error message. Since eglGetError() clears the error state after being called, the second call always returns EGL_SUCCESS instead of the actual error code. While debugging locally, it is still possible to retrieve the initial error code from the exception object, but it gets completely lost when the exception is reported to crash reporting tools like Crashlytics. This unintentional masking of the real error makes debugging such cases more difficult than it should be. There are several issues in livekit-android with the same problem as well.

Solution

Extract a throwEglException helper method that accepts the error code as a parameter. Call eglGetError() only once at each call site and pass the result to throwEglException.

@cloudwebrtc
cloudwebrtc requested a review from davidliu January 13, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant