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

Unified Diff: talk/app/webrtc/java/jni/eglbase_jni.h

Issue 1615153002: Change PeerConnectionFactory.setVideoHwAccelerationOptions to create shared Egl context for harware… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added eglbase_jni to avoid code duplication. Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/java/jni/androidmediaencoder_jni.cc ('k') | talk/app/webrtc/java/jni/eglbase_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/jni/eglbase_jni.h
diff --git a/talk/app/webrtc/java/jni/jni_onload.cc b/talk/app/webrtc/java/jni/eglbase_jni.h
similarity index 63%
copy from talk/app/webrtc/java/jni/jni_onload.cc
copy to talk/app/webrtc/java/jni/eglbase_jni.h
index 9664ecdca6b2020f05fc9ca08a82638debb88e7f..1015d90b925d0afe35284ec5b348a02174aedf87 100644
--- a/talk/app/webrtc/java/jni/jni_onload.cc
+++ b/talk/app/webrtc/java/jni/eglbase_jni.h
@@ -1,6 +1,6 @@
/*
* libjingle
- * Copyright 2015 Google Inc.
+ * Copyright 2016 Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -23,33 +23,38 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*/
+#ifndef TALK_APP_WEBRTC_JAVA_JNI_EGLBASE_JNI_H_
+#define TALK_APP_WEBRTC_JAVA_JNI_EGLBASE_JNI_H_
+
#include <jni.h>
-#undef JNIEXPORT
-#define JNIEXPORT __attribute__((visibility("default")))
-#include "talk/app/webrtc/java/jni/classreferenceholder.h"
-#include "talk/app/webrtc/java/jni/jni_helpers.h"
-#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/constructormagic.h"
namespace webrtc_jni {
-extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
- jint ret = InitGlobalJniVariables(jvm);
- RTC_DCHECK_GE(ret, 0);
- if (ret < 0)
- return -1;
+// Helper class used for creating a Java instance of org/webrtc/EglBase.
+class EglBase {
+ public:
+ EglBase();
+ ~EglBase();
- RTC_CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()";
- LoadGlobalClassReferenceHolder();
+ // Creates an new java EglBase instance. |egl_base_context| must be a valid
+ // EglBase$Context.
+ // Returns false if |egl_base_context| is a null Java object or if an
+ // exception occur in Java.
+ bool CreateEglBase(JNIEnv* jni, jobject egl_base_context);
+ jobject egl_base_context() const { return egl_base_context_; }
- return ret;
-}
+ private:
+ jobject egl_base_ = nullptr; // instance of org/webrtc/EglBase
+ jobject egl_base_context_ = nullptr; // instance of EglBase$Context
-extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM *jvm, void *reserved) {
- FreeGlobalClassReferenceHolder();
- RTC_CHECK(rtc::CleanupSSL()) << "Failed to CleanupSSL()";
-}
+ RTC_DISALLOW_COPY_AND_ASSIGN(EglBase);
+};
} // namespace webrtc_jni
+
+#endif // TALK_APP_WEBRTC_JAVA_JNI_EGLBASE_JNI_H_
« no previous file with comments | « talk/app/webrtc/java/jni/androidmediaencoder_jni.cc ('k') | talk/app/webrtc/java/jni/eglbase_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698