• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package org.webrtc;
12 
13 /** Java wrapper for a C++ TurnCustomizer. */
14 public class TurnCustomizer {
15   private long nativeTurnCustomizer;
16 
TurnCustomizer(long nativeTurnCustomizer)17   public TurnCustomizer(long nativeTurnCustomizer) {
18     this.nativeTurnCustomizer = nativeTurnCustomizer;
19   }
20 
dispose()21   public void dispose() {
22     checkTurnCustomizerExists();
23     nativeFreeTurnCustomizer(nativeTurnCustomizer);
24     nativeTurnCustomizer = 0;
25   }
26 
nativeFreeTurnCustomizer(long turnCustomizer)27   private static native void nativeFreeTurnCustomizer(long turnCustomizer);
28 
29   /** Return a pointer to webrtc::TurnCustomizer. */
30   @CalledByNative
getNativeTurnCustomizer()31   long getNativeTurnCustomizer() {
32     checkTurnCustomizerExists();
33     return nativeTurnCustomizer;
34   }
35 
checkTurnCustomizerExists()36   private void checkTurnCustomizerExists() {
37     if (nativeTurnCustomizer == 0) {
38       throw new IllegalStateException("TurnCustomizer has been disposed.");
39     }
40   }
41 }
42