Annotate libjingle_peerconnection_java with @Nullable.

Bug: webrtc:8881
Change-Id: Ida2ef6c003567d19529c21629c916ed40e8de3a6
Reviewed-on: https://webrtc-review.googlesource.com/63380
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22563}
This commit is contained in:
Sami Kalliomäki
2018-03-22 13:32:44 +01:00
committed by Commit Bot
parent 12d6a49e97
commit e7592d8d5f
47 changed files with 277 additions and 170 deletions

View File

@ -12,6 +12,7 @@ package org.webrtc;
import android.content.Context;
import android.media.MediaRecorder;
import javax.annotation.Nullable;
public class Camera1Capturer extends CameraCapturer {
private final boolean captureToTexture;
@ -26,8 +27,8 @@ public class Camera1Capturer extends CameraCapturer {
@Override
protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback,
CameraSession.Events events, Context applicationContext,
SurfaceTextureHelper surfaceTextureHelper, MediaRecorder mediaRecorder, String cameraName,
int width, int height, int framerate) {
SurfaceTextureHelper surfaceTextureHelper, @Nullable MediaRecorder mediaRecorder,
String cameraName, int width, int height, int framerate) {
Camera1Session.create(createSessionCallback, events,
captureToTexture || (mediaRecorder != null), applicationContext, surfaceTextureHelper,
mediaRecorder, Camera1Enumerator.getCameraIndex(cameraName), width, height, framerate);

View File

@ -13,6 +13,7 @@ package org.webrtc;
import android.os.SystemClock;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
@SuppressWarnings("deprecation")
@ -73,7 +74,7 @@ public class Camera1Enumerator implements CameraEnumerator {
return new Camera1Capturer(deviceName, eventsHandler, captureToTexture);
}
private static android.hardware.Camera.CameraInfo getCameraInfo(int index) {
private static @Nullable android.hardware.Camera.CameraInfo getCameraInfo(int index) {
android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
try {
android.hardware.Camera.getCameraInfo(index, info);
@ -171,7 +172,7 @@ public class Camera1Enumerator implements CameraEnumerator {
// Returns the name of the camera with camera index. Returns null if the
// camera can not be used.
static String getDeviceName(int index) {
static @Nullable String getDeviceName(int index) {
android.hardware.Camera.CameraInfo info = getCameraInfo(index);
if (info == null) {
return null;

View File

@ -14,11 +14,12 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.hardware.camera2.CameraManager;
import android.media.MediaRecorder;
import javax.annotation.Nullable;
@TargetApi(21)
public class Camera2Capturer extends CameraCapturer {
private final Context context;
private final CameraManager cameraManager;
@Nullable private final CameraManager cameraManager;
public Camera2Capturer(Context context, String cameraName, CameraEventsHandler eventsHandler) {
super(cameraName, eventsHandler, new Camera2Enumerator(context));

View File

@ -10,8 +10,6 @@
package org.webrtc;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Rect;
@ -24,11 +22,12 @@ import android.os.Build;
import android.os.SystemClock;
import android.util.AndroidException;
import android.util.Range;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
@TargetApi(21)
public class Camera2Enumerator implements CameraEnumerator {
@ -41,7 +40,7 @@ public class Camera2Enumerator implements CameraEnumerator {
new HashMap<String, List<CaptureFormat>>();
final Context context;
final CameraManager cameraManager;
@Nullable final CameraManager cameraManager;
public Camera2Enumerator(Context context) {
this.context = context;
@ -90,7 +89,7 @@ public class Camera2Enumerator implements CameraEnumerator {
return new Camera2Capturer(context, deviceName, eventsHandler);
}
private CameraCharacteristics getCameraCharacteristics(String deviceName) {
private @Nullable CameraCharacteristics getCameraCharacteristics(String deviceName) {
try {
return cameraManager.getCameraCharacteristics(deviceName);
// On Android OS pre 4.4.2, a class will not load because of VerifyError if it contains a

View File

@ -11,6 +11,7 @@
package org.webrtc;
import android.media.MediaRecorder;
import javax.annotation.Nullable;
/**
* Base interface for camera1 and camera2 implementations. Extends VideoCapturer with a

View File

@ -10,6 +10,8 @@
package org.webrtc;
import javax.annotation.Nullable;
public class DefaultVideoDecoderFactory implements VideoDecoderFactory {
private final HardwareVideoDecoderFactory hardwareVideoDecoderFactory;
private final SoftwareVideoDecoderFactory softwareVideoDecoderFactory;
@ -21,7 +23,7 @@ public class DefaultVideoDecoderFactory implements VideoDecoderFactory {
}
@Override
public VideoDecoder createDecoder(String codecType) {
public @Nullable VideoDecoder createDecoder(String codecType) {
VideoDecoder decoder = hardwareVideoDecoderFactory.createDecoder(codecType);
if (decoder != null) {
return decoder;

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
@ -31,6 +32,7 @@ public class DefaultVideoEncoderFactory implements VideoEncoderFactory {
softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory();
}
@Nullable
@Override
public VideoEncoder createEncoder(VideoCodecInfo info) {
final VideoEncoder videoEncoder = hardwareVideoEncoderFactory.createEncoder(info);

View File

@ -11,6 +11,7 @@
package org.webrtc;
import android.graphics.SurfaceTexture;
import javax.annotation.Nullable;
import android.view.Surface;
import javax.microedition.khronos.egl.EGL10;
@ -84,7 +85,7 @@ public interface EglBase {
* If |sharedContext| is null, a root context is created. This function will try to create an EGL
* 1.4 context if possible, and an EGL 1.0 context otherwise.
*/
public static EglBase create(Context sharedContext, int[] configAttributes) {
public static EglBase create(@Nullable Context sharedContext, int[] configAttributes) {
return (EglBase14.isEGL14Supported()
&& (sharedContext == null || sharedContext instanceof EglBase14.Context))
? new EglBase14((EglBase14.Context) sharedContext, configAttributes)

View File

@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
/**
* Implements org.webrtc.VideoRenderer.Callbacks by displaying the video stream on an EGL Surface.
@ -84,7 +85,7 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
// |renderThreadHandler| is a handler for communicating with |renderThread|, and is synchronized
// on |handlerLock|.
private final Object handlerLock = new Object();
private Handler renderThreadHandler;
@Nullable private Handler renderThreadHandler;
private final ArrayList<FrameListenerAndParams> frameListeners = new ArrayList<>();
@ -98,14 +99,14 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
// EGL and GL resources for drawing YUV/OES textures. After initilization, these are only accessed
// from the render thread.
private EglBase eglBase;
@Nullable private EglBase eglBase;
private final VideoFrameDrawer frameDrawer = new VideoFrameDrawer();
private RendererCommon.GlDrawer drawer;
@Nullable private RendererCommon.GlDrawer drawer;
private final Matrix drawMatrix = new Matrix();
// Pending frame to render. Serves as a queue with size 1. Synchronized on |frameLock|.
private final Object frameLock = new Object();
private VideoFrame pendingFrame;
@Nullable private VideoFrame pendingFrame;
// These variables are synchronized on |layoutLock|.
private final Object layoutLock = new Object();
@ -130,7 +131,7 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
private long renderSwapBufferTimeNs;
// Used for bitmap capturing.
private GlTextureFrameBuffer bitmapTextureFramebuffer;
@Nullable private GlTextureFrameBuffer bitmapTextureFramebuffer;
private final Runnable logStatisticsRunnable = new Runnable() {
@Override
@ -162,7 +163,7 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
* |drawer|. It is allowed to call init() to reinitialize the renderer after a previous
* init()/release() cycle.
*/
public void init(final EglBase.Context sharedContext, final int[] configAttributes,
public void init(@Nullable final EglBase.Context sharedContext, final int[] configAttributes,
RendererCommon.GlDrawer drawer) {
synchronized (handlerLock) {
if (renderThreadHandler != null) {
@ -385,7 +386,7 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink {
* FPS reduction.
*/
public void addFrameListener(final FrameListener listener, final float scale,
final RendererCommon.GlDrawer drawerParam, final boolean applyFpsReduction) {
@Nullable final RendererCommon.GlDrawer drawerParam, final boolean applyFpsReduction) {
postToRenderThread(() -> {
final RendererCommon.GlDrawer listenerDrawer = drawerParam == null ? drawer : drawerParam;
frameListeners.add(

View File

@ -19,6 +19,7 @@ import android.media.MediaCodecInfo;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecList;
import android.os.Build;
import javax.annotation.Nullable;
/** Factory for Android hardware VideoDecoders. */
@SuppressWarnings("deprecation") // API level 16 requires use of deprecated methods.
@ -47,6 +48,7 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory {
this.fallbackToSoftware = fallbackToSoftware;
}
@Nullable
@Override
public VideoDecoder createDecoder(String codecType) {
VideoCodecType type = VideoCodecType.valueOf(codecType);
@ -70,7 +72,7 @@ public class HardwareVideoDecoderFactory implements VideoDecoderFactory {
sharedContext);
}
private MediaCodecInfo findCodecForType(VideoCodecType type) {
private @Nullable MediaCodecInfo findCodecForType(VideoCodecType type) {
// HW decoding is not supported on builds before KITKAT.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return null;

View File

@ -22,6 +22,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
/** Factory for android hardware video encoders. */
@SuppressWarnings("deprecation") // API 16 requires the use of deprecated methods.
@ -40,7 +41,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
private static final List<String> H264_HW_EXCEPTION_MODELS =
Arrays.asList("SAMSUNG-SGH-I337", "Nexus 7", "Nexus 4");
private final EglBase14.Context sharedContext;
@Nullable private final EglBase14.Context sharedContext;
private final boolean enableIntelVp8Encoder;
private final boolean enableH264HighProfile;
private final boolean fallbackToSoftware;
@ -70,6 +71,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
this(null, enableIntelVp8Encoder, enableH264HighProfile);
}
@Nullable
@Override
public VideoEncoder createEncoder(VideoCodecInfo input) {
VideoCodecType type = VideoCodecType.valueOf(input.name);
@ -141,7 +143,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
}
private MediaCodecInfo findCodecForType(VideoCodecType type) {
private @Nullable MediaCodecInfo findCodecForType(VideoCodecType type) {
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
MediaCodecInfo info = null;
try {

View File

@ -10,6 +10,7 @@
package org.webrtc;
import android.graphics.SurfaceTexture;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaCodecInfo.CodecCapabilities;
@ -28,6 +29,7 @@ import java.util.Queue;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
// Java-side of peerconnection.cc:MediaCodecVideoDecoder.
// This class is an implementation detail of the Java PeerConnection API.
@ -69,14 +71,14 @@ public class MediaCodecVideoDecoder {
private static final int MAX_QUEUED_OUTPUTBUFFERS = 3;
// Active running decoder instance. Set in initDecode() (called from native code)
// and reset to null in release() call.
private static MediaCodecVideoDecoder runningInstance = null;
private static MediaCodecVideoDecoderErrorCallback errorCallback = null;
@Nullable private static MediaCodecVideoDecoder runningInstance = null;
@Nullable private static MediaCodecVideoDecoderErrorCallback errorCallback = null;
private static int codecErrors = 0;
// List of disabled codec types - can be set from application.
private static Set<String> hwDecoderDisabledTypes = new HashSet<String>();
private Thread mediaCodecThread;
private MediaCodec mediaCodec;
@Nullable private Thread mediaCodecThread;
@Nullable private MediaCodec mediaCodec;
private ByteBuffer[] inputBuffers;
private ByteBuffer[] outputBuffers;
private static final String VP8_MIME_TYPE = "video/x-vnd.on2.vp8";
@ -139,9 +141,9 @@ public class MediaCodecVideoDecoder {
private boolean useSurface;
// The below variables are only used when decoding to a Surface.
private TextureListener textureListener;
@Nullable private TextureListener textureListener;
private int droppedFrames;
private Surface surface = null;
@Nullable private Surface surface = null;
private final Queue<DecodedOutputBuffer> dequeuedSurfaceOutputBuffers =
new ArrayDeque<DecodedOutputBuffer>();
@ -242,7 +244,8 @@ public class MediaCodecVideoDecoder {
public final int colorFormat; // Color format supported by codec.
}
private static DecoderProperties findDecoder(String mime, String[] supportedCodecPrefixes) {
private static @Nullable DecoderProperties findDecoder(
String mime, String[] supportedCodecPrefixes) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return null; // MediaCodec.setParameters is missing.
}
@ -319,8 +322,8 @@ public class MediaCodecVideoDecoder {
// Pass null in |surfaceTextureHelper| to configure the codec for ByteBuffer output.
@CalledByNativeUnchecked
private boolean initDecode(
VideoCodecType type, int width, int height, SurfaceTextureHelper surfaceTextureHelper) {
private boolean initDecode(VideoCodecType type, int width, int height,
@Nullable SurfaceTextureHelper surfaceTextureHelper) {
if (mediaCodecThread != null) {
throw new RuntimeException("initDecode: Forgot to release()?");
}
@ -356,7 +359,7 @@ public class MediaCodecVideoDecoder {
stride = width;
sliceHeight = height;
if (useSurface) {
if (useSurface && surfaceTextureHelper != null) {
textureListener = new TextureListener(surfaceTextureHelper);
surface = new Surface(surfaceTextureHelper.getSurfaceTexture());
}
@ -638,8 +641,8 @@ public class MediaCodecVideoDecoder {
private final Object newFrameLock = new Object();
// |bufferToRender| is non-null when waiting for transition between addBufferToRender() to
// onTextureFrameAvailable().
private DecodedOutputBuffer bufferToRender;
private DecodedTextureBuffer renderedBuffer;
@Nullable private DecodedOutputBuffer bufferToRender;
@Nullable private DecodedTextureBuffer renderedBuffer;
public TextureListener(SurfaceTextureHelper surfaceTextureHelper) {
this.surfaceTextureHelper = surfaceTextureHelper;
@ -681,6 +684,7 @@ public class MediaCodecVideoDecoder {
}
// Dequeues and returns a DecodedTextureBuffer if available, or null otherwise.
@Nullable
@SuppressWarnings("WaitNotInLoop")
public DecodedTextureBuffer dequeueTextureBuffer(int timeoutMs) {
synchronized (newFrameLock) {
@ -717,7 +721,7 @@ public class MediaCodecVideoDecoder {
// unsupported format, or if |mediaCodec| is not in the Executing state. Throws CodecException
// upon codec error.
@CalledByNativeUnchecked
private DecodedOutputBuffer dequeueOutputBuffer(int dequeueTimeoutMs) {
private @Nullable DecodedOutputBuffer dequeueOutputBuffer(int dequeueTimeoutMs) {
checkOnMediaCodecThread();
if (decodeStartTimeMs.isEmpty()) {
return null;
@ -801,7 +805,7 @@ public class MediaCodecVideoDecoder {
// upon codec error. If |dequeueTimeoutMs| > 0, the oldest decoded frame will be dropped if
// a frame can't be returned.
@CalledByNativeUnchecked
private DecodedTextureBuffer dequeueTextureBuffer(int dequeueTimeoutMs) {
private @Nullable DecodedTextureBuffer dequeueTextureBuffer(int dequeueTimeoutMs) {
checkOnMediaCodecThread();
if (!useSurface) {
throw new IllegalStateException("dequeueTexture() called for byte buffer decoding.");

View File

@ -29,6 +29,7 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import org.webrtc.EglBase14;
import org.webrtc.VideoFrame;
@ -73,21 +74,21 @@ public class MediaCodecVideoEncoder {
// Active running encoder instance. Set in initEncode() (called from native code)
// and reset to null in release() call.
private static MediaCodecVideoEncoder runningInstance = null;
private static MediaCodecVideoEncoderErrorCallback errorCallback = null;
@Nullable private static MediaCodecVideoEncoder runningInstance = null;
@Nullable private static MediaCodecVideoEncoderErrorCallback errorCallback = null;
private static int codecErrors = 0;
// List of disabled codec types - can be set from application.
private static Set<String> hwEncoderDisabledTypes = new HashSet<String>();
private Thread mediaCodecThread;
private MediaCodec mediaCodec;
@Nullable private Thread mediaCodecThread;
@Nullable private MediaCodec mediaCodec;
private ByteBuffer[] outputBuffers;
private EglBase14 eglBase;
@Nullable private EglBase14 eglBase;
private int profile;
private int width;
private int height;
private Surface inputSurface;
private GlRectDrawer drawer;
@Nullable private Surface inputSurface;
@Nullable private GlRectDrawer drawer;
private static final String VP8_MIME_TYPE = "video/x-vnd.on2.vp8";
private static final String VP9_MIME_TYPE = "video/x-vnd.on2.vp9";
@ -231,7 +232,7 @@ public class MediaCodecVideoEncoder {
private long lastKeyFrameMs;
// SPS and PPS NALs (Config frame) for H.264.
private ByteBuffer configData = null;
@Nullable private ByteBuffer configData = null;
// MediaCodec error handler - invoked when critical error happens which may prevent
// further use of media codec API. Now it means that one of media codec instances
@ -269,7 +270,7 @@ public class MediaCodecVideoEncoder {
&& (findHwEncoder(VP8_MIME_TYPE, vp8HwList(), supportedColorList) != null);
}
public static EncoderProperties vp8HwEncoderProperties() {
public static @Nullable EncoderProperties vp8HwEncoderProperties() {
if (hwEncoderDisabledTypes.contains(VP8_MIME_TYPE)) {
return null;
} else {
@ -322,7 +323,7 @@ public class MediaCodecVideoEncoder {
public final BitrateAdjustmentType bitrateAdjustmentType; // Bitrate adjustment type
}
private static EncoderProperties findHwEncoder(
private static @Nullable EncoderProperties findHwEncoder(
String mime, MediaCodecProperties[] supportedHwCodecProperties, int[] colorList) {
// MediaCodec.setParameters is missing for JB and below, so bitrate
// can not be adjusted dynamically.
@ -433,7 +434,7 @@ public class MediaCodecVideoEncoder {
}
}
static MediaCodec createByCodecName(String codecName) {
static @Nullable MediaCodec createByCodecName(String codecName) {
try {
// In the L-SDK this call can throw IOException so in order to work in
// both cases catch an exception.
@ -445,7 +446,7 @@ public class MediaCodecVideoEncoder {
@CalledByNativeUnchecked
boolean initEncode(VideoCodecType type, int profile, int width, int height, int kbps, int fps,
EglBase14.Context sharedContext) {
@Nullable EglBase14.Context sharedContext) {
final boolean useSurface = sharedContext != null;
Logging.d(TAG,
"Java initEncode: " + type + ". Profile: " + profile + " : " + width + " x " + height
@ -857,6 +858,7 @@ public class MediaCodecVideoEncoder {
// Dequeue and return an output buffer, or null if no output is ready. Return
// a fake OutputBufferInfo with index -1 if the codec is no longer operable.
@Nullable
@CalledByNativeUnchecked
OutputBufferInfo dequeueOutputBuffer() {
checkOnMediaCodecThread();

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@ -44,7 +45,7 @@ public class MediaConstraints {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@ -10,6 +10,8 @@
package org.webrtc;
import javax.annotation.Nullable;
/** Java wrapper for a C++ MediaStreamTrackInterface. */
@JNINamespace("webrtc::jni")
public class MediaStreamTrack {
@ -55,7 +57,7 @@ public class MediaStreamTrack {
}
/** Factory method to create an AudioTrack or VideoTrack subclass. */
static MediaStreamTrack createMediaStreamTrack(long nativeTrack) {
static @Nullable MediaStreamTrack createMediaStreamTrack(long nativeTrack) {
if (nativeTrack == 0) {
return null;
}

View File

@ -14,6 +14,7 @@ import static org.webrtc.NetworkMonitorAutoDetect.INVALID_NET_ID;
import android.content.Context;
import android.os.Build;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import org.webrtc.NetworkMonitorAutoDetect.ConnectionType;
@ -50,7 +51,7 @@ public class NetworkMonitor {
private final Object autoDetectLock = new Object();
// Object that detects the connection type changes and brings up mobile networks.
private NetworkMonitorAutoDetect autoDetect;
@Nullable private NetworkMonitorAutoDetect autoDetect;
// Also guarded by autoDetectLock.
private int numObservers;
@ -107,7 +108,7 @@ public class NetworkMonitor {
* CHANGE_NETWORK_STATE permission.
*/
@CalledByNative
private void startMonitoring(Context applicationContext, long nativeObserver) {
private void startMonitoring(@Nullable Context applicationContext, long nativeObserver) {
Logging.d(TAG, "Start monitoring with native observer " + nativeObserver);
startMonitoring(
@ -291,6 +292,7 @@ public class NetworkMonitor {
long nativePtr, NetworkInformation[] networkInfos);
// For testing only.
@Nullable
NetworkMonitorAutoDetect getNetworkMonitorAutoDetect() {
synchronized (autoDetectLock) {
return autoDetect;

View File

@ -35,6 +35,7 @@ import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
/**
* Borrowed from Chromium's
@ -188,7 +189,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
* Note: In some rare Android systems connectivityManager is null. We handle that
* gracefully below.
*/
private final ConnectivityManager connectivityManager;
@Nullable private final ConnectivityManager connectivityManager;
ConnectivityManagerDelegate(Context context) {
connectivityManager =
@ -227,7 +228,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
/**
* Returns connection type and status information gleaned from networkInfo.
*/
NetworkState getNetworkState(NetworkInfo networkInfo) {
NetworkState getNetworkState(@Nullable NetworkInfo networkInfo) {
if (networkInfo == null || !networkInfo.isConnected()) {
return new NetworkState(false, -1, -1);
}
@ -246,6 +247,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
return connectivityManager.getAllNetworks();
}
@Nullable
List<NetworkInformation> getActiveNetworkList() {
if (!supportNetworkCallback()) {
return null;
@ -304,7 +306,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
}
@SuppressLint("NewApi")
private NetworkInformation networkToInfo(Network network) {
private @Nullable NetworkInformation networkToInfo(Network network) {
if (connectivityManager == null) {
return null;
}
@ -408,7 +410,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
/** Queries the WifiManager for SSID of the current Wifi connection. */
static class WifiManagerDelegate {
private final Context context;
@Nullable private final Context context;
WifiManagerDelegate(Context context) {
this.context = context;
}
@ -444,7 +446,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
private final Observer observer;
// Network information about a WifiP2p (aka WiFi-Direct) network, or null if no such network is
// connected.
private NetworkInformation wifiP2pNetworkInfo = null;
@Nullable private NetworkInformation wifiP2pNetworkInfo = null;
WifiDirectManagerDelegate(Observer observer, Context context) {
this.context = context;
@ -482,7 +484,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
}
/** Handle a change notification about the wifi p2p group. */
private void onWifiP2pGroupChange(WifiP2pGroup wifiP2pGroup) {
private void onWifiP2pGroupChange(@Nullable WifiP2pGroup wifiP2pGroup) {
if (wifiP2pGroup == null || wifiP2pGroup.getInterface() == null) {
return;
}
@ -528,9 +530,9 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
private final Context context;
// Used to request mobile network. It does not do anything except for keeping
// the callback for releasing the request.
private final NetworkCallback mobileNetworkCallback;
@Nullable private final NetworkCallback mobileNetworkCallback;
// Used to receive updates on all networks.
private final NetworkCallback allNetworkCallback;
@Nullable private final NetworkCallback allNetworkCallback;
// connectivityManagerDelegate and wifiManagerDelegate are only non-final for testing.
private ConnectivityManagerDelegate connectivityManagerDelegate;
private WifiManagerDelegate wifiManagerDelegate;
@ -617,6 +619,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
return isRegistered;
}
@Nullable
List<NetworkInformation> getActiveNetworkList() {
List<NetworkInformation> connectivityManagerList =
connectivityManagerDelegate.getActiveNetworkList();

View File

@ -13,6 +13,7 @@ package org.webrtc;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
/**
* Java-land version of the PeerConnection APIs; wraps the C++ API
@ -202,7 +203,7 @@ public class PeerConnection {
}
public static class Builder {
private final List<String> urls;
@Nullable private final List<String> urls;
private String username = "";
private String password = "";
private TlsCertPolicy tlsCertPolicy = TlsCertPolicy.TLS_CERT_POLICY_SECURE;
@ -253,16 +254,19 @@ public class PeerConnection {
}
}
@Nullable
@CalledByNative("IceServer")
List<String> getUrls() {
return urls;
}
@Nullable
@CalledByNative("IceServer")
String getUsername() {
return username;
}
@Nullable
@CalledByNative("IceServer")
String getPassword() {
return password;
@ -273,6 +277,7 @@ public class PeerConnection {
return tlsCertPolicy;
}
@Nullable
@CalledByNative("IceServer")
String getHostname() {
return hostname;
@ -406,19 +411,19 @@ public class PeerConnection {
// 3) iceCheckMinInterval defines the minimal interval (equivalently the
// maximum rate) that overrides the above two intervals when either of them
// is less.
public Integer iceCheckIntervalStrongConnectivityMs;
public Integer iceCheckIntervalWeakConnectivityMs;
public Integer iceCheckMinInterval;
@Nullable public Integer iceCheckIntervalStrongConnectivityMs;
@Nullable public Integer iceCheckIntervalWeakConnectivityMs;
@Nullable public Integer iceCheckMinInterval;
// The time period in milliseconds for which a candidate pair must wait for response to
// connectivitiy checks before it becomes unwritable.
public Integer iceUnwritableTimeMs;
@Nullable public Integer iceUnwritableTimeMs;
// The minimum number of connectivity checks that a candidate pair must sent without receiving
// response before it becomes unwritable.
public Integer iceUnwritableMinChecks;
@Nullable public Integer iceUnwritableMinChecks;
// The interval in milliseconds at which STUN candidates will resend STUN binding requests
// to keep NAT bindings open.
// The default value in the implementation is used if this field is null.
public Integer stunCandidateKeepaliveIntervalMs;
@Nullable public Integer stunCandidateKeepaliveIntervalMs;
public boolean disableIPv6OnWifi;
// By default, PeerConnection will use a limited number of IPv6 network
// interfaces, in order to avoid too many ICE candidate pairs being created
@ -426,7 +431,7 @@ public class PeerConnection {
//
// Can be set to Integer.MAX_VALUE to effectively disable the limit.
public int maxIPv6Networks;
public IntervalRange iceRegatherIntervalRange;
@Nullable public IntervalRange iceRegatherIntervalRange;
// These values will be overridden by MediaStream constraints if deprecated constraints-based
// create peerconnection interface is used.
@ -435,16 +440,16 @@ public class PeerConnection {
public boolean enableCpuOveruseDetection;
public boolean enableRtpDataChannel;
public boolean suspendBelowMinBitrate;
public Integer screencastMinBitrate;
public Boolean combinedAudioVideoBwe;
public Boolean enableDtlsSrtp;
@Nullable public Integer screencastMinBitrate;
@Nullable public Boolean combinedAudioVideoBwe;
@Nullable public Boolean enableDtlsSrtp;
// Use "Unknown" to represent no preference of adapter types, not the
// preference of adapters of unknown types.
public AdapterType networkPreference;
public SdpSemantics sdpSemantics;
// This is an optional wrapper for the C++ webrtc::TurnCustomizer.
public TurnCustomizer turnCustomizer;
@Nullable public TurnCustomizer turnCustomizer;
// TODO(deadbeef): Instead of duplicating the defaults here, we should do
// something to pick up the defaults from C++. The Objective-C equivalent
@ -561,31 +566,37 @@ public class PeerConnection {
return presumeWritableWhenFullyRelayed;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getIceCheckIntervalStrongConnectivity() {
return iceCheckIntervalStrongConnectivityMs;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getIceCheckIntervalWeakConnectivity() {
return iceCheckIntervalWeakConnectivityMs;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getIceCheckMinInterval() {
return iceCheckMinInterval;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getIceUnwritableTimeout() {
return iceUnwritableTimeMs;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getIceUnwritableMinChecks() {
return iceUnwritableMinChecks;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getStunCandidateKeepaliveInterval() {
return stunCandidateKeepaliveIntervalMs;
@ -601,11 +612,13 @@ public class PeerConnection {
return maxIPv6Networks;
}
@Nullable
@CalledByNative("RTCConfiguration")
IntervalRange getIceRegatherIntervalRange() {
return iceRegatherIntervalRange;
}
@Nullable
@CalledByNative("RTCConfiguration")
TurnCustomizer getTurnCustomizer() {
return turnCustomizer;
@ -636,16 +649,19 @@ public class PeerConnection {
return suspendBelowMinBitrate;
}
@Nullable
@CalledByNative("RTCConfiguration")
Integer getScreencastMinBitrate() {
return screencastMinBitrate;
}
@Nullable
@CalledByNative("RTCConfiguration")
Boolean getCombinedAudioVideoBwe() {
return combinedAudioVideoBwe;
}
@Nullable
@CalledByNative("RTCConfiguration")
Boolean getEnableDtlsSrtp() {
return enableDtlsSrtp;
@ -923,7 +939,7 @@ public class PeerConnection {
}
public RtpTransceiver addTransceiver(
MediaStreamTrack track, RtpTransceiver.RtpTransceiverInit init) {
MediaStreamTrack track, @Nullable RtpTransceiver.RtpTransceiverInit init) {
if (track == null) {
throw new NullPointerException("No MediaStreamTrack specified for addTransceiver.");
}
@ -943,7 +959,7 @@ public class PeerConnection {
}
public RtpTransceiver addTransceiver(
MediaStreamTrack.MediaType mediaType, RtpTransceiver.RtpTransceiverInit init) {
MediaStreamTrack.MediaType mediaType, @Nullable RtpTransceiver.RtpTransceiverInit init) {
if (mediaType == null) {
throw new NullPointerException("No MediaType specified for addTransceiver.");
}
@ -960,7 +976,7 @@ public class PeerConnection {
// Older, non-standard implementation of getStats.
@Deprecated
public boolean getStats(StatsObserver observer, MediaStreamTrack track) {
public boolean getStats(StatsObserver observer, @Nullable MediaStreamTrack track) {
return nativeOldGetStats(observer, (track == null) ? 0 : track.nativeTrack);
}

View File

@ -12,6 +12,7 @@ package org.webrtc;
import android.content.Context;
import java.util.List;
import javax.annotation.Nullable;
/**
* Java wrapper for a C++ PeerConnectionFactoryInterface. Main entry point to
@ -27,9 +28,9 @@ public class PeerConnectionFactory {
private final long nativeFactory;
private static volatile boolean internalTracerInitialized = false;
private static Thread networkThread;
private static Thread workerThread;
private static Thread signalingThread;
@Nullable private static Thread networkThread;
@Nullable private static Thread workerThread;
@Nullable private static Thread signalingThread;
private EglBase localEglbase;
private EglBase remoteEglbase;
@ -124,11 +125,11 @@ public class PeerConnectionFactory {
}
public static class Builder {
private Options options;
private VideoEncoderFactory encoderFactory;
private VideoDecoderFactory decoderFactory;
private AudioProcessingFactory audioProcessingFactory;
private FecControllerFactoryFactoryInterface fecControllerFactoryFactory;
private @Nullable Options options;
private @Nullable VideoEncoderFactory encoderFactory;
private @Nullable VideoDecoderFactory decoderFactory;
private @Nullable AudioProcessingFactory audioProcessingFactory;
private @Nullable FecControllerFactoryFactoryInterface fecControllerFactoryFactory;
private Builder() {}
@ -262,9 +263,10 @@ public class PeerConnectionFactory {
null /* fecControllerFactoryFactory */);
}
private PeerConnectionFactory(Options options, VideoEncoderFactory encoderFactory,
VideoDecoderFactory decoderFactory, AudioProcessingFactory audioProcessingFactory,
FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
private PeerConnectionFactory(Options options, @Nullable VideoEncoderFactory encoderFactory,
@Nullable VideoDecoderFactory decoderFactory,
@Nullable AudioProcessingFactory audioProcessingFactory,
@Nullable FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
checkInitializeHasBeenCalled();
nativeFactory = nativeCreatePeerConnectionFactory(ContextUtils.getApplicationContext(), options,
encoderFactory, decoderFactory,
@ -279,6 +281,7 @@ public class PeerConnectionFactory {
* Deprecated. PeerConnection constraints are deprecated. Supply values in rtcConfig struct
* instead and use the method without constraints in the signature.
*/
@Nullable
@Deprecated
public PeerConnection createPeerConnection(PeerConnection.RTCConfiguration rtcConfig,
MediaConstraints constraints, PeerConnection.Observer observer) {
@ -298,6 +301,7 @@ public class PeerConnectionFactory {
* Deprecated. PeerConnection constraints are deprecated. Supply values in rtcConfig struct
* instead and use the method without constraints in the signature.
*/
@Nullable
@Deprecated
public PeerConnection createPeerConnection(List<PeerConnection.IceServer> iceServers,
MediaConstraints constraints, PeerConnection.Observer observer) {
@ -305,12 +309,14 @@ public class PeerConnectionFactory {
return createPeerConnection(rtcConfig, constraints, observer);
}
@Nullable
public PeerConnection createPeerConnection(
List<PeerConnection.IceServer> iceServers, PeerConnection.Observer observer) {
PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
return createPeerConnection(rtcConfig, observer);
}
@Nullable
public PeerConnection createPeerConnection(
PeerConnection.RTCConfiguration rtcConfig, PeerConnection.Observer observer) {
return createPeerConnection(rtcConfig, null /* constraints */, observer);
@ -411,7 +417,7 @@ public class PeerConnectionFactory {
return nativeFactory;
}
private static void printStackTrace(Thread thread, String threadName) {
private static void printStackTrace(@Nullable Thread thread, String threadName) {
if (thread != null) {
StackTraceElement[] stackTraces = thread.getStackTrace();
if (stackTraces.length > 0) {

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import java.util.List;
import java.util.ArrayList;
import org.webrtc.MediaStreamTrack;
@ -31,7 +32,7 @@ public class RtpParameters {
// If non-null, this represents the Transport Independent Application
// Specific maximum bandwidth defined in RFC3890. If null, there is no
// maximum bitrate.
public Integer maxBitrateBps;
@Nullable public Integer maxBitrateBps;
// SSRC to be used by this encoding.
// Can't be changed between getParameters/setParameters.
public Long ssrc;
@ -48,6 +49,7 @@ public class RtpParameters {
return active;
}
@Nullable
@CalledByNative("Encoding")
Integer getMaxBitrateBps() {
return maxBitrateBps;

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import org.webrtc.MediaStreamTrack;
/** Java wrapper for a C++ RtpReceiverInterface. */
@ -25,7 +26,7 @@ public class RtpReceiver {
final long nativeRtpReceiver;
private long nativeObserver;
private MediaStreamTrack cachedTrack;
@Nullable private MediaStreamTrack cachedTrack;
@CalledByNative
public RtpReceiver(long nativeRtpReceiver) {
@ -34,11 +35,12 @@ public class RtpReceiver {
cachedTrack = MediaStreamTrack.createMediaStreamTrack(nativeTrack);
}
@Nullable
public MediaStreamTrack track() {
return cachedTrack;
}
public boolean setParameters(RtpParameters parameters) {
public boolean setParameters(@Nullable RtpParameters parameters) {
return parameters == null ? false : nativeSetParameters(nativeRtpReceiver, parameters);
}

View File

@ -10,15 +10,17 @@
package org.webrtc;
import javax.annotation.Nullable;
/** Java wrapper for a C++ RtpSenderInterface. */
@JNINamespace("webrtc::jni")
public class RtpSender {
final long nativeRtpSender;
private MediaStreamTrack cachedTrack;
@Nullable private MediaStreamTrack cachedTrack;
private boolean ownsTrack = true;
private final DtmfSender dtmfSender;
private final @Nullable DtmfSender dtmfSender;
@CalledByNative
public RtpSender(long nativeRtpSender) {
@ -44,7 +46,7 @@ public class RtpSender {
* or a MediaStream.
* @return true on success and false on failure.
*/
public boolean setTrack(MediaStreamTrack track, boolean takeOwnership) {
public boolean setTrack(@Nullable MediaStreamTrack track, boolean takeOwnership) {
if (!nativeSetTrack(nativeRtpSender, (track == null) ? 0 : track.nativeTrack)) {
return false;
}
@ -56,6 +58,7 @@ public class RtpSender {
return true;
}
@Nullable
public MediaStreamTrack track() {
return cachedTrack;
}
@ -72,6 +75,7 @@ public class RtpSender {
return nativeGetId(nativeRtpSender);
}
@Nullable
public DtmfSender dtmf() {
return dtmfSender;
}

View File

@ -19,6 +19,7 @@ import android.hardware.display.VirtualDisplay;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.view.Surface;
import javax.annotation.Nullable;
/**
* An implementation of VideoCapturer to capture the screen content as a video stream.
@ -44,13 +45,13 @@ public class ScreenCapturerAndroid
private int width;
private int height;
private VirtualDisplay virtualDisplay;
private SurfaceTextureHelper surfaceTextureHelper;
private CapturerObserver capturerObserver;
@Nullable private VirtualDisplay virtualDisplay;
@Nullable private SurfaceTextureHelper surfaceTextureHelper;
@Nullable private CapturerObserver capturerObserver;
private long numCapturedFrames = 0;
private MediaProjection mediaProjection;
@Nullable private MediaProjection mediaProjection;
private boolean isDisposed = false;
private MediaProjectionManager mediaProjectionManager;
@Nullable private MediaProjectionManager mediaProjectionManager;
/**
* Constructs a new Screen Capturer.

View File

@ -10,7 +10,10 @@
package org.webrtc;
import javax.annotation.Nullable;
public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
@Nullable
@Override
public VideoDecoder createDecoder(String codecType) {
if (codecType.equalsIgnoreCase("VP8")) {

View File

@ -10,11 +10,13 @@
package org.webrtc;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
@Nullable
@Override
public VideoEncoder createEncoder(VideoCodecInfo info) {
if (info.name.equalsIgnoreCase("VP8")) {

View File

@ -20,6 +20,7 @@ import android.os.Handler;
import android.os.HandlerThread;
import java.nio.ByteBuffer;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import org.webrtc.EglBase;
import org.webrtc.VideoFrame.TextureBuffer;
@ -62,6 +63,7 @@ public class SurfaceTextureHelper {
// Therefore, in order to control the callback thread on API lvl < 21, the SurfaceTextureHelper
// is constructed on the |handler| thread.
return ThreadUtils.invokeAtFrontUninterruptibly(handler, new Callable<SurfaceTextureHelper>() {
@Nullable
@Override
public SurfaceTextureHelper call() {
try {
@ -81,14 +83,14 @@ public class SurfaceTextureHelper {
private YuvConverter yuvConverter;
// These variables are only accessed from the |handler| thread.
private OnTextureFrameAvailableListener listener;
@Nullable private OnTextureFrameAvailableListener listener;
// The possible states of this class.
private boolean hasPendingTexture = false;
private volatile boolean isTextureInUse = false;
private boolean isQuitting = false;
// |pendingListener| is set in setListener() and the runnable is posted to the handler thread.
// setListener() is not allowed to be called again before stopListening(), so this is thread safe.
private OnTextureFrameAvailableListener pendingListener;
@Nullable private OnTextureFrameAvailableListener pendingListener;
final Runnable setListenerRunnable = new Runnable() {
@Override
public void run() {

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Locale;
import java.util.Map;
@ -50,7 +51,7 @@ public class VideoCodecInfo {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == null)
return false;
if (obj == this)

View File

@ -10,11 +10,13 @@
package org.webrtc;
import javax.annotation.Nullable;
/** Factory for creating VideoDecoders. */
public interface VideoDecoderFactory {
/**
* Creates a VideoDecoder for the given codec. Supports the same codecs supported by
* VideoEncoderFactory.
*/
@CalledByNative VideoDecoder createDecoder(String codecType);
@Nullable @CalledByNative VideoDecoder createDecoder(String codecType);
}

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import org.webrtc.EncodedImage;
/**
@ -93,8 +94,8 @@ public interface VideoEncoder {
/** Settings for WebRTC quality based scaling. */
public class ScalingSettings {
public final boolean on;
public final Integer low;
public final Integer high;
@Nullable public final Integer low;
@Nullable public final Integer high;
/**
* Settings to disable quality based scaling.

View File

@ -10,10 +10,12 @@
package org.webrtc;
import javax.annotation.Nullable;
/** Factory for creating VideoEncoders. */
public interface VideoEncoderFactory {
/** Creates an encoder for the given video codec. */
@CalledByNative VideoEncoder createEncoder(VideoCodecInfo info);
@Nullable @CalledByNative VideoEncoder createEncoder(VideoCodecInfo info);
/**
* Enumerates the list of supported video codecs. This method will only be called once and the

View File

@ -14,6 +14,7 @@ import android.graphics.Matrix;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import java.nio.ByteBuffer;
import javax.annotation.Nullable;
/**
* Java version of webrtc::VideoFrame and webrtc::VideoFrameBuffer. A difference from the C++

View File

@ -13,6 +13,7 @@ package org.webrtc;
import android.graphics.Matrix;
import android.graphics.Point;
import android.opengl.GLES20;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
/**
@ -55,14 +56,15 @@ public class VideoFrameDrawer {
// Intermediate copy buffer for uploading yuv frames that are not packed, i.e. stride > width.
// TODO(magjed): Investigate when GL_UNPACK_ROW_LENGTH is available, or make a custom shader
// that handles stride and compare performance with intermediate copy.
private ByteBuffer copyBuffer;
private int[] yuvTextures;
@Nullable private ByteBuffer copyBuffer;
@Nullable private int[] yuvTextures;
/**
* Upload |planes| into OpenGL textures, taking stride into consideration.
*
* @return Array of three texture indices corresponding to Y-, U-, and V-plane respectively.
*/
@Nullable
public int[] uploadYuvData(int width, int height, int[] strides, ByteBuffer[] planes) {
final int[] planeWidths = new int[] {width, width / 2, width / 2};
final int[] planeHeights = new int[] {height, height / 2, height / 2};
@ -105,12 +107,14 @@ public class VideoFrameDrawer {
return yuvTextures;
}
@Nullable
public int[] uploadFromBuffer(VideoFrame.I420Buffer buffer) {
int[] strides = {buffer.getStrideY(), buffer.getStrideU(), buffer.getStrideV()};
ByteBuffer[] planes = {buffer.getDataY(), buffer.getDataU(), buffer.getDataV()};
return uploadYuvData(buffer.getWidth(), buffer.getHeight(), strides, planes);
}
@Nullable
public int[] getYuvTextures() {
return yuvTextures;
}
@ -144,7 +148,7 @@ public class VideoFrameDrawer {
// |renderWidth| and |renderHeight| to avoid allocations since this function is called for every
// frame.
private void calculateTransformedRenderSize(
int frameWidth, int frameHeight, Matrix renderMatrix) {
int frameWidth, int frameHeight, @Nullable Matrix renderMatrix) {
if (renderMatrix == null) {
renderWidth = frameWidth;
renderHeight = frameHeight;
@ -167,7 +171,7 @@ public class VideoFrameDrawer {
private final YuvUploader yuvUploader = new YuvUploader();
// This variable will only be used for checking reference equality and is used for caching I420
// textures.
private VideoFrame lastI420Frame;
@Nullable private VideoFrame lastI420Frame;
private final Matrix renderMatrix = new Matrix();
public void drawFrame(VideoFrame frame, RendererCommon.GlDrawer drawer) {
@ -181,7 +185,7 @@ public class VideoFrameDrawer {
}
public void drawFrame(VideoFrame frame, RendererCommon.GlDrawer drawer,
Matrix additionalRenderMatrix, int viewportX, int viewportY, int viewportWidth,
@Nullable Matrix additionalRenderMatrix, int viewportX, int viewportY, int viewportWidth,
int viewportHeight) {
final int width = frame.getRotatedWidth();
final int height = frame.getRotatedHeight();

View File

@ -10,6 +10,7 @@
package org.webrtc;
import javax.annotation.Nullable;
import java.nio.ByteBuffer;
import org.webrtc.VideoFrame;
@ -28,14 +29,14 @@ public class VideoRenderer {
public static class I420Frame {
public final int width;
public final int height;
public final int[] yuvStrides;
public ByteBuffer[] yuvPlanes;
@Nullable public final int[] yuvStrides;
@Nullable public ByteBuffer[] yuvPlanes;
public final boolean yuvFrame;
// Matrix that transforms standard coordinates to their proper sampling locations in
// the texture. This transform compensates for any properties of the video source that
// cause it to appear different from a normalized texture. This matrix does not take
// |rotationDegree| into account.
public final float[] samplingMatrix;
@Nullable public final float[] samplingMatrix;
public int textureId;
// Frame pointer in C++.
private long nativeFramePointer;
@ -46,7 +47,7 @@ public class VideoRenderer {
// If this I420Frame was constructed from VideoFrame.Buffer, this points to
// the backing buffer.
private final VideoFrame.Buffer backingBuffer;
@Nullable private final VideoFrame.Buffer backingBuffer;
/**
* Construct a frame of the given dimensions with the specified planar data.