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

Unified Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1522073002: Revert of Made EglBase an abstract class and cleaned up. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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 | « talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java ('k') | talk/libjingle.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/jni/peerconnection_jni.cc
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index f44498443b408ead137500aa6e19c21c8f3e4f43..c5de9654743e7d4e39eb6ddd1bbaaf8fe87ae5cb 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -1365,12 +1365,40 @@
OwnedFactoryAndThreads* owned_factory =
reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
+ // TODO(perkj): In order to not break existing applications we need to
+ // check if |local_egl_context| or |remote_egl_context| is an
+ // EGL10 context. If so, create an EGLBase10.EGL10Context instead.
+ // Remove this once existing applications has been updated.
+ jobject local_eglbase_context = local_egl_context;
+ jobject remote_eglbase_context = remote_egl_context;
+
+ jclass j_egl10_context_class =
+ FindClass(jni, "javax/microedition/khronos/egl/EGLContext");
+ jclass j_eglbase_context_class =
+ FindClass(jni, "org/webrtc/EglBase$Context");
+
+ jmethodID j_eglbase_context_ctor = GetMethodID(
+ jni, j_eglbase_context_class,
+ "<init>", "(Ljavax/microedition/khronos/egl/EGLContext;)V");
+ if (local_egl_context != nullptr &&
+ jni->IsInstanceOf(local_egl_context, j_egl10_context_class)) {
+ local_eglbase_context = jni->NewObject(
+ j_eglbase_context_class, j_eglbase_context_ctor,
+ local_egl_context);
+ }
+ if (remote_egl_context != nullptr &&
+ jni->IsInstanceOf(remote_egl_context, j_egl10_context_class)) {
+ remote_eglbase_context = jni->NewObject(
+ j_eglbase_context_class, j_eglbase_context_ctor,
+ remote_egl_context);
+ }
+
MediaCodecVideoEncoderFactory* encoder_factory =
static_cast<MediaCodecVideoEncoderFactory*>
(owned_factory->encoder_factory());
if (encoder_factory) {
LOG(LS_INFO) << "Set EGL context for HW encoding.";
- encoder_factory->SetEGLContext(jni, local_egl_context);
+ encoder_factory->SetEGLContext(jni, local_eglbase_context);
}
MediaCodecVideoDecoderFactory* decoder_factory =
@@ -1378,7 +1406,7 @@
(owned_factory->decoder_factory());
if (decoder_factory) {
LOG(LS_INFO) << "Set EGL context for HW decoding.";
- decoder_factory->SetEGLContext(jni, remote_egl_context);
+ decoder_factory->SetEGLContext(jni, remote_eglbase_context);
}
#endif
}
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java ('k') | talk/libjingle.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698