OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 g_class_reference_holder = new ClassReferenceHolder(GetEnv()); | 55 g_class_reference_holder = new ClassReferenceHolder(GetEnv()); |
56 } | 56 } |
57 | 57 |
58 void FreeGlobalClassReferenceHolder() { | 58 void FreeGlobalClassReferenceHolder() { |
59 g_class_reference_holder->FreeReferences(AttachCurrentThreadIfNeeded()); | 59 g_class_reference_holder->FreeReferences(AttachCurrentThreadIfNeeded()); |
60 delete g_class_reference_holder; | 60 delete g_class_reference_holder; |
61 g_class_reference_holder = nullptr; | 61 g_class_reference_holder = nullptr; |
62 } | 62 } |
63 | 63 |
64 ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) { | 64 ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) { |
| 65 LoadClass(jni, "android/graphics/SurfaceTexture"); |
65 LoadClass(jni, "java/nio/ByteBuffer"); | 66 LoadClass(jni, "java/nio/ByteBuffer"); |
66 LoadClass(jni, "java/util/ArrayList"); | 67 LoadClass(jni, "java/util/ArrayList"); |
67 LoadClass(jni, "org/webrtc/AudioTrack"); | 68 LoadClass(jni, "org/webrtc/AudioTrack"); |
| 69 LoadClass(jni, "org/webrtc/CameraEnumerator"); |
| 70 LoadClass(jni, "org/webrtc/Camera2Enumerator"); |
| 71 LoadClass(jni, "org/webrtc/CameraEnumerationAndroid"); |
68 LoadClass(jni, "org/webrtc/DataChannel"); | 72 LoadClass(jni, "org/webrtc/DataChannel"); |
69 LoadClass(jni, "org/webrtc/DataChannel$Buffer"); | 73 LoadClass(jni, "org/webrtc/DataChannel$Buffer"); |
70 LoadClass(jni, "org/webrtc/DataChannel$Init"); | 74 LoadClass(jni, "org/webrtc/DataChannel$Init"); |
71 LoadClass(jni, "org/webrtc/DataChannel$State"); | 75 LoadClass(jni, "org/webrtc/DataChannel$State"); |
72 LoadClass(jni, "org/webrtc/IceCandidate"); | |
73 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) | |
74 LoadClass(jni, "android/graphics/SurfaceTexture"); | |
75 LoadClass(jni, "org/webrtc/CameraEnumerator"); | |
76 LoadClass(jni, "org/webrtc/Camera2Enumerator"); | |
77 LoadClass(jni, "org/webrtc/CameraEnumerationAndroid"); | |
78 LoadClass(jni, "org/webrtc/VideoCapturerAndroid"); | |
79 LoadClass(jni, "org/webrtc/VideoCapturerAndroid$NativeObserver"); | |
80 LoadClass(jni, "org/webrtc/EglBase"); | 76 LoadClass(jni, "org/webrtc/EglBase"); |
81 LoadClass(jni, "org/webrtc/EglBase$Context"); | 77 LoadClass(jni, "org/webrtc/EglBase$Context"); |
82 LoadClass(jni, "org/webrtc/EglBase14$Context"); | 78 LoadClass(jni, "org/webrtc/EglBase14$Context"); |
83 LoadClass(jni, "org/webrtc/NetworkMonitor"); | 79 LoadClass(jni, "org/webrtc/IceCandidate"); |
84 LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$ConnectionType"); | |
85 LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$IPAddress"); | |
86 LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$NetworkInformation"); | |
87 LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder"); | 80 LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder"); |
88 LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$OutputBufferInfo"); | 81 LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$OutputBufferInfo"); |
89 LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$VideoCodecType"); | 82 LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$VideoCodecType"); |
90 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder"); | 83 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder"); |
91 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$DecodedTextureBuffer"); | 84 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$DecodedTextureBuffer"); |
92 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$DecodedOutputBuffer"); | 85 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$DecodedOutputBuffer"); |
93 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$VideoCodecType"); | 86 LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$VideoCodecType"); |
94 LoadClass(jni, "org/webrtc/SurfaceTextureHelper"); | |
95 #endif | |
96 LoadClass(jni, "org/webrtc/MediaSource$State"); | 87 LoadClass(jni, "org/webrtc/MediaSource$State"); |
97 LoadClass(jni, "org/webrtc/MediaStream"); | 88 LoadClass(jni, "org/webrtc/MediaStream"); |
98 LoadClass(jni, "org/webrtc/MediaStreamTrack$State"); | 89 LoadClass(jni, "org/webrtc/MediaStreamTrack$State"); |
| 90 LoadClass(jni, "org/webrtc/NetworkMonitor"); |
| 91 LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$ConnectionType"); |
| 92 LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$IPAddress"); |
| 93 LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$NetworkInformation"); |
99 LoadClass(jni, "org/webrtc/PeerConnectionFactory"); | 94 LoadClass(jni, "org/webrtc/PeerConnectionFactory"); |
100 LoadClass(jni, "org/webrtc/PeerConnection$BundlePolicy"); | 95 LoadClass(jni, "org/webrtc/PeerConnection$BundlePolicy"); |
101 LoadClass(jni, "org/webrtc/PeerConnection$ContinualGatheringPolicy"); | 96 LoadClass(jni, "org/webrtc/PeerConnection$ContinualGatheringPolicy"); |
102 LoadClass(jni, "org/webrtc/PeerConnection$RtcpMuxPolicy"); | 97 LoadClass(jni, "org/webrtc/PeerConnection$RtcpMuxPolicy"); |
103 LoadClass(jni, "org/webrtc/PeerConnection$IceConnectionState"); | 98 LoadClass(jni, "org/webrtc/PeerConnection$IceConnectionState"); |
104 LoadClass(jni, "org/webrtc/PeerConnection$IceGatheringState"); | 99 LoadClass(jni, "org/webrtc/PeerConnection$IceGatheringState"); |
105 LoadClass(jni, "org/webrtc/PeerConnection$IceTransportsType"); | 100 LoadClass(jni, "org/webrtc/PeerConnection$IceTransportsType"); |
106 LoadClass(jni, "org/webrtc/PeerConnection$TcpCandidatePolicy"); | 101 LoadClass(jni, "org/webrtc/PeerConnection$TcpCandidatePolicy"); |
107 LoadClass(jni, "org/webrtc/PeerConnection$KeyType"); | 102 LoadClass(jni, "org/webrtc/PeerConnection$KeyType"); |
108 LoadClass(jni, "org/webrtc/PeerConnection$SignalingState"); | 103 LoadClass(jni, "org/webrtc/PeerConnection$SignalingState"); |
109 LoadClass(jni, "org/webrtc/RtpReceiver"); | 104 LoadClass(jni, "org/webrtc/RtpReceiver"); |
110 LoadClass(jni, "org/webrtc/RtpSender"); | 105 LoadClass(jni, "org/webrtc/RtpSender"); |
111 LoadClass(jni, "org/webrtc/SessionDescription"); | 106 LoadClass(jni, "org/webrtc/SessionDescription"); |
112 LoadClass(jni, "org/webrtc/SessionDescription$Type"); | 107 LoadClass(jni, "org/webrtc/SessionDescription$Type"); |
113 LoadClass(jni, "org/webrtc/StatsReport"); | 108 LoadClass(jni, "org/webrtc/StatsReport"); |
114 LoadClass(jni, "org/webrtc/StatsReport$Value"); | 109 LoadClass(jni, "org/webrtc/StatsReport$Value"); |
| 110 LoadClass(jni, "org/webrtc/SurfaceTextureHelper"); |
| 111 LoadClass(jni, "org/webrtc/VideoCapturerAndroid"); |
| 112 LoadClass(jni, "org/webrtc/VideoCapturerAndroid$NativeObserver"); |
115 LoadClass(jni, "org/webrtc/VideoRenderer$I420Frame"); | 113 LoadClass(jni, "org/webrtc/VideoRenderer$I420Frame"); |
116 LoadClass(jni, "org/webrtc/VideoCapturer"); | |
117 LoadClass(jni, "org/webrtc/VideoTrack"); | 114 LoadClass(jni, "org/webrtc/VideoTrack"); |
118 } | 115 } |
119 | 116 |
120 ClassReferenceHolder::~ClassReferenceHolder() { | 117 ClassReferenceHolder::~ClassReferenceHolder() { |
121 RTC_CHECK(classes_.empty()) << "Must call FreeReferences() before dtor!"; | 118 RTC_CHECK(classes_.empty()) << "Must call FreeReferences() before dtor!"; |
122 } | 119 } |
123 | 120 |
124 void ClassReferenceHolder::FreeReferences(JNIEnv* jni) { | 121 void ClassReferenceHolder::FreeReferences(JNIEnv* jni) { |
125 for (std::map<std::string, jclass>::const_iterator it = classes_.begin(); | 122 for (std::map<std::string, jclass>::const_iterator it = classes_.begin(); |
126 it != classes_.end(); ++it) { | 123 it != classes_.end(); ++it) { |
(...skipping 19 matching lines...) Expand all Loading... |
146 RTC_CHECK(inserted) << "Duplicate class name: " << name; | 143 RTC_CHECK(inserted) << "Duplicate class name: " << name; |
147 } | 144 } |
148 | 145 |
149 // Returns a global reference guaranteed to be valid for the lifetime of the | 146 // Returns a global reference guaranteed to be valid for the lifetime of the |
150 // process. | 147 // process. |
151 jclass FindClass(JNIEnv* jni, const char* name) { | 148 jclass FindClass(JNIEnv* jni, const char* name) { |
152 return g_class_reference_holder->GetClass(name); | 149 return g_class_reference_holder->GetClass(name); |
153 } | 150 } |
154 | 151 |
155 } // namespace webrtc_jni | 152 } // namespace webrtc_jni |
OLD | NEW |