Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: webrtc/api/android/java/src/org/webrtc/EglRenderer.java

Issue 2449693003: Fix a deadlock in EglRenderer.releaseEglSurface. (Closed)
Patch Set: Oops, fix another bug. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/java/src/org/webrtc/EglRenderer.java
diff --git a/webrtc/api/android/java/src/org/webrtc/EglRenderer.java b/webrtc/api/android/java/src/org/webrtc/EglRenderer.java
index 415e1278541b0c7fe0fd59e9f0d01085e2e59399..d5c29e77404ba26ef4318d2e63eba382507a018e 100644
--- a/webrtc/api/android/java/src/org/webrtc/EglRenderer.java
+++ b/webrtc/api/android/java/src/org/webrtc/EglRenderer.java
@@ -380,23 +380,28 @@ public class EglRenderer implements VideoRenderer.Callbacks {
* Release EGL surface. This function will block until the EGL surface is released.
*/
public void releaseEglSurface() {
+ final CountDownLatch completionLatch = new CountDownLatch(1);
// Ensure that the render thread is no longer touching the Surface before returning from this
// function.
eglSurfaceCreationRunnable.setSurface(null /* surface */);
synchronized (handlerLock) {
if (renderThreadHandler != null) {
renderThreadHandler.removeCallbacks(eglSurfaceCreationRunnable);
- ThreadUtils.invokeAtFrontUninterruptibly(renderThreadHandler, new Runnable() {
+ renderThreadHandler.postAtFrontOfQueue(new Runnable() {
@Override
public void run() {
if (eglBase != null) {
eglBase.detachCurrent();
eglBase.releaseSurface();
}
+ completionLatch.countDown();
}
});
+ } else {
+ completionLatch.countDown();
}
}
+ ThreadUtils.awaitUninterruptibly(completionLatch);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698