MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / init

Method init

framework/render/video/vsync/AndroidVSync.cpp:22–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20float AndroidVSync::mHz = 0;
21
22void AndroidVSync::init(JNIEnv *env) {
23
24 if (!env) {
25 AF_LOGE("jni attach failed.");
26 return;
27 }
28
29 if (gj_VsyncTimerClass == nullptr) {
30 jclass lc = env->FindClass("com/cicada/player/utils/VsyncTimer");
31 if (lc) {
32 gj_VsyncTimerClass = reinterpret_cast<jclass>(env->NewGlobalRef(lc));
33 } else {
34 JniException::clearException(env);
35 }
36 env->DeleteLocalRef(lc);
37 }
38
39 gj_VsyncTimer_init = env->GetMethodID(gj_VsyncTimerClass,
40 "<init>",
41 "(J)V");
42 gj_VsyncTimer_start = env->GetMethodID(gj_VsyncTimerClass,
43 "start",
44 "()V");
45 gj_VsyncTimer_pause = env->GetMethodID(gj_VsyncTimerClass,
46 "pause",
47 "()V");
48 gj_VsyncTimer_destroy = env->GetMethodID(gj_VsyncTimerClass,
49 "destroy",
50 "()V");
51 JNINativeMethod ClsMethods[] = {
52 {"onInit", "(J)I", (void *) OnInit},
53 {"onVsync", "(JJ)I", (void *) OnVsync},
54 {"onDestroy", "(J)V", (void *) OnDestroy},
55 };
56
57 if (env->RegisterNatives(gj_VsyncTimerClass, ClsMethods,
58 sizeof(ClsMethods) / sizeof(JNINativeMethod)) < 0) {
59 AF_LOGE("fail to register native methods");
60 return;
61 }
62}
63
64void AndroidVSync::unInit(JNIEnv *env) {
65 if(gj_VsyncTimerClass != nullptr){

Callers

nothing calls this directly

Calls 1

FindClassMethod · 0.45

Tested by

no test coverage detected