1 /*
2  *  Copyright 2017 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 "api/turn_customizer.h"
12 #include "sdk/android/generated_peerconnection_jni/TurnCustomizer_jni.h"
13 #include "sdk/android/native_api/jni/java_types.h"
14 #include "sdk/android/src/jni/jni_helpers.h"
15 
16 namespace webrtc {
17 namespace jni {
18 
GetNativeTurnCustomizer(JNIEnv * env,const JavaRef<jobject> & j_turn_customizer)19 TurnCustomizer* GetNativeTurnCustomizer(
20     JNIEnv* env,
21     const JavaRef<jobject>& j_turn_customizer) {
22   if (IsNull(env, j_turn_customizer))
23     return nullptr;
24   return reinterpret_cast<webrtc::TurnCustomizer*>(
25       Java_TurnCustomizer_getNativeTurnCustomizer(env, j_turn_customizer));
26 }
27 
JNI_TurnCustomizer_FreeTurnCustomizer(JNIEnv * jni,jlong j_turn_customizer_pointer)28 static void JNI_TurnCustomizer_FreeTurnCustomizer(
29     JNIEnv* jni,
30     jlong j_turn_customizer_pointer) {
31   delete reinterpret_cast<TurnCustomizer*>(j_turn_customizer_pointer);
32 }
33 
34 }  // namespace jni
35 }  // namespace webrtc
36