OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1359 } |
1360 } | 1360 } |
1361 | 1361 |
1362 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( | 1362 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
1363 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, | 1363 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, |
1364 jobject remote_egl_context) { | 1364 jobject remote_egl_context) { |
1365 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) | 1365 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) |
1366 OwnedFactoryAndThreads* owned_factory = | 1366 OwnedFactoryAndThreads* owned_factory = |
1367 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); | 1367 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
1368 | 1368 |
| 1369 jclass j_eglbase14_context_class = |
| 1370 FindClass(jni, "org/webrtc/EglBase14$Context"); |
| 1371 |
1369 MediaCodecVideoEncoderFactory* encoder_factory = | 1372 MediaCodecVideoEncoderFactory* encoder_factory = |
1370 static_cast<MediaCodecVideoEncoderFactory*> | 1373 static_cast<MediaCodecVideoEncoderFactory*> |
1371 (owned_factory->encoder_factory()); | 1374 (owned_factory->encoder_factory()); |
1372 if (encoder_factory) { | 1375 if (encoder_factory && |
| 1376 jni->IsInstanceOf(local_egl_context, j_eglbase14_context_class)) { |
1373 LOG(LS_INFO) << "Set EGL context for HW encoding."; | 1377 LOG(LS_INFO) << "Set EGL context for HW encoding."; |
1374 encoder_factory->SetEGLContext(jni, local_egl_context); | 1378 encoder_factory->SetEGLContext(jni, local_egl_context); |
1375 } | 1379 } |
1376 | 1380 |
1377 MediaCodecVideoDecoderFactory* decoder_factory = | 1381 MediaCodecVideoDecoderFactory* decoder_factory = |
1378 static_cast<MediaCodecVideoDecoderFactory*> | 1382 static_cast<MediaCodecVideoDecoderFactory*> |
1379 (owned_factory->decoder_factory()); | 1383 (owned_factory->decoder_factory()); |
1380 if (decoder_factory) { | 1384 if (decoder_factory && |
| 1385 jni->IsInstanceOf(remote_egl_context, j_eglbase14_context_class)) { |
1381 LOG(LS_INFO) << "Set EGL context for HW decoding."; | 1386 LOG(LS_INFO) << "Set EGL context for HW decoding."; |
1382 decoder_factory->SetEGLContext(jni, remote_egl_context); | 1387 decoder_factory->SetEGLContext(jni, remote_egl_context); |
1383 } | 1388 } |
1384 #endif | 1389 #endif |
1385 } | 1390 } |
1386 | 1391 |
1387 static std::string | 1392 static std::string |
1388 GetJavaEnumName(JNIEnv* jni, const std::string& className, jobject j_enum) { | 1393 GetJavaEnumName(JNIEnv* jni, const std::string& className, jobject j_enum) { |
1389 jclass enumClass = FindClass(jni, className.c_str()); | 1394 jclass enumClass = FindClass(jni, className.c_str()); |
1390 jmethodID nameMethod = | 1395 jmethodID nameMethod = |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 return JavaStringFromStdString( | 2162 return JavaStringFromStdString( |
2158 jni, | 2163 jni, |
2159 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2164 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2160 } | 2165 } |
2161 | 2166 |
2162 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2167 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2163 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2168 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2164 } | 2169 } |
2165 | 2170 |
2166 } // namespace webrtc_jni | 2171 } // namespace webrtc_jni |
OLD | NEW |