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

Side by Side Diff: webrtc/api/java/jni/eglbase_jni.cc

Issue 1695763002: Replaced eglbase_jni with with holding a EglBase in PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Removed bad test Created 4 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/api/java/jni/eglbase_jni.h"
12
13 #include "webrtc/api/java/jni/androidmediacodeccommon.h"
14 #include "webrtc/api/java/jni/classreferenceholder.h"
15 #include "webrtc/api/java/jni/jni_helpers.h"
16
17 namespace webrtc_jni {
18
19 EglBase::EglBase() {
20 }
21
22 EglBase::~EglBase() {
23 if (egl_base_) {
24 JNIEnv* jni = AttachCurrentThreadIfNeeded();
25 jni->DeleteGlobalRef(egl_base_context_);
26 egl_base_context_ = nullptr;
27 jni->CallVoidMethod(egl_base_,
28 GetMethodID(jni,
29 FindClass(jni, "org/webrtc/EglBase"),
30 "release", "()V"));
31 jni->DeleteGlobalRef(egl_base_);
32 }
33 }
34
35 bool EglBase::CreateEglBase(JNIEnv* jni, jobject egl_context) {
36 if (egl_base_) {
37 jni->DeleteGlobalRef(egl_base_context_);
38 egl_base_context_ = nullptr;
39 jni->CallVoidMethod(egl_base_,
40 GetMethodID(jni,
41 FindClass(jni, "org/webrtc/EglBase"),
42 "release", "()V"));
43 jni->DeleteGlobalRef(egl_base_);
44 egl_base_ = nullptr;
45 }
46
47 if (IsNull(jni, egl_context))
48 return false;
49
50 jobject egl_base = jni->CallStaticObjectMethod(
51 FindClass(jni, "org/webrtc/EglBase"),
52 GetStaticMethodID(jni,
53 FindClass(jni, "org/webrtc/EglBase"),
54 "create",
55 "(Lorg/webrtc/EglBase$Context;)Lorg/webrtc/EglBase;"),
56 egl_context);
57 if (CheckException(jni))
58 return false;
59
60 egl_base_ = jni->NewGlobalRef(egl_base);
61 egl_base_context_ = jni->NewGlobalRef(
62 jni->CallObjectMethod(
63 egl_base_,
64 GetMethodID(jni,
65 FindClass(jni, "org/webrtc/EglBase"),
66 "getEglBaseContext",
67 "()Lorg/webrtc/EglBase$Context;")));
68 RTC_CHECK(egl_base_context_);
69 return true;
70 }
71
72 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/java/jni/eglbase_jni.h ('k') | webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698