Android: One weird trick for avoiding graphics deadlocks

eglDestroyContext has been observed to deadlock with other GL threads
unless the GL program is detached beforehand.

TBR=sakal
NO_TRY=TRUE

Bug: b/120481228
Change-Id: Ie256e745828997b6fee0d62e681f5ef953aa0fe7
Reviewed-on: https://webrtc-review.googlesource.com/c/114164
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25999}
This commit is contained in:
Magnus Jedvert
2018-12-12 17:35:28 +01:00
committed by Commit Bot
parent 2aa037990f
commit 94c0f2645e

View File

@ -274,6 +274,8 @@ public class EglRenderer implements VideoSink {
renderThreadHandler.removeCallbacks(logStatisticsRunnable);
// Release EGL and GL resources on render thread.
renderThreadHandler.postAtFrontOfQueue(() -> {
// Detach current shader program.
GLES20.glUseProgram(/* program= */ 0);
if (drawer != null) {
drawer.release();
drawer = null;