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

Unified Diff: webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java

Issue 1695763002: Replaced eglbase_jni with with holding a EglBase in PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Removed bad test Created 4 years, 10 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
Index: webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java
diff --git a/webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java b/webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java
index ff6e89f80920d0f3333ef5982cd067fb20784a04..14a89fd3baeb613ef117d1c848f5d1cc6b1b7482 100644
--- a/webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java
+++ b/webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java
@@ -26,6 +26,8 @@ public class PeerConnectionFactory {
private final long nativeFactory;
private static Thread workerThread;
private static Thread signalingThread;
+ private EglBase localEglbase;
+ private EglBase remoteEglbase;
public static class Options {
// Keep in sync with webrtc/base/network.h!
@@ -161,20 +163,29 @@ public class PeerConnectionFactory {
/** Set the EGL context used by HW Video encoding and decoding.
*
- * @param localEGLContext An instance of EglBase.Context.
- * Must be the same as used by VideoCapturerAndroid and any local
- * video renderer.
- * @param remoteEGLContext An instance of EglBase.Context.
- * Must be the same as used by any remote video renderer.
+ * @param localEglContext Must be the same as used by VideoCapturerAndroid and any local video
+ * renderer.
+ * @param remoteEglContext Must be the same as used by any remote video renderer.
*/
- public void setVideoHwAccelerationOptions(Object localEGLContext, Object remoteEGLContext) {
- nativeSetVideoHwAccelerationOptions(nativeFactory, localEGLContext, remoteEGLContext);
+ public void setVideoHwAccelerationOptions(EglBase.Context localEglContext,
+ EglBase.Context remoteEglContext) {
+ if (localEglbase != null || remoteEglbase != null) {
+ throw new IllegalStateException("Egl context already set.");
+ }
+ localEglbase = EglBase.create(localEglContext);
+ remoteEglbase = EglBase.create(remoteEglContext);
+ nativeSetVideoHwAccelerationOptions(nativeFactory, localEglbase.getEglBaseContext(),
+ remoteEglbase.getEglBaseContext());
}
public void dispose() {
nativeFreeFactory(nativeFactory);
signalingThread = null;
workerThread = null;
+ if (localEglbase != null)
+ localEglbase.release();
+ if (remoteEglbase != null)
+ remoteEglbase.release();
}
public void threadsCallbacks() {

Powered by Google App Engine
This is Rietveld 408576698