Clean up nullness annotation

PiperOrigin-RevId: 627114088
This commit is contained in:
claincly 2024-04-22 12:04:42 -07:00 committed by Copybara-Service
parent 430fafded6
commit 7aed9d40a0
6 changed files with 23 additions and 22 deletions

View File

@ -239,15 +239,15 @@ public final class VideoFrameProcessorTestRunner {
public static final int VIDEO_FRAME_PROCESSING_WAIT_MS = 5_000;
private final String testId;
private final @MonotonicNonNull String videoAssetPath;
@Nullable private final String videoAssetPath;
private final String outputFileLabel;
private final float pixelWidthHeightRatio;
private final ConditionVariable videoFrameProcessorReadyCondition;
private final @MonotonicNonNull CountDownLatch videoFrameProcessingEndedLatch;
@Nullable private final CountDownLatch videoFrameProcessingEndedLatch;
private final AtomicReference<VideoFrameProcessingException> videoFrameProcessingException;
private final VideoFrameProcessor videoFrameProcessor;
private final ImmutableList<Effect> effects;
private final @MonotonicNonNull BitmapReader bitmapReader;
@Nullable private final BitmapReader bitmapReader;
private VideoFrameProcessorTestRunner(
String testId,

View File

@ -48,7 +48,7 @@ public final class DefaultAssetLoaderFactory implements AssetLoader.Factory {
private final Context context;
private final Codec.DecoderFactory decoderFactory;
private final Clock clock;
private final MediaSource.@MonotonicNonNull Factory mediaSourceFactory;
@Nullable private final MediaSource.Factory mediaSourceFactory;
private final BitmapLoader bitmapLoader;
private AssetLoader.@MonotonicNonNull Factory imageAssetLoaderFactory;

View File

@ -33,7 +33,6 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** Information about the result of an export. */
@UnstableApi
@ -289,13 +288,13 @@ public final class ExportResult {
* The name of the audio decoder used to process {@code mediaItem}. This field is {@code null}
* if no audio decoder was used.
*/
public final @MonotonicNonNull String audioDecoderName;
@Nullable public final String audioDecoderName;
/**
* The name of the video decoder used to process {@code mediaItem}. This field is {@code null}
* if no video decoder was used.
*/
public final @MonotonicNonNull String videoDecoderName;
@Nullable public final String videoDecoderName;
/** Creates an instance. */
public ProcessedInput(

View File

@ -146,7 +146,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private final boolean dropSamplesBeforeFirstVideoSample;
private final SparseArray<TrackInfo> trackTypeToInfo;
private final ScheduledExecutorService abortScheduledExecutorService;
private final @MonotonicNonNull Format appendVideoFormat;
@Nullable private final Format appendVideoFormat;
private final long maxDelayBetweenSamplesMs;
private final BufferInfo bufferInfo;
@ -354,7 +354,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* and all the formats must be added before any samples can be {@linkplain #writeSample(int,
* ByteBuffer, boolean, long) written}.
*
* <p>{@link Muxer#addMetadata(Metadata)} is called if the {@link Format#metadata} is present.
* <p>{@link Muxer#addMetadataEntry(Metadata.Entry)} is called if the {@link Format#metadata} is
* present.
*
* @param format The {@link Format} to be added. In {@link #MUXER_MODE_APPEND} mode, the added
* {@link Format} must match the existing {@link Format} set when the muxer was in {@link

View File

@ -57,9 +57,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
public final class RawAssetLoader implements AssetLoader {
private final EditedMediaItem editedMediaItem;
private final Listener assetLoaderListener;
private final @MonotonicNonNull Format audioFormat;
private final @MonotonicNonNull Format videoFormat;
private final @MonotonicNonNull OnInputFrameProcessedListener frameProcessedListener;
@Nullable private final Format audioFormat;
@Nullable private final Format videoFormat;
@Nullable private final OnInputFrameProcessedListener frameProcessedListener;
private @MonotonicNonNull SampleConsumer audioSampleConsumer;
private @MonotonicNonNull SampleConsumer videoSampleConsumer;
@ -121,6 +121,7 @@ public final class RawAssetLoader implements AssetLoader {
public void start() {
progressState = PROGRESS_STATE_AVAILABLE;
assetLoaderListener.onDurationUs(editedMediaItem.durationUs);
// The constructor guarantees at least one track is present.
int trackCount = 1;
if (audioFormat != null && videoFormat != null) {
trackCount = 2;
@ -174,13 +175,14 @@ public final class RawAssetLoader implements AssetLoader {
}
if (videoSampleConsumer == null) {
@Nullable
SampleConsumer sampleConsumer =
SampleConsumer videoSampleConsumer =
assetLoaderListener.onOutputFormat(checkNotNull(videoFormat));
if (sampleConsumer == null) {
if (videoSampleConsumer == null) {
return false;
} else {
videoSampleConsumer = sampleConsumer;
sampleConsumer.setOnInputFrameProcessedListener(checkNotNull(frameProcessedListener));
this.videoSampleConsumer = videoSampleConsumer;
videoSampleConsumer.setOnInputFrameProcessedListener(
checkNotNull(frameProcessedListener));
}
}
@SampleConsumer.InputResult
@ -239,12 +241,12 @@ public final class RawAssetLoader implements AssetLoader {
}
if (audioSampleConsumer == null) {
@Nullable
SampleConsumer sampleConsumer =
SampleConsumer audioSampleConsumer =
assetLoaderListener.onOutputFormat(checkNotNull(audioFormat));
if (sampleConsumer == null) {
if (audioSampleConsumer == null) {
return false;
} else {
audioSampleConsumer = sampleConsumer;
this.audioSampleConsumer = audioSampleConsumer;
}
}
DecoderInputBuffer decoderInputBuffer = audioSampleConsumer.getInputBuffer();

View File

@ -25,7 +25,6 @@ import androidx.media3.common.util.UnstableApi;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/**
* @deprecated Use {@link ExportResult} instead.
@ -272,13 +271,13 @@ public final class TransformationResult {
* The name of the audio decoder used to process {@code mediaItem}. This field is {@code null}
* if no audio decoder was used.
*/
public final @MonotonicNonNull String audioDecoderName;
@Nullable public final String audioDecoderName;
/**
* The name of the video decoder used to process {@code mediaItem}. This field is {@code null}
* if no video decoder was used.
*/
public final @MonotonicNonNull String videoDecoderName;
@Nullable public final String videoDecoderName;
/** Creates an instance. */
public ProcessedInput(