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

@ -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();