Add nullness annotations on MediaCodecRenderer processOutputBuffer
Issue: #7579 PiperOrigin-RevId: 322756102
This commit is contained in:
parent
b041c59f1e
commit
2cf9d9b0c0
@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.google.android.exoplayer2.audio;
|
||||
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.media.MediaCodec;
|
||||
@ -40,7 +42,6 @@ import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
|
||||
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
|
||||
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
|
||||
import com.google.android.exoplayer2.mediacodec.MediaFormatUtil;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import com.google.android.exoplayer2.util.MediaClock;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
@ -568,7 +569,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
long positionUs,
|
||||
long elapsedRealtimeUs,
|
||||
@Nullable MediaCodec codec,
|
||||
ByteBuffer buffer,
|
||||
@Nullable ByteBuffer buffer,
|
||||
int bufferIndex,
|
||||
int bufferFlags,
|
||||
int sampleCount,
|
||||
@ -577,6 +578,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
boolean isLastBuffer,
|
||||
Format format)
|
||||
throws ExoPlaybackException {
|
||||
checkNotNull(buffer);
|
||||
if (codec != null
|
||||
&& codecNeedsEosBufferTimestampWorkaround
|
||||
&& bufferPresentationTimeUs == 0
|
||||
@ -588,7 +590,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
if (codecPassthroughFormat != null
|
||||
&& (bufferFlags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
|
||||
// Discard output buffers from the passthrough (raw) decoder containing codec specific data.
|
||||
Assertions.checkNotNull(codec).releaseOutputBuffer(bufferIndex, false);
|
||||
checkNotNull(codec).releaseOutputBuffer(bufferIndex, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
private long codecHotswapDeadlineMs;
|
||||
private int inputIndex;
|
||||
private int outputIndex;
|
||||
private ByteBuffer outputBuffer;
|
||||
@Nullable private ByteBuffer outputBuffer;
|
||||
private boolean isDecodeOnlyOutputBuffer;
|
||||
private boolean isLastOutputBuffer;
|
||||
private boolean bypassEnabled;
|
||||
@ -1168,6 +1168,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ByteBuffer getOutputBuffer(int outputIndex) {
|
||||
if (Util.SDK_INT >= 21) {
|
||||
return codec.getOutputBuffer(outputIndex);
|
||||
@ -1874,7 +1875,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
* @param elapsedRealtimeUs {@link SystemClock#elapsedRealtime()} in microseconds, measured at the
|
||||
* start of the current iteration of the rendering loop.
|
||||
* @param codec The {@link MediaCodec} instance, or null in bypass mode were no codec is used.
|
||||
* @param buffer The output buffer to process.
|
||||
* @param buffer The output buffer to process, or null if the buffer data is not made available to
|
||||
* the application layer (see {@link MediaCodec#getOutputBuffer(int)}). This {@code buffer}
|
||||
* can only be null for video data. Note that the buffer data can still be rendered in this
|
||||
* case by using the {@code bufferIndex}.
|
||||
* @param bufferIndex The index of the output buffer.
|
||||
* @param bufferFlags The flags attached to the output buffer.
|
||||
* @param sampleCount The number of samples extracted from the sample queue in the buffer. This
|
||||
@ -1891,7 +1895,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
long positionUs,
|
||||
long elapsedRealtimeUs,
|
||||
@Nullable MediaCodec codec,
|
||||
ByteBuffer buffer,
|
||||
@Nullable ByteBuffer buffer,
|
||||
int bufferIndex,
|
||||
int bufferFlags,
|
||||
int sampleCount,
|
||||
|
@ -759,7 +759,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||
long positionUs,
|
||||
long elapsedRealtimeUs,
|
||||
@Nullable MediaCodec codec,
|
||||
ByteBuffer buffer,
|
||||
@Nullable ByteBuffer buffer,
|
||||
int bufferIndex,
|
||||
int bufferFlags,
|
||||
int sampleCount,
|
||||
|
Loading…
x
Reference in New Issue
Block a user