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

Side by Side Diff: talk/app/webrtc/java/jni/peerconnection_jni.cc

Issue 1522073002: Revert of Made EglBase an abstract class and cleaned up. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java ('k') | talk/libjingle.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 } 1358 }
1359 } 1359 }
1360 1360
1361 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( 1361 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)(
1362 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, 1362 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context,
1363 jobject remote_egl_context) { 1363 jobject remote_egl_context) {
1364 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) 1364 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
1365 OwnedFactoryAndThreads* owned_factory = 1365 OwnedFactoryAndThreads* owned_factory =
1366 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); 1366 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
1367 1367
1368 // TODO(perkj): In order to not break existing applications we need to
1369 // check if |local_egl_context| or |remote_egl_context| is an
1370 // EGL10 context. If so, create an EGLBase10.EGL10Context instead.
1371 // Remove this once existing applications has been updated.
1372 jobject local_eglbase_context = local_egl_context;
1373 jobject remote_eglbase_context = remote_egl_context;
1374
1375 jclass j_egl10_context_class =
1376 FindClass(jni, "javax/microedition/khronos/egl/EGLContext");
1377 jclass j_eglbase_context_class =
1378 FindClass(jni, "org/webrtc/EglBase$Context");
1379
1380 jmethodID j_eglbase_context_ctor = GetMethodID(
1381 jni, j_eglbase_context_class,
1382 "<init>", "(Ljavax/microedition/khronos/egl/EGLContext;)V");
1383 if (local_egl_context != nullptr &&
1384 jni->IsInstanceOf(local_egl_context, j_egl10_context_class)) {
1385 local_eglbase_context = jni->NewObject(
1386 j_eglbase_context_class, j_eglbase_context_ctor,
1387 local_egl_context);
1388 }
1389 if (remote_egl_context != nullptr &&
1390 jni->IsInstanceOf(remote_egl_context, j_egl10_context_class)) {
1391 remote_eglbase_context = jni->NewObject(
1392 j_eglbase_context_class, j_eglbase_context_ctor,
1393 remote_egl_context);
1394 }
1395
1368 MediaCodecVideoEncoderFactory* encoder_factory = 1396 MediaCodecVideoEncoderFactory* encoder_factory =
1369 static_cast<MediaCodecVideoEncoderFactory*> 1397 static_cast<MediaCodecVideoEncoderFactory*>
1370 (owned_factory->encoder_factory()); 1398 (owned_factory->encoder_factory());
1371 if (encoder_factory) { 1399 if (encoder_factory) {
1372 LOG(LS_INFO) << "Set EGL context for HW encoding."; 1400 LOG(LS_INFO) << "Set EGL context for HW encoding.";
1373 encoder_factory->SetEGLContext(jni, local_egl_context); 1401 encoder_factory->SetEGLContext(jni, local_eglbase_context);
1374 } 1402 }
1375 1403
1376 MediaCodecVideoDecoderFactory* decoder_factory = 1404 MediaCodecVideoDecoderFactory* decoder_factory =
1377 static_cast<MediaCodecVideoDecoderFactory*> 1405 static_cast<MediaCodecVideoDecoderFactory*>
1378 (owned_factory->decoder_factory()); 1406 (owned_factory->decoder_factory());
1379 if (decoder_factory) { 1407 if (decoder_factory) {
1380 LOG(LS_INFO) << "Set EGL context for HW decoding."; 1408 LOG(LS_INFO) << "Set EGL context for HW decoding.";
1381 decoder_factory->SetEGLContext(jni, remote_egl_context); 1409 decoder_factory->SetEGLContext(jni, remote_eglbase_context);
1382 } 1410 }
1383 #endif 1411 #endif
1384 } 1412 }
1385 1413
1386 static std::string 1414 static std::string
1387 GetJavaEnumName(JNIEnv* jni, const std::string& className, jobject j_enum) { 1415 GetJavaEnumName(JNIEnv* jni, const std::string& className, jobject j_enum) {
1388 jclass enumClass = FindClass(jni, className.c_str()); 1416 jclass enumClass = FindClass(jni, className.c_str());
1389 jmethodID nameMethod = 1417 jmethodID nameMethod =
1390 GetMethodID(jni, enumClass, "name", "()Ljava/lang/String;"); 1418 GetMethodID(jni, enumClass, "name", "()Ljava/lang/String;");
1391 jstring name = 1419 jstring name =
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 return JavaStringFromStdString( 2184 return JavaStringFromStdString(
2157 jni, 2185 jni,
2158 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2186 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2159 } 2187 }
2160 2188
2161 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 2189 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
2162 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2190 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2163 } 2191 }
2164 2192
2165 } // namespace webrtc_jni 2193 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java ('k') | talk/libjingle.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698