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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 } | 1291 } |
1292 } | 1292 } |
1293 | 1293 |
1294 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( | 1294 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
1295 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, | 1295 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, |
1296 jobject remote_egl_context) { | 1296 jobject remote_egl_context) { |
1297 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) | 1297 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) |
1298 OwnedFactoryAndThreads* owned_factory = | 1298 OwnedFactoryAndThreads* owned_factory = |
1299 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); | 1299 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
1300 | 1300 |
| 1301 // TODO(perkj): In order to not break existing applications we need to |
| 1302 // check if |local_egl_context| or |remote_egl_context| is an |
| 1303 // EGL10 context. If so, create an EGLBase10.EGL10Context instead. |
| 1304 // Remove this once existing applications has been updated. |
| 1305 jobject local_eglbase10_context = local_egl_context; |
| 1306 jobject remote_eglbase10_context = remote_egl_context; |
| 1307 |
| 1308 jclass j_egl10_context_class = |
| 1309 FindClass(jni, "javax/microedition/khronos/egl/EGLContext"); |
| 1310 jclass j_eglbase10_context_class = |
| 1311 FindClass(jni, "org/webrtc/EglBase10$Egl10Context"); |
| 1312 |
| 1313 jmethodID j_eglbase10_context_ctor = GetMethodID( |
| 1314 jni, j_eglbase10_context_class, |
| 1315 "<init>", "(Ljavax/microedition/khronos/egl/EGLContext;)V"); |
| 1316 if (jni->IsInstanceOf(local_egl_context, j_egl10_context_class)) { |
| 1317 local_eglbase10_context = jni->NewObject( |
| 1318 j_eglbase10_context_class, j_eglbase10_context_ctor, |
| 1319 local_egl_context); |
| 1320 } |
| 1321 if (jni->IsInstanceOf(remote_egl_context, j_egl10_context_class)) { |
| 1322 remote_eglbase10_context = jni->NewObject( |
| 1323 j_eglbase10_context_class, j_eglbase10_context_ctor, |
| 1324 remote_egl_context); |
| 1325 } |
| 1326 |
1301 MediaCodecVideoEncoderFactory* encoder_factory = | 1327 MediaCodecVideoEncoderFactory* encoder_factory = |
1302 static_cast<MediaCodecVideoEncoderFactory*> | 1328 static_cast<MediaCodecVideoEncoderFactory*> |
1303 (owned_factory->encoder_factory()); | 1329 (owned_factory->encoder_factory()); |
1304 if (encoder_factory) { | 1330 if (encoder_factory) { |
1305 LOG(LS_INFO) << "Set EGL context for HW encoding."; | 1331 LOG(LS_INFO) << "Set EGL context for HW encoding."; |
1306 encoder_factory->SetEGLContext(jni, local_egl_context); | 1332 encoder_factory->SetEGLContext(jni, local_egl_context); |
1307 } | 1333 } |
1308 | 1334 |
1309 MediaCodecVideoDecoderFactory* decoder_factory = | 1335 MediaCodecVideoDecoderFactory* decoder_factory = |
1310 static_cast<MediaCodecVideoDecoderFactory*> | 1336 static_cast<MediaCodecVideoDecoderFactory*> |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 return JavaStringFromStdString( | 2081 return JavaStringFromStdString( |
2056 jni, | 2082 jni, |
2057 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2083 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2058 } | 2084 } |
2059 | 2085 |
2060 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2086 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2061 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2087 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2062 } | 2088 } |
2063 | 2089 |
2064 } // namespace webrtc_jni | 2090 } // namespace webrtc_jni |
OLD | NEW |