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 5b871d3cc865dd580b985c0ccf34a50d30121fdd..b16f9453a405869ff1fefd7faa0b46f192cb169a 100644 |
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc |
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc |
@@ -1366,10 +1366,14 @@ JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
OwnedFactoryAndThreads* owned_factory = |
reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
+ jclass j_eglbase14_context_class = |
+ FindClass(jni, "org/webrtc/EglBase14$Context"); |
+ |
MediaCodecVideoEncoderFactory* encoder_factory = |
static_cast<MediaCodecVideoEncoderFactory*> |
(owned_factory->encoder_factory()); |
- if (encoder_factory) { |
+ if (encoder_factory && |
+ jni->IsInstanceOf(local_egl_context, j_eglbase14_context_class)) { |
LOG(LS_INFO) << "Set EGL context for HW encoding."; |
encoder_factory->SetEGLContext(jni, local_egl_context); |
} |
@@ -1377,7 +1381,8 @@ JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
MediaCodecVideoDecoderFactory* decoder_factory = |
static_cast<MediaCodecVideoDecoderFactory*> |
(owned_factory->decoder_factory()); |
- if (decoder_factory) { |
+ if (decoder_factory && |
+ jni->IsInstanceOf(remote_egl_context, j_eglbase14_context_class)) { |
LOG(LS_INFO) << "Set EGL context for HW decoding."; |
decoder_factory->SetEGLContext(jni, remote_egl_context); |
} |