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

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

Issue 1461083002: Use EGL14 if supported on Android (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changed VideoRendererGui to return an EglBase.Context. 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
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 194f9ff98c1b2887b4ae16c921ab35a7088954ec..560b61cf3cc37bb6c56f88eba185c5c850c0df3d 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -1338,12 +1338,40 @@ 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_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 =
@@ -1351,7 +1379,7 @@ JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)(
(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/jni/classreferenceholder.cc ('k') | talk/app/webrtc/java/jni/surfacetexturehelper_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698