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 c79e3a5cb57f7af5b3a90a7bfdf57e602fef9064..d58a29bfaa6d166e126a722844594ca0ab80a2e9 100644 |
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc |
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc |
@@ -1298,6 +1298,32 @@ JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
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_eglbase10_context = local_egl_context; |
+ jobject remote_eglbase10_context = remote_egl_context; |
+ |
+ jclass j_egl10_context_class = |
+ FindClass(jni, "javax/microedition/khronos/egl/EGLContext"); |
+ jclass j_eglbase10_context_class = |
+ FindClass(jni, "org/webrtc/EglBase10$Egl10Context"); |
+ |
+ jmethodID j_eglbase10_context_ctor = GetMethodID( |
+ jni, j_eglbase10_context_class, |
+ "<init>", "(Ljavax/microedition/khronos/egl/EGLContext;)V"); |
+ if (jni->IsInstanceOf(local_egl_context, j_egl10_context_class)) { |
+ local_eglbase10_context = jni->NewObject( |
+ j_eglbase10_context_class, j_eglbase10_context_ctor, |
+ local_egl_context); |
+ } |
+ if (jni->IsInstanceOf(remote_egl_context, j_egl10_context_class)) { |
+ remote_eglbase10_context = jni->NewObject( |
+ j_eglbase10_context_class, j_eglbase10_context_ctor, |
+ remote_egl_context); |
+ } |
+ |
MediaCodecVideoEncoderFactory* encoder_factory = |
static_cast<MediaCodecVideoEncoderFactory*> |
(owned_factory->encoder_factory()); |