Android: Generate JNI code for remaining classes in sdk/android
Bug: webrtc:8278
Change-Id: I20a4388ab347d8745d0edde808f7a0b610f077f9
Reviewed-on: https://webrtc-review.googlesource.com/31484
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21227}
diff --git a/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java b/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java
index 5330871..57682ab 100644
--- a/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java
+++ b/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java
@@ -28,7 +28,7 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-// Java-side of peerconnection_jni.cc:MediaCodecVideoDecoder.
+// Java-side of peerconnection.cc:MediaCodecVideoDecoder.
// This class is an implementation detail of the Java PeerConnection API.
@SuppressWarnings("deprecation")
public class MediaCodecVideoDecoder {
diff --git a/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java b/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
index 054930c..6b98598 100644
--- a/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
+++ b/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java
@@ -32,7 +32,7 @@
import org.webrtc.EglBase14;
import org.webrtc.VideoFrame;
-// Java-side of peerconnection_jni.cc:MediaCodecVideoEncoder.
+// Java-side of peerconnection.cc:MediaCodecVideoEncoder.
// This class is an implementation detail of the Java PeerConnection API.
@TargetApi(19)
@SuppressWarnings("deprecation")
@@ -658,7 +658,7 @@
if (dataV.capacity() < strideV * chromaHeight) {
throw new RuntimeException("V-plane buffer size too small.");
}
- fillNativeBuffer(
+ fillInputBufferNative(
nativeEncoder, bufferIndex, dataY, strideY, dataU, strideU, dataV, strideV);
i420Buffer.release();
// I420 consists of one full-resolution and two half-resolution planes.
@@ -993,6 +993,6 @@
}
/** Fills an inputBuffer with the given index with data from the byte buffers. */
- private static native void fillNativeBuffer(long nativeEncoder, int inputBuffer, ByteBuffer dataY,
- int strideY, ByteBuffer dataU, int strideU, ByteBuffer dataV, int strideV);
+ private static native void fillInputBufferNative(long nativeEncoder, int inputBuffer,
+ ByteBuffer dataY, int strideY, ByteBuffer dataU, int strideU, ByteBuffer dataV, int strideV);
}
diff --git a/sdk/android/api/org/webrtc/MediaSource.java b/sdk/android/api/org/webrtc/MediaSource.java
index a26e889..c0421f7 100644
--- a/sdk/android/api/org/webrtc/MediaSource.java
+++ b/sdk/android/api/org/webrtc/MediaSource.java
@@ -13,7 +13,17 @@
/** Java wrapper for a C++ MediaSourceInterface. */
public class MediaSource {
/** Tracks MediaSourceInterface.SourceState */
- public enum State { INITIALIZING, LIVE, ENDED, MUTED }
+ public enum State {
+ INITIALIZING,
+ LIVE,
+ ENDED,
+ MUTED;
+
+ @CalledByNative("State")
+ static State fromNativeIndex(int nativeIndex) {
+ return values()[nativeIndex];
+ }
+ }
final long nativeSource; // Package-protected for PeerConnectionFactory.
@@ -22,12 +32,12 @@
}
public State state() {
- return nativeState(nativeSource);
+ return getNativeState(nativeSource);
}
public void dispose() {
JniCommon.nativeReleaseRef(nativeSource);
}
- private static native State nativeState(long pointer);
+ private static native State getNativeState(long pointer);
}
diff --git a/sdk/android/api/org/webrtc/MediaStreamTrack.java b/sdk/android/api/org/webrtc/MediaStreamTrack.java
index b13ea9e..60149db 100644
--- a/sdk/android/api/org/webrtc/MediaStreamTrack.java
+++ b/sdk/android/api/org/webrtc/MediaStreamTrack.java
@@ -13,7 +13,15 @@
/** Java wrapper for a C++ MediaStreamTrackInterface. */
public class MediaStreamTrack {
/** Tracks MediaStreamTrackInterface.TrackState */
- public enum State { LIVE, ENDED }
+ public enum State {
+ LIVE,
+ ENDED;
+
+ @CalledByNative("State")
+ static State fromNativeIndex(int nativeIndex) {
+ return values()[nativeIndex];
+ }
+ }
// Must be kept in sync with cricket::MediaType.
public enum MediaType {
diff --git a/sdk/android/api/org/webrtc/Metrics.java b/sdk/android/api/org/webrtc/Metrics.java
index 010e839..1e18851 100644
--- a/sdk/android/api/org/webrtc/Metrics.java
+++ b/sdk/android/api/org/webrtc/Metrics.java
@@ -13,7 +13,7 @@
import java.util.HashMap;
import java.util.Map;
-// Java-side of androidmetrics_jni.cc.
+// Java-side of androidmetrics.cc
//
// Rtc histograms can be queried through the API, getAndReset().
// The returned map holds the name of a histogram and its samples.
diff --git a/sdk/android/api/org/webrtc/PeerConnection.java b/sdk/android/api/org/webrtc/PeerConnection.java
index 24425f0..7c4e91d 100644
--- a/sdk/android/api/org/webrtc/PeerConnection.java
+++ b/sdk/android/api/org/webrtc/PeerConnection.java
@@ -251,6 +251,41 @@
tlsAlpnProtocols, tlsEllipticCurves);
}
}
+
+ @CalledByNative("IceServer")
+ List<String> getUrls() {
+ return urls;
+ }
+
+ @CalledByNative("IceServer")
+ String getUsername() {
+ return username;
+ }
+
+ @CalledByNative("IceServer")
+ String getPassword() {
+ return password;
+ }
+
+ @CalledByNative("IceServer")
+ TlsCertPolicy getTlsCertPolicy() {
+ return tlsCertPolicy;
+ }
+
+ @CalledByNative("IceServer")
+ String getHostname() {
+ return hostname;
+ }
+
+ @CalledByNative("IceServer")
+ List<String> getTlsAlpnProtocols() {
+ return tlsAlpnProtocols;
+ }
+
+ @CalledByNative("IceServer")
+ List<String> getTlsEllipticCurves() {
+ return tlsEllipticCurves;
+ }
}
/** Java version of PeerConnectionInterface.IceTransportsType */
@@ -284,10 +319,12 @@
this.max = max;
}
+ @CalledByNative("IntervalRange")
public int getMin() {
return min;
}
+ @CalledByNative("IntervalRange")
public int getMax() {
return max;
}
@@ -347,6 +384,106 @@
maxIPv6Networks = 5;
iceRegatherIntervalRange = null;
}
+
+ @CalledByNative("RTCConfiguration")
+ IceTransportsType getIceTransportsType() {
+ return iceTransportsType;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ List<IceServer> getIceServers() {
+ return iceServers;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ BundlePolicy getBundlePolicy() {
+ return bundlePolicy;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ RtcpMuxPolicy getRtcpMuxPolicy() {
+ return rtcpMuxPolicy;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ TcpCandidatePolicy getTcpCandidatePolicy() {
+ return tcpCandidatePolicy;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ CandidateNetworkPolicy getCandidateNetworkPolicy() {
+ return candidateNetworkPolicy;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ int getAudioJitterBufferMaxPackets() {
+ return audioJitterBufferMaxPackets;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ boolean getAudioJitterBufferFastAccelerate() {
+ return audioJitterBufferFastAccelerate;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ int getIceConnectionReceivingTimeout() {
+ return iceConnectionReceivingTimeout;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ int getIceBackupCandidatePairPingInterval() {
+ return iceBackupCandidatePairPingInterval;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ KeyType getKeyType() {
+ return keyType;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ ContinualGatheringPolicy getContinualGatheringPolicy() {
+ return continualGatheringPolicy;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ int getIceCandidatePoolSize() {
+ return iceCandidatePoolSize;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ boolean getPruneTurnPorts() {
+ return pruneTurnPorts;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ boolean getPresumeWritableWhenFullyRelayed() {
+ return presumeWritableWhenFullyRelayed;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ Integer getIceCheckMinInterval() {
+ return iceCheckMinInterval;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ boolean getDisableIPv6OnWifi() {
+ return disableIPv6OnWifi;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ int getMaxIPv6Networks() {
+ return maxIPv6Networks;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ IntervalRange getIceRegatherIntervalRange() {
+ return iceRegatherIntervalRange;
+ }
+
+ @CalledByNative("RTCConfiguration")
+ TurnCustomizer getTurnCustomizer() {
+ return turnCustomizer;
+ }
};
private final List<MediaStream> localStreams = new ArrayList<>();
@@ -552,6 +689,11 @@
freeObserver(nativeObserver);
}
+ @CalledByNative
+ long getNativePeerConnection() {
+ return nativePeerConnection;
+ }
+
private static native void freeObserver(long nativeObserver);
private native boolean setNativeConfiguration(RTCConfiguration config, long nativeObserver);
diff --git a/sdk/android/api/org/webrtc/PeerConnectionFactory.java b/sdk/android/api/org/webrtc/PeerConnectionFactory.java
index cc1d83f..a7bf4c6 100644
--- a/sdk/android/api/org/webrtc/PeerConnectionFactory.java
+++ b/sdk/android/api/org/webrtc/PeerConnectionFactory.java
@@ -104,6 +104,21 @@
public int networkIgnoreMask;
public boolean disableEncryption;
public boolean disableNetworkMonitor;
+
+ @CalledByNative("Options")
+ int getNetworkIgnoreMask() {
+ return networkIgnoreMask;
+ }
+
+ @CalledByNative("Options")
+ boolean getDisableEncryption() {
+ return disableEncryption;
+ }
+
+ @CalledByNative("Options")
+ boolean getDisableNetworkMonitor() {
+ return disableNetworkMonitor;
+ }
}
/**
@@ -114,7 +129,7 @@
public static void initialize(InitializationOptions options) {
ContextUtils.initialize(options.applicationContext);
NativeLibrary.initialize(options.nativeLibraryLoader);
- nativeInitializeAndroidGlobals(options.applicationContext, options.enableVideoHwAcceleration);
+ initializeNativeAndroidGlobals(options.applicationContext, options.enableVideoHwAcceleration);
initializeFieldTrials(options.fieldTrials);
if (options.enableInternalTracer && !internalTracerInitialized) {
initializeInternalTracer();
@@ -131,17 +146,17 @@
// Must be called at least once before creating a PeerConnectionFactory
// (for example, at application startup time).
- private static native void nativeInitializeAndroidGlobals(
+ private static native void initializeNativeAndroidGlobals(
Context context, boolean videoHwAcceleration);
private static void initializeInternalTracer() {
internalTracerInitialized = true;
- nativeInitializeInternalTracer();
+ initializeNativeInternalTracer();
}
public static void shutdownInternalTracer() {
internalTracerInitialized = false;
- nativeShutdownInternalTracer();
+ shutdownNativeInternalTracer();
}
// Field trial initialization. Must be called before PeerConnectionFactory
@@ -156,16 +171,16 @@
// method2();
// }
public static String fieldTrialsFindFullName(String name) {
- return NativeLibrary.isLoaded() ? nativeFieldTrialsFindFullName(name) : "";
+ return NativeLibrary.isLoaded() ? findNativeFieldTrialsFullName(name) : "";
}
- private static native String nativeFieldTrialsFindFullName(String name);
+ private static native String findNativeFieldTrialsFullName(String name);
// Internal tracing initialization. Must be called before PeerConnectionFactory is created to
// prevent racing with tracing code.
// Deprecated, use PeerConnectionFactory.initialize instead.
- private static native void nativeInitializeInternalTracer();
+ private static native void initializeNativeInternalTracer();
// Internal tracing shutdown, called to prevent resource leaks. Must be called after
// PeerConnectionFactory is gone to prevent races with code performing tracing.
- private static native void nativeShutdownInternalTracer();
+ private static native void shutdownNativeInternalTracer();
// Start/stop internal capturing of internal tracing.
public static native boolean startInternalTracingCapture(String tracing_filename);
public static native void stopInternalTracingCapture();
@@ -184,7 +199,7 @@
public PeerConnectionFactory(
Options options, VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory) {
checkInitializeHasBeenCalled();
- nativeFactory = nativeCreatePeerConnectionFactory(options, encoderFactory, decoderFactory);
+ nativeFactory = createNativePeerConnectionFactory(options, encoderFactory, decoderFactory);
if (nativeFactory == 0) {
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
}
@@ -197,7 +212,7 @@
throw new NullPointerException(
"PeerConnectionFactory constructor does not accept a null AudioProcessingFactory.");
}
- nativeFactory = nativeCreatePeerConnectionFactoryWithAudioProcessing(
+ nativeFactory = createNativePeerConnectionFactoryWithAudioProcessing(
options, encoderFactory, decoderFactory, audioProcessingFactory.createNative());
if (nativeFactory == 0) {
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
@@ -206,12 +221,12 @@
public PeerConnection createPeerConnection(PeerConnection.RTCConfiguration rtcConfig,
MediaConstraints constraints, PeerConnection.Observer observer) {
- long nativeObserver = nativeCreateObserver(observer);
+ long nativeObserver = createNativeObserver(observer);
if (nativeObserver == 0) {
return null;
}
long nativePeerConnection =
- nativeCreatePeerConnection(nativeFactory, rtcConfig, constraints, nativeObserver);
+ createNativePeerConnection(nativeFactory, rtcConfig, constraints, nativeObserver);
if (nativePeerConnection == 0) {
return null;
}
@@ -225,7 +240,7 @@
}
public MediaStream createLocalMediaStream(String label) {
- return new MediaStream(nativeCreateLocalMediaStream(nativeFactory, label));
+ return new MediaStream(createNativeLocalMediaStream(nativeFactory, label));
}
public VideoSource createVideoSource(VideoCapturer capturer) {
@@ -234,7 +249,7 @@
final SurfaceTextureHelper surfaceTextureHelper =
SurfaceTextureHelper.create(VIDEO_CAPTURER_THREAD_NAME, eglContext);
long nativeAndroidVideoTrackSource =
- nativeCreateVideoSource(nativeFactory, surfaceTextureHelper, capturer.isScreencast());
+ createNativeVideoSource(nativeFactory, surfaceTextureHelper, capturer.isScreencast());
VideoCapturer.CapturerObserver capturerObserver =
new AndroidVideoTrackSourceObserver(nativeAndroidVideoTrackSource);
capturer.initialize(
@@ -243,33 +258,33 @@
}
public VideoTrack createVideoTrack(String id, VideoSource source) {
- return new VideoTrack(nativeCreateVideoTrack(nativeFactory, id, source.nativeSource));
+ return new VideoTrack(createNativeVideoTrack(nativeFactory, id, source.nativeSource));
}
public AudioSource createAudioSource(MediaConstraints constraints) {
- return new AudioSource(nativeCreateAudioSource(nativeFactory, constraints));
+ return new AudioSource(createNativeAudioSource(nativeFactory, constraints));
}
public AudioTrack createAudioTrack(String id, AudioSource source) {
- return new AudioTrack(nativeCreateAudioTrack(nativeFactory, id, source.nativeSource));
+ return new AudioTrack(createNativeAudioTrack(nativeFactory, id, source.nativeSource));
}
// Starts recording an AEC dump. Ownership of the file is transfered to the
// native code. If an AEC dump is already in progress, it will be stopped and
// a new one will start using the provided file.
public boolean startAecDump(int file_descriptor, int filesize_limit_bytes) {
- return nativeStartAecDump(nativeFactory, file_descriptor, filesize_limit_bytes);
+ return startNativeAecDump(nativeFactory, file_descriptor, filesize_limit_bytes);
}
// Stops recording an AEC dump. If no AEC dump is currently being recorded,
// this call will have no effect.
public void stopAecDump() {
- nativeStopAecDump(nativeFactory);
+ stopNativeAecDump(nativeFactory);
}
@Deprecated
public void setOptions(Options options) {
- nativeSetOptions(nativeFactory, options);
+ setNativeOptions(nativeFactory, options);
}
/** Set the EGL context used by HW Video encoding and decoding.
@@ -290,12 +305,12 @@
}
localEglbase = EglBase.create(localEglContext);
remoteEglbase = EglBase.create(remoteEglContext);
- nativeSetVideoHwAccelerationOptions(
+ setNativeVideoHwAccelerationOptions(
nativeFactory, localEglbase.getEglBaseContext(), remoteEglbase.getEglBaseContext());
}
public void dispose() {
- nativeFreeFactory(nativeFactory);
+ freeNativeFactory(nativeFactory);
networkThread = null;
workerThread = null;
signalingThread = null;
@@ -306,7 +321,7 @@
}
public void threadsCallbacks() {
- nativeThreadsCallbacks(nativeFactory);
+ invokeNativeThreadsCallbacks(nativeFactory);
}
private static void printStackTrace(Thread thread, String threadName) {
@@ -327,58 +342,66 @@
printStackTrace(signalingThread, "Signaling thread");
}
+ @CalledByNative
private static void onNetworkThreadReady() {
networkThread = Thread.currentThread();
Logging.d(TAG, "onNetworkThreadReady");
}
+ @CalledByNative
private static void onWorkerThreadReady() {
workerThread = Thread.currentThread();
Logging.d(TAG, "onWorkerThreadReady");
}
+ @CalledByNative
private static void onSignalingThreadReady() {
signalingThread = Thread.currentThread();
Logging.d(TAG, "onSignalingThreadReady");
}
- private static native long nativeCreatePeerConnectionFactory(
+ private static native long createNativePeerConnectionFactory(
Options options, VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory);
- private static native long nativeCreatePeerConnectionFactoryWithAudioProcessing(Options options,
+ private static native long createNativePeerConnectionFactoryWithAudioProcessing(Options options,
VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory,
long nativeAudioProcessor);
- private static native long nativeCreateObserver(PeerConnection.Observer observer);
+ private static native long createNativeObserver(PeerConnection.Observer observer);
- private static native long nativeCreatePeerConnection(long nativeFactory,
+ private static native long createNativePeerConnection(long nativeFactory,
PeerConnection.RTCConfiguration rtcConfig, MediaConstraints constraints, long nativeObserver);
- private static native long nativeCreateLocalMediaStream(long nativeFactory, String label);
+ private static native long createNativeLocalMediaStream(long nativeFactory, String label);
- private static native long nativeCreateVideoSource(
+ private static native long createNativeVideoSource(
long nativeFactory, SurfaceTextureHelper surfaceTextureHelper, boolean is_screencast);
- private static native long nativeCreateVideoTrack(
+ private static native long createNativeVideoTrack(
long nativeFactory, String id, long nativeVideoSource);
- private static native long nativeCreateAudioSource(
+ private static native long createNativeAudioSource(
long nativeFactory, MediaConstraints constraints);
- private static native long nativeCreateAudioTrack(
+ private static native long createNativeAudioTrack(
long nativeFactory, String id, long nativeSource);
- private static native boolean nativeStartAecDump(
+ private static native boolean startNativeAecDump(
long nativeFactory, int file_descriptor, int filesize_limit_bytes);
- private static native void nativeStopAecDump(long nativeFactory);
+ private static native void stopNativeAecDump(long nativeFactory);
- @Deprecated public native void nativeSetOptions(long nativeFactory, Options options);
+ @Deprecated
+ public void nativeSetOptions(long nativeFactory, Options options) {
+ setNativeOptions(nativeFactory, options);
+ }
- private static native void nativeSetVideoHwAccelerationOptions(
+ private native void setNativeOptions(long nativeFactory, Options options);
+
+ private static native void setNativeVideoHwAccelerationOptions(
long nativeFactory, Object localEGLContext, Object remoteEGLContext);
- private static native void nativeThreadsCallbacks(long nativeFactory);
+ private static native void invokeNativeThreadsCallbacks(long nativeFactory);
- private static native void nativeFreeFactory(long nativeFactory);
+ private static native void freeNativeFactory(long nativeFactory);
}
diff --git a/sdk/android/api/org/webrtc/RtpParameters.java b/sdk/android/api/org/webrtc/RtpParameters.java
index f1cca9d..28ce6aa 100644
--- a/sdk/android/api/org/webrtc/RtpParameters.java
+++ b/sdk/android/api/org/webrtc/RtpParameters.java
@@ -12,6 +12,7 @@
import java.util.List;
import java.util.ArrayList;
+import org.webrtc.MediaStreamTrack;
/**
* The parameters for an {@code RtpSender}, as defined in
@@ -34,6 +35,28 @@
// SSRC to be used by this encoding.
// Can't be changed between getParameters/setParameters.
public Long ssrc;
+
+ @CalledByNative("Encoding")
+ Encoding(boolean active, Integer maxBitrateBps, Long ssrc) {
+ this.active = active;
+ this.maxBitrateBps = maxBitrateBps;
+ this.ssrc = ssrc;
+ }
+
+ @CalledByNative("Encoding")
+ boolean getActive() {
+ return active;
+ }
+
+ @CalledByNative("Encoding")
+ Integer getMaxBitrateBps() {
+ return maxBitrateBps;
+ }
+
+ @CalledByNative("Encoding")
+ Long getSsrc() {
+ return ssrc;
+ }
}
public static class Codec {
@@ -47,11 +70,67 @@
public Integer clockRate;
// The number of audio channels used. Set to null for video codecs.
public Integer numChannels;
+
+ @CalledByNative("Codec")
+ Codec(int payloadType, String name, MediaStreamTrack.MediaType kind, Integer clockRate,
+ Integer numChannels) {
+ this.payloadType = payloadType;
+ this.name = name;
+ this.kind = kind;
+ this.clockRate = clockRate;
+ this.numChannels = numChannels;
+ }
+
+ @CalledByNative("Codec")
+ int getPayloadType() {
+ return payloadType;
+ }
+
+ @CalledByNative("Codec")
+ String getName() {
+ return name;
+ }
+
+ @CalledByNative("Codec")
+ MediaStreamTrack.MediaType getKind() {
+ return kind;
+ }
+
+ @CalledByNative("Codec")
+ Integer getClockRate() {
+ return clockRate;
+ }
+
+ @CalledByNative("Codec")
+ Integer getNumChannels() {
+ return numChannels;
+ }
}
- public final List<Encoding> encodings = new ArrayList<>();
+ public final List<Encoding> encodings;
// Codec parameters can't currently be changed between getParameters and
// setParameters. Though in the future it will be possible to reorder them or
// remove them.
- public final List<Codec> codecs = new ArrayList<>();
+ public final List<Codec> codecs;
+
+ public RtpParameters() {
+ this.encodings = new ArrayList<>();
+ this.codecs = new ArrayList<>();
+ }
+
+ @CalledByNative
+ RtpParameters(List<Encoding> encodings, List<Codec> codecs) {
+ this.encodings = encodings;
+ this.codecs = codecs;
+ }
+
+ @CalledByNative
+ List<Encoding> getEncodings() {
+ return encodings;
+ }
+
+ @CalledByNative
+ List<Codec> getCodecs() {
+ return codecs;
+ }
}
diff --git a/sdk/android/api/org/webrtc/SdpObserver.java b/sdk/android/api/org/webrtc/SdpObserver.java
index a9c03f7..afa99bc 100644
--- a/sdk/android/api/org/webrtc/SdpObserver.java
+++ b/sdk/android/api/org/webrtc/SdpObserver.java
@@ -13,14 +13,14 @@
/** Interface for observing SDP-related events. */
public interface SdpObserver {
/** Called on success of Create{Offer,Answer}(). */
- public void onCreateSuccess(SessionDescription sdp);
+ @CalledByNative void onCreateSuccess(SessionDescription sdp);
/** Called on success of Set{Local,Remote}Description(). */
- public void onSetSuccess();
+ @CalledByNative void onSetSuccess();
/** Called on error of Create{Offer,Answer}(). */
- public void onCreateFailure(String error);
+ @CalledByNative void onCreateFailure(String error);
/** Called on error of Set{Local,Remote}Description(). */
- public void onSetFailure(String error);
+ @CalledByNative void onSetFailure(String error);
}
diff --git a/sdk/android/api/org/webrtc/SessionDescription.java b/sdk/android/api/org/webrtc/SessionDescription.java
index 7367085..62601f0 100644
--- a/sdk/android/api/org/webrtc/SessionDescription.java
+++ b/sdk/android/api/org/webrtc/SessionDescription.java
@@ -28,6 +28,7 @@
return name().toLowerCase(Locale.US);
}
+ @CalledByNative("Type")
public static Type fromCanonicalForm(String canonical) {
return Type.valueOf(Type.class, canonical.toUpperCase(Locale.US));
}
@@ -36,8 +37,19 @@
public final Type type;
public final String description;
+ @CalledByNative
public SessionDescription(Type type, String description) {
this.type = type;
this.description = description;
}
+
+ @CalledByNative
+ String getDescription() {
+ return description;
+ }
+
+ @CalledByNative
+ String getTypeInCanonicalForm() {
+ return type.canonicalForm();
+ }
}
diff --git a/sdk/android/api/org/webrtc/SurfaceTextureHelper.java b/sdk/android/api/org/webrtc/SurfaceTextureHelper.java
index fc5eb37..3aaa4e2 100644
--- a/sdk/android/api/org/webrtc/SurfaceTextureHelper.java
+++ b/sdk/android/api/org/webrtc/SurfaceTextureHelper.java
@@ -234,6 +234,7 @@
/** Deprecated, use textureToYuv. */
@Deprecated
@SuppressWarnings("deprecation") // yuvConverter.convert is deprecated
+ @CalledByNative
void textureToYUV(final ByteBuffer buf, final int width, final int height, final int stride,
final int textureId, final float[] transformMatrix) {
if (textureId != oesTextureId) {
diff --git a/sdk/android/api/org/webrtc/TurnCustomizer.java b/sdk/android/api/org/webrtc/TurnCustomizer.java
index 7c68bd1..f2cdcb1 100644
--- a/sdk/android/api/org/webrtc/TurnCustomizer.java
+++ b/sdk/android/api/org/webrtc/TurnCustomizer.java
@@ -19,9 +19,13 @@
}
public void dispose() {
- nativeFreeTurnCustomizer(nativeTurnCustomizer);
+ freeNativeTurnCustomizer(nativeTurnCustomizer);
}
- private static native void nativeFreeTurnCustomizer(
- long nativeTurnCustomizer);
+ private static native void freeNativeTurnCustomizer(long nativeTurnCustomizer);
+
+ @CalledByNative
+ long getNativeTurnCustomizer() {
+ return nativeTurnCustomizer;
+ }
}
diff --git a/sdk/android/api/org/webrtc/VideoCodecInfo.java b/sdk/android/api/org/webrtc/VideoCodecInfo.java
index 9f52cf2..f1f1145 100644
--- a/sdk/android/api/org/webrtc/VideoCodecInfo.java
+++ b/sdk/android/api/org/webrtc/VideoCodecInfo.java
@@ -35,6 +35,7 @@
public final Map<String, String> params;
@Deprecated public final int payload;
+ @CalledByNative
public VideoCodecInfo(String name, Map<String, String> params) {
this.payload = 0;
this.name = name;
@@ -66,4 +67,14 @@
Object[] values = {name.toUpperCase(Locale.ROOT), params};
return Arrays.hashCode(values);
}
+
+ @CalledByNative
+ String getName() {
+ return name;
+ }
+
+ @CalledByNative
+ Map getParams() {
+ return params;
+ }
}
diff --git a/sdk/android/api/org/webrtc/VideoDecoderFactory.java b/sdk/android/api/org/webrtc/VideoDecoderFactory.java
index 1c01503..9979e6c 100644
--- a/sdk/android/api/org/webrtc/VideoDecoderFactory.java
+++ b/sdk/android/api/org/webrtc/VideoDecoderFactory.java
@@ -16,5 +16,5 @@
* Creates a VideoDecoder for the given codec. Supports the same codecs supported by
* VideoEncoderFactory.
*/
- public VideoDecoder createDecoder(String codecType);
+ @CalledByNative VideoDecoder createDecoder(String codecType);
}
diff --git a/sdk/android/api/org/webrtc/VideoFrameDrawer.java b/sdk/android/api/org/webrtc/VideoFrameDrawer.java
index 491fd05..3d3125e 100644
--- a/sdk/android/api/org/webrtc/VideoFrameDrawer.java
+++ b/sdk/android/api/org/webrtc/VideoFrameDrawer.java
@@ -95,7 +95,7 @@
// Input is packed already.
packedByteBuffer = planes[i];
} else {
- VideoRenderer.nativeCopyPlane(
+ VideoRenderer.copyPlaneNative(
planes[i], planeWidths[i], planeHeights[i], strides[i], copyBuffer, planeWidths[i]);
packedByteBuffer = copyBuffer;
}
diff --git a/sdk/android/api/org/webrtc/VideoRenderer.java b/sdk/android/api/org/webrtc/VideoRenderer.java
index 182093c..8301c10 100644
--- a/sdk/android/api/org/webrtc/VideoRenderer.java
+++ b/sdk/android/api/org/webrtc/VideoRenderer.java
@@ -11,6 +11,7 @@
package org.webrtc;
import java.nio.ByteBuffer;
+import org.webrtc.VideoFrame;
/**
* Java version of VideoSinkInterface. In addition to allowing clients to
@@ -92,6 +93,7 @@
/**
* Construct a frame from VideoFrame.Buffer.
*/
+ @CalledByNative("I420Frame")
public I420Frame(int rotationDegree, VideoFrame.Buffer buffer, long nativeFramePointer) {
this.width = buffer.getWidth();
this.height = buffer.getHeight();
@@ -174,10 +176,25 @@
}
return new VideoFrame(buffer, rotationDegree, 0 /* timestampNs */);
}
+
+ @CalledByNative("I420Frame")
+ static I420Frame createI420Frame(int width, int height, int rotationDegree, int y_stride,
+ ByteBuffer y_buffer, int u_stride, ByteBuffer u_buffer, int v_stride, ByteBuffer v_buffer,
+ long nativeFramePointer) {
+ return new I420Frame(width, height, rotationDegree, new int[] {y_stride, u_stride, v_stride},
+ new ByteBuffer[] {y_buffer, u_buffer, v_buffer}, nativeFramePointer);
+ }
+
+ @CalledByNative("I420Frame")
+ static I420Frame createTextureFrame(int width, int height, int rotationDegree, int textureId,
+ float[] samplingMatrix, long nativeFramePointer) {
+ return new I420Frame(
+ width, height, rotationDegree, textureId, samplingMatrix, nativeFramePointer);
+ }
}
// Helper native function to do a video frame plane copying.
- public static native void nativeCopyPlane(
+ static native void copyPlaneNative(
ByteBuffer src, int width, int height, int srcStride, ByteBuffer dst, int dstStride);
/** The real meat of VideoSinkInterface. */
@@ -186,7 +203,7 @@
// should handle that by applying rotation during rendering. The callee
// is responsible for signaling when it is done with |frame| by calling
// renderFrameDone(frame).
- public void renderFrame(I420Frame frame);
+ @CalledByNative("Callbacks") void renderFrame(I420Frame frame);
}
/**
@@ -204,7 +221,7 @@
long nativeVideoRenderer;
public VideoRenderer(Callbacks callbacks) {
- nativeVideoRenderer = nativeWrapVideoRenderer(callbacks);
+ nativeVideoRenderer = createNativeVideoRenderer(callbacks);
}
public void dispose() {
@@ -217,7 +234,7 @@
nativeVideoRenderer = 0;
}
- private static native long nativeWrapVideoRenderer(Callbacks callbacks);
+ private static native long createNativeVideoRenderer(Callbacks callbacks);
private static native void freeWrappedVideoRenderer(long nativeVideoRenderer);
private static native void releaseNativeFrame(long nativeFramePointer);
}