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..a2e6398ce2eb6f3ed1924a84aae4688bfdd14f36 100644 |
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc |
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc |
@@ -1365,10 +1365,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); |
} |
@@ -1376,7 +1380,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); |
} |