Remove video decoder buffers from nullness blacklist

PiperOrigin-RevId: 263104935
This commit is contained in:
sofijajvc 2019-08-13 11:25:54 +01:00 committed by Andrew Lewis
parent 9f0fd870e7
commit 860aa2f952
2 changed files with 11 additions and 5 deletions

View file

@ -15,12 +15,13 @@
*/
package com.google.android.exoplayer2.video;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
/** Input buffer to a video decoder. */
public class VideoDecoderInputBuffer extends DecoderInputBuffer {
public ColorInfo colorInfo;
@Nullable public ColorInfo colorInfo;
public VideoDecoderInputBuffer() {
super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_DIRECT);

View file

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.video;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.decoder.OutputBuffer;
import java.nio.ByteBuffer;
@ -33,16 +34,16 @@ public abstract class VideoDecoderOutputBuffer extends OutputBuffer {
/** Output mode. */
@C.VideoOutputMode public int mode;
/** RGB buffer for RGB mode. */
public ByteBuffer data;
@Nullable public ByteBuffer data;
public int width;
public int height;
public ColorInfo colorInfo;
@Nullable public ColorInfo colorInfo;
/** YUV planes for YUV mode. */
public ByteBuffer[] yuvPlanes;
@Nullable public ByteBuffer[] yuvPlanes;
public int[] yuvStrides;
@Nullable public int[] yuvStrides;
public int colorspace;
/**
@ -88,6 +89,10 @@ public abstract class VideoDecoderOutputBuffer extends OutputBuffer {
if (yuvPlanes == null) {
yuvPlanes = new ByteBuffer[3];
}
ByteBuffer data = this.data;
ByteBuffer[] yuvPlanes = this.yuvPlanes;
// Rewrapping has to be done on every frame since the stride might have changed.
yuvPlanes[0] = data.slice();
yuvPlanes[0].limit(yLength);