Android JNI generation: Set JNI namespace in build files

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 <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23299}
This commit is contained in:
Magnus Jedvert
2018-05-18 12:13:56 +02:00
committed by Commit Bot
parent 7e6fcea7de
commit c7da266cb8
72 changed files with 131 additions and 240 deletions

View File

@ -19,7 +19,6 @@ package org.webrtc;
* Histogram.createCounts("WebRTC.Video.SomeMetric", 1, 10000, 50);
* someMetricHistogram.addSample(someVariable);
*/
@JNINamespace("webrtc::jni")
class Histogram {
private final long handle;

View File

@ -1,26 +0,0 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @JNINamespace is used by the JNI generator to create the necessary JNI
* bindings and expose this method to native code using the specified namespace.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface JNINamespace {
public String value();
}

View File

@ -13,7 +13,6 @@ package org.webrtc;
import java.nio.ByteBuffer;
/** Class with static JNI helper functions that are used in many places. */
@JNINamespace("webrtc::jni")
public class JniCommon {
/** Functions to increment/decrement an rtc::RefCountInterface pointer. */
public static native void nativeAddRef(long refCountedPointer);

View File

@ -13,7 +13,6 @@ package org.webrtc;
import java.nio.ByteBuffer;
import javax.annotation.Nullable;
@JNINamespace("webrtc::jni")
public class NV12Buffer implements VideoFrame.Buffer {
private final int width;
private final int height;

View File

@ -14,7 +14,6 @@ import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
@JNINamespace("webrtc::jni")
public class NV21Buffer implements VideoFrame.Buffer {
private final byte[] data;
private final int width;

View File

@ -16,7 +16,6 @@ import javax.annotation.Nullable;
* Implements VideoCapturer.CapturerObserver and feeds frames to
* webrtc::jni::AndroidVideoTrackSource.
*/
@JNINamespace("webrtc::jni")
class NativeCapturerObserver implements VideoCapturer.CapturerObserver {
// Pointer to webrtc::jni::AndroidVideoTrackSource.
private final long nativeSource;

View File

@ -1,31 +0,0 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @NativeClassQualifiedName is used by the JNI generator to create the necessary JNI
* bindings to call into the specified native class name.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface NativeClassQualifiedName {
/*
* Tells which native class the method is going to be bound to.
* The first parameter of the annotated method must be an int nativePtr pointing to
* an instance of this class.
*/
public String value();
}

View File

@ -10,7 +10,6 @@
package org.webrtc;
@JNINamespace("webrtc::jni")
class VP8Decoder extends WrappedNativeVideoDecoder {
@Override
long createNativeDecoder() {

View File

@ -10,7 +10,6 @@
package org.webrtc;
@JNINamespace("webrtc::jni")
class VP8Encoder extends WrappedNativeVideoEncoder {
@Override
long createNativeEncoder() {

View File

@ -10,7 +10,6 @@
package org.webrtc;
@JNINamespace("webrtc::jni")
class VP9Decoder extends WrappedNativeVideoDecoder {
@Override
long createNativeDecoder() {

View File

@ -10,7 +10,6 @@
package org.webrtc;
@JNINamespace("webrtc::jni")
class VP9Encoder extends WrappedNativeVideoEncoder {
@Override
long createNativeEncoder() {

View File

@ -22,7 +22,6 @@ class VideoDecoderWrapper {
Integer qp) -> nativeOnDecodedFrame(nativeDecoder, frame, decodeTimeMs, qp);
}
@NativeClassQualifiedName("webrtc::jni::VideoDecoderWrapper")
private static native void nativeOnDecodedFrame(
long nativeDecoder, VideoFrame frame, Integer decodeTimeMs, Integer qp);
long nativeVideoDecoderWrapper, VideoFrame frame, Integer decodeTimeMs, Integer qp);
}

View File

@ -44,8 +44,7 @@ class VideoEncoderWrapper {
frame.rotation, frame.completeFrame, frame.qp);
}
@NativeClassQualifiedName("webrtc::jni::VideoEncoderWrapper")
private static native void nativeOnEncodedFrame(long nativeEncoder, ByteBuffer buffer,
private static native void nativeOnEncodedFrame(long nativeVideoEncoderWrapper, ByteBuffer buffer,
int encodedWidth, int encodedHeight, long captureTimeNs, int frameType, int rotation,
boolean completeFrame, Integer qp);
}

View File

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import org.webrtc.CalledByNative;
import org.webrtc.Logging;
import org.webrtc.NativeClassQualifiedName;
import org.webrtc.ThreadUtils;
import org.webrtc.audio.JavaAudioDeviceModule.AudioRecordErrorCallback;
import org.webrtc.audio.JavaAudioDeviceModule.AudioRecordStartErrorCode;
@ -321,11 +320,9 @@ class WebRtcAudioRecord {
return (channels == 1 ? AudioFormat.CHANNEL_IN_MONO : AudioFormat.CHANNEL_IN_STEREO);
}
@NativeClassQualifiedName("webrtc::android_adm::AudioRecordJni")
private native void nativeCacheDirectBufferAddress(long nativeAudioRecord, ByteBuffer byteBuffer);
@NativeClassQualifiedName("webrtc::android_adm::AudioRecordJni")
private native void nativeDataIsRecorded(long nativeAudioRecord, int bytes);
private native void nativeCacheDirectBufferAddress(
long nativeAudioRecordJni, ByteBuffer byteBuffer);
private native void nativeDataIsRecorded(long nativeAudioRecordJni, int bytes);
// Sets all recorded samples to zero if |mute| is true, i.e., ensures that
// the microphone is muted.

View File

@ -26,7 +26,6 @@ import org.webrtc.ThreadUtils;
import org.webrtc.audio.JavaAudioDeviceModule.AudioTrackErrorCallback;
import org.webrtc.audio.JavaAudioDeviceModule.AudioTrackStartErrorCode;
import org.webrtc.CalledByNative;
import org.webrtc.NativeClassQualifiedName;
class WebRtcAudioTrack {
private static final String TAG = "WebRtcAudioTrackExternal";
@ -443,12 +442,9 @@ class WebRtcAudioTrack {
return (channels == 1 ? AudioFormat.CHANNEL_OUT_MONO : AudioFormat.CHANNEL_OUT_STEREO);
}
@NativeClassQualifiedName("webrtc::android_adm::AudioTrackJni")
private static native void nativeCacheDirectBufferAddress(
long nativeAudioRecord, ByteBuffer byteBuffer);
@NativeClassQualifiedName("webrtc::android_adm::AudioTrackJni")
private static native void nativeGetPlayoutData(long nativeAudioRecord, int bytes);
long nativeAudioTrackJni, ByteBuffer byteBuffer);
private static native void nativeGetPlayoutData(long nativeAudioTrackJni, int bytes);
// Sets all samples to be played out to zero if |mute| is true, i.e.,
// ensures that the speaker is muted.