Skip to content

Commit

Permalink
Android JNI generation: Set JNI namespace in build files
Browse files Browse the repository at this point in the history
This CL removes the use of the @JNINamespace annotation and instead
sets the correct JNI namespace in the build file.

Bug: webrtc:8278
Change-Id: Ia4490399e45a97d56b02c260fd80df4edfa092bf
Reviewed-on: https://webrtc-review.googlesource.com/76440
Commit-Queue: Magnus Jedvert <[email protected]>
Reviewed-by: Sami Kalliomäki <[email protected]>
Cr-Commit-Position: refs/heads/master@{#23299}
  • Loading branch information
Hnoo112233 authored and Commit Bot committed May 18, 2018
1 parent 7e6fcea commit c7da266
Show file tree
Hide file tree
Showing 72 changed files with 131 additions and 240 deletions.
1 change: 1 addition & 0 deletions examples/androidnativeapi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ generate_jni("generated_jni") {
"java/org/webrtc/examples/androidnativeapi/CallClient.java",
]
jni_package = ""
namespace = "webrtc_examples"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import org.webrtc.JNINamespace;
import org.webrtc.NativeClassQualifiedName;
import org.webrtc.SurfaceTextureHelper;
import org.webrtc.VideoCapturer;
import org.webrtc.VideoSink;

@JNINamespace("webrtc_examples")
public class CallClient {
private static final String TAG = "CallClient";
private static final int CAPTURE_WIDTH = 640;
Expand Down Expand Up @@ -65,13 +62,10 @@ public void close() {
}

private static native long nativeCreateClient();
@NativeClassQualifiedName("webrtc_examples::AndroidCallClient")
private static native void nativeCall(long nativePtr, VideoSink localSink, VideoSink remoteSink);
@NativeClassQualifiedName("webrtc_examples::AndroidCallClient")
private static native void nativeHangup(long nativePtr);
@NativeClassQualifiedName("webrtc_examples::AndroidCallClient")
private static native void nativeDelete(long nativePtr);
@NativeClassQualifiedName("webrtc_examples::AndroidCallClient")
private static native void nativeCall(
long nativeAndroidCallClient, VideoSink localSink, VideoSink remoteSink);
private static native void nativeHangup(long nativeAndroidCallClient);
private static native void nativeDelete(long nativeAndroidCallClient);
private static native VideoCapturer.CapturerObserver nativeGetJavaVideoCapturerObserver(
long nativePtr);
long nativeAndroidCallClient);
}
13 changes: 11 additions & 2 deletions sdk/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ generate_jni("generated_base_jni") {
"src/java/org/webrtc/JniCommon.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -252,6 +253,7 @@ generate_jni("generated_audio_device_module_base_jni") {
"src/java/org/webrtc/audio/WebRtcAudioManager.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand All @@ -261,6 +263,7 @@ generate_jni("generated_java_audio_device_module_native_jni") {
"src/java/org/webrtc/audio/WebRtcAudioTrack.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -297,6 +300,7 @@ generate_jni("generated_video_jni") {
sources += [ "api/org/webrtc/HardwareVideoEncoderFactory.java" ] # TODO(andersc): This currently depends on SoftwareVideoEncoderFactory
}
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -418,6 +422,7 @@ generate_jni("generated_vp8_jni") {
]

jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand All @@ -440,6 +445,7 @@ generate_jni("generated_vp9_jni") {
]

jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -509,6 +515,7 @@ generate_jni("generated_peerconnection_jni") {
"api/org/webrtc/TurnCustomizer.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -628,6 +635,7 @@ generate_jni("generated_metrics_jni") {
"api/org/webrtc/Metrics.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -734,8 +742,6 @@ rtc_android_library("base_java") {
"src/java/org/webrtc/Histogram.java",
"src/java/org/webrtc/JniCommon.java",
"src/java/org/webrtc/JniHelper.java",
"src/java/org/webrtc/JNINamespace.java",
"src/java/org/webrtc/NativeClassQualifiedName.java",
"src/java/org/webrtc/RefCountDelegate.java",
"src/java/org/webrtc/WebRtcClassLoader.java",
]
Expand Down Expand Up @@ -827,6 +833,7 @@ generate_jni("generated_java_audio_jni") {
"api/org/webrtc/audio/JavaAudioDeviceModule.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -1138,6 +1145,7 @@ generate_jni("generated_native_api_jni") {
"src/java/org/webrtc/WebRtcClassLoader.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down Expand Up @@ -1252,6 +1260,7 @@ generate_jni("generated_native_unittests_jni") {
"native_unittests/org/webrtc/PeerConnectionFactoryInitializationHelper.java",
]
jni_package = ""
namespace = "webrtc::jni"
jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
}

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/AudioTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.webrtc;

/** Java wrapper for a C++ AudioTrackInterface */
@JNINamespace("webrtc::jni")
public class AudioTrack extends MediaStreamTrack {
public AudioTrack(long nativeTrack) {
super(nativeTrack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.webrtc;

@JNINamespace("webrtc::jni")
public class CallSessionFileRotatingLogSink {
private long nativeSink;

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/DataChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.nio.ByteBuffer;

/** Java wrapper for a C++ DataChannelInterface. */
@JNINamespace("webrtc::jni")
public class DataChannel {
/** Java wrapper for WebIDL RTCDataChannel. */
public static class Init {
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/DtmfSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.webrtc;

/** Java wrapper for a C++ DtmfSenderInterface. */
@JNINamespace("webrtc::jni")
public class DtmfSender {
final long nativeDtmfSender;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

/** Factory for android hardware video encoders. */
@SuppressWarnings("deprecation") // API 16 requires the use of deprecated methods.
@JNINamespace("webrtc::jni")
public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
private static final String TAG = "HardwareVideoEncoderFactory";

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
// This class is an implementation detail of the Java PeerConnection API.
@TargetApi(19)
@SuppressWarnings("deprecation")
@JNINamespace("webrtc::jni")
public class MediaCodecVideoEncoder {
// This class is constructed, operated, and destroyed by its C++ incarnation,
// so the class and its methods have non-public visibility. The API this
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/MediaSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.webrtc;

/** Java wrapper for a C++ MediaSourceInterface. */
@JNINamespace("webrtc::jni")
public class MediaSource {
/** Tracks MediaSourceInterface.SourceState */
public enum State {
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/MediaStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.Iterator;

/** Java wrapper for a C++ MediaStreamInterface. */
@JNINamespace("webrtc::jni")
public class MediaStream {
private static final String TAG = "MediaStream";

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/MediaStreamTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.annotation.Nullable;

/** Java wrapper for a C++ MediaStreamTrackInterface. */
@JNINamespace("webrtc::jni")
public class MediaStreamTrack {
public static final String AUDIO_TRACK_KIND = "audio";
public static final String VIDEO_TRACK_KIND = "video";
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
// Most histograms are not updated frequently (e.g. most video metrics are an
// average over the call and recorded when a stream is removed).
// The metrics can for example be retrieved when a peer connection is closed.
@JNINamespace("webrtc::jni")
public class Metrics {
private static final String TAG = "Metrics";

Expand Down
17 changes: 6 additions & 11 deletions sdk/android/api/org/webrtc/NetworkMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,13 @@ public static boolean isOnline() {
return connectionType != ConnectionType.CONNECTION_NONE;
}

@NativeClassQualifiedName("webrtc::jni::AndroidNetworkMonitor")
private native void nativeNotifyConnectionTypeChanged(long nativePtr);

@NativeClassQualifiedName("webrtc::jni::AndroidNetworkMonitor")
private native void nativeNotifyOfNetworkConnect(long nativePtr, NetworkInformation networkInfo);

@NativeClassQualifiedName("webrtc::jni::AndroidNetworkMonitor")
private native void nativeNotifyOfNetworkDisconnect(long nativePtr, long networkHandle);

@NativeClassQualifiedName("webrtc::jni::AndroidNetworkMonitor")
private native void nativeNotifyConnectionTypeChanged(long nativeAndroidNetworkMonitor);
private native void nativeNotifyOfNetworkConnect(
long nativeAndroidNetworkMonitor, NetworkInformation networkInfo);
private native void nativeNotifyOfNetworkDisconnect(
long nativeAndroidNetworkMonitor, long networkHandle);
private native void nativeNotifyOfActiveNetworkList(
long nativePtr, NetworkInformation[] networkInfos);
long nativeAndroidNetworkMonitor, NetworkInformation[] networkInfos);

// For testing only.
@Nullable
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/PeerConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* JS APIs: http://dev.w3.org/2011/webrtc/editor/webrtc.html and
* http://www.w3.org/TR/mediacapture-streams/
*/
@JNINamespace("webrtc::jni")
public class PeerConnection {
/** Tracks PeerConnectionInterface::IceGatheringState */
public enum IceGatheringState {
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/PeerConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* Java wrapper for a C++ PeerConnectionFactoryInterface. Main entry point to
* the PeerConnection API for clients.
*/
@JNINamespace("webrtc::jni")
public class PeerConnectionFactory {
public static final String TRIAL_ENABLED = "Enabled";
@Deprecated public static final String VIDEO_FRAME_EMIT_TRIAL = "VideoFrameEmit";
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/RtpReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.webrtc.MediaStreamTrack;

/** Java wrapper for a C++ RtpReceiverInterface. */
@JNINamespace("webrtc::jni")
public class RtpReceiver {
/** Java wrapper for a C++ RtpReceiverObserverInterface*/
public static interface Observer {
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/RtpSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.annotation.Nullable;

/** Java wrapper for a C++ RtpSenderInterface. */
@JNINamespace("webrtc::jni")
public class RtpSender {
final long nativeRtpSender;

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/RtpTransceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* <p>WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
*/
@JNINamespace("webrtc::jni")
public class RtpTransceiver {
/** Java version of webrtc::RtpTransceiverDirection - the ordering must be kept in sync. */
public enum RtpTransceiverDirection {
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/TurnCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.webrtc;

/** Java wrapper for a C++ TurnCustomizer. */
@JNINamespace("webrtc::jni")
public class TurnCustomizer {
final long nativeTurnCustomizer;

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoDecoderFallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/**
* A combined video decoder that falls back on a secondary decoder if the primary decoder fails.
*/
@JNINamespace("webrtc::jni")
public class VideoDecoderFallback extends WrappedNativeVideoDecoder {
private final VideoDecoder fallback;
private final VideoDecoder primary;
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoEncoderFallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/**
* A combined video encoder that falls back on a secondary encoder if the primary encoder fails.
*/
@JNINamespace("webrtc::jni")
public class VideoEncoderFallback extends WrappedNativeVideoEncoder {
private final VideoEncoder fallback;
private final VideoEncoder primary;
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoFileRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
/**
* Can be used to save the video frames to file.
*/
@JNINamespace("webrtc::jni")
public class VideoFileRenderer implements VideoSink {
private static final String TAG = "VideoFileRenderer";

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* format and serves as a fallback for video sinks that can only handle I420, e.g. the internal
* WebRTC software encoders.
*/
@JNINamespace("webrtc::jni")
public class VideoFrame implements RefCounted {
/**
* Implements image storage medium. Might be for example an OpenGL texture or a memory region
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoFrameDrawer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* drawer.drawYuv depending on the type of the buffer. The frame will be rendered with rotation
* taken into account. You can supply an additional render matrix for custom transformations.
*/
@JNINamespace("webrtc::jni")
public class VideoFrameDrawer {
/**
* Draws a VideoFrame.TextureBuffer. Calls either drawer.drawOes or drawer.drawRgb
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* class also provides a createGui() method for creating a GUI-rendering window
* on various platforms.
*/
@JNINamespace("webrtc::jni")
public class VideoRenderer {
/**
* Java version of webrtc::VideoFrame. Frames are only constructed from native code and test
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
/**
* Java wrapper of native AndroidVideoTrackSource.
*/
@JNINamespace("webrtc::jni")
public class VideoSource extends MediaSource {
private final NativeCapturerObserver capturerObserver;

Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/VideoTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.List;

/** Java version of VideoTrackInterface. */
@JNINamespace("webrtc::jni")
public class VideoTrack extends MediaStreamTrack {
private final List<VideoRenderer> renderers = new ArrayList<>();
private final IdentityHashMap<VideoSink, Long> sinks = new IdentityHashMap<VideoSink, Long>();
Expand Down
1 change: 0 additions & 1 deletion sdk/android/api/org/webrtc/YuvHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.nio.ByteBuffer;

/** Wraps libyuv methods to Java. All passed byte buffers must be direct byte buffers. */
@JNINamespace("webrtc::jni")
public class YuvHelper {
/** Helper method for copying I420 to tightly packed destination buffer. */
public static void I420Copy(ByteBuffer srcY, int srcStrideY, ByteBuffer srcU, int srcStrideU,
Expand Down
2 changes: 0 additions & 2 deletions sdk/android/api/org/webrtc/audio/JavaAudioDeviceModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@

import android.media.AudioManager;
import android.content.Context;
import org.webrtc.JNINamespace;
import org.webrtc.JniCommon;
import org.webrtc.Logging;

/**
* AudioDeviceModule implemented using android.media.AudioRecord as input and
* android.media.AudioTrack as output.
*/
@JNINamespace("webrtc::jni")
public class JavaAudioDeviceModule implements AudioDeviceModule {
private static final String TAG = "JavaAudioDeviceModule";

Expand Down
Loading

0 comments on commit c7da266

Please sign in to comment.