Commit c529a0b9 by tonihei Committed by Ian Baker

Rollback of https://github.com/google/ExoPlayer/commit/31430f1ac50db80cf618f3e2ee9de2e9159f2e4c

*** Original commit ***

Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.

***

PiperOrigin-RevId: 343100646
parent 6d7997e7
Showing with 13 additions and 124 deletions
......@@ -103,8 +103,6 @@ public final class AudioCapabilities {
* supported.
* @param maxChannelCount The maximum number of audio channels that can be played simultaneously.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public AudioCapabilities(@Nullable int[] supportedEncodings, int maxChannelCount) {
if (supportedEncodings != null) {
this.supportedEncodings = Arrays.copyOf(supportedEncodings, supportedEncodings.length);
......
......@@ -288,8 +288,6 @@ public interface AudioSink {
* is applied the audio data will have {@code outputChannels.length} channels.
* @throws ConfigurationException If an error occurs configuring the sink.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
void configure(Format inputFormat, int specifiedBufferSize, @Nullable int[] outputChannels)
throws ConfigurationException;
......
......@@ -26,14 +26,8 @@ import java.nio.ByteBuffer;
*/
/* package */ final class ChannelMappingAudioProcessor extends BaseAudioProcessor {
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private int[] pendingOutputChannels;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private int[] outputChannels;
@Nullable private int[] pendingOutputChannels;
@Nullable private int[] outputChannels;
/**
* Resets the channel mapping. After calling this method, call {@link #configure(AudioFormat)} to
......@@ -43,8 +37,6 @@ import java.nio.ByteBuffer;
* leave the input unchanged.
* @see AudioSink#configure(com.google.android.exoplayer2.Format, int, int[])
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public void setChannelMap(@Nullable int[] outputChannels) {
pendingOutputChannels = outputChannels;
}
......@@ -52,10 +44,7 @@ import java.nio.ByteBuffer;
@Override
public AudioFormat onConfigure(AudioFormat inputAudioFormat)
throws UnhandledAudioFormatException {
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
int[] outputChannels = pendingOutputChannels;
@Nullable int[] outputChannels = pendingOutputChannels;
if (outputChannels == null) {
return AudioFormat.NOT_SET;
}
......
......@@ -50,8 +50,6 @@ public class ForwardingAudioSink implements AudioSink {
return sink.getCurrentPositionUs(sourceEnded);
}
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Override
public void configure(Format inputFormat, int specifiedBufferSize, @Nullable int[] outputChannels)
throws ConfigurationException {
......
......@@ -335,8 +335,6 @@ class AsynchronousMediaCodecBufferEnqueuer {
* @param dst The destination array, which will be reused if it's at least as long as {@code src}.
* @return The copy, which may be {@code dst} if it was reused.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private static int[] copy(@Nullable int[] src, @Nullable int[] dst) {
if (src == null) {
......@@ -358,8 +356,6 @@ class AsynchronousMediaCodecBufferEnqueuer {
* @param dst The destination array, which will be reused if it's at least as long as {@code src}.
* @return The copy, which may be {@code dst} if it was reused.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private static byte[] copy(@Nullable byte[] src, @Nullable byte[] dst) {
if (src == null) {
......
......@@ -59,8 +59,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable
private MediaFormat pendingOutputFormat;
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@GuardedBy("lock")
@Nullable
private MediaCodec.CodecException mediaCodecException;
......@@ -214,8 +212,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
}
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Override
public void onOutputBufferAvailable(
@NonNull MediaCodec codec, int index, @NonNull MediaCodec.BufferInfo info) {
......@@ -229,8 +225,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
}
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Override
public void onError(@NonNull MediaCodec codec, @NonNull MediaCodec.CodecException e) {
synchronized (lock) {
......
......@@ -935,10 +935,7 @@ public final class MediaCodecUtil {
private final int codecKind;
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Nullable
private android.media.MediaCodecInfo[] mediaCodecInfos;
@Nullable private android.media.MediaCodecInfo[] mediaCodecInfos;
public MediaCodecListCompatV21(boolean includeSecure, boolean includeTunneling) {
codecKind =
......
......@@ -85,8 +85,6 @@ public final class MediaFormatUtil {
* @param key The key to set.
* @param value The byte array that will be wrapped to obtain the value.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public static void maybeSetByteBuffer(MediaFormat format, String key, @Nullable byte[] value) {
if (value != null) {
format.setByteBuffer(key, ByteBuffer.wrap(value));
......
......@@ -104,10 +104,7 @@ import java.util.List;
boolean isRemoveAction = input.readBoolean();
int dataLength = input.readInt();
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
byte[] data;
@Nullable byte[] data;
if (dataLength != 0) {
data = new byte[dataLength];
input.readFully(data);
......
......@@ -345,8 +345,6 @@ public final class DownloadHelper {
* SmoothStreaming media items.
* @throws IllegalArgumentException If the {@code dataSourceFactory} is null for adaptive streams.
*/
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
public static DownloadHelper forMediaItem(
Context context,
MediaItem mediaItem,
......@@ -376,8 +374,6 @@ public final class DownloadHelper {
* SmoothStreaming media items.
* @throws IllegalArgumentException If the {@code dataSourceFactory} is null for adaptive streams.
*/
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
public static DownloadHelper forMediaItem(
MediaItem mediaItem,
DefaultTrackSelector.Parameters trackSelectorParameters,
......@@ -409,8 +405,6 @@ public final class DownloadHelper {
* SmoothStreaming media items.
* @throws IllegalArgumentException If the {@code dataSourceFactory} is null for adaptive streams.
*/
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
public static DownloadHelper forMediaItem(
MediaItem mediaItem,
DefaultTrackSelector.Parameters trackSelectorParameters,
......@@ -730,8 +724,6 @@ public final class DownloadHelper {
* @param data Application provided data to store in {@link DownloadRequest#data}.
* @return The built {@link DownloadRequest}.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public DownloadRequest getDownloadRequest(@Nullable byte[] data) {
return getDownloadRequest(playbackProperties.uri.toString(), data);
}
......@@ -744,8 +736,6 @@ public final class DownloadHelper {
* @param data Application provided data to store in {@link DownloadRequest#data}.
* @return The built {@link DownloadRequest}.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public DownloadRequest getDownloadRequest(String id, @Nullable byte[] data) {
DownloadRequest.Builder requestBuilder =
new DownloadRequest.Builder(id, playbackProperties.uri)
......
......@@ -44,16 +44,9 @@ public final class DownloadRequest implements Parcelable {
private final Uri uri;
@Nullable private String mimeType;
@Nullable private List<StreamKey> streamKeys;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private byte[] keySetId;
@Nullable private byte[] keySetId;
@Nullable private String customCacheKey;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private byte[] data;
@Nullable private byte[] data;
/** Creates a new instance with the specified id and uri. */
public Builder(String id, Uri uri) {
......@@ -74,8 +67,6 @@ public final class DownloadRequest implements Parcelable {
}
/** Sets the {@link DownloadRequest#keySetId}. */
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public Builder setKeySetId(@Nullable byte[] keySetId) {
this.keySetId = keySetId;
return this;
......@@ -88,8 +79,6 @@ public final class DownloadRequest implements Parcelable {
}
/** Sets the {@link DownloadRequest#data}. */
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public Builder setData(@Nullable byte[] data) {
this.data = data;
return this;
......@@ -120,10 +109,7 @@ public final class DownloadRequest implements Parcelable {
/** Stream keys to be downloaded. If empty, all streams will be downloaded. */
public final List<StreamKey> streamKeys;
/** The key set id of the offline licence if the content is protected with DRM. */
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
public final byte[] keySetId;
@Nullable public final byte[] keySetId;
/**
* Custom key for cache indexing, or null. Must be null for DASH, HLS and SmoothStreaming
* downloads.
......@@ -140,8 +126,6 @@ public final class DownloadRequest implements Parcelable {
* @param customCacheKey See {@link #customCacheKey}.
* @param data See {@link #data}.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
private DownloadRequest(
String id,
Uri uri,
......@@ -197,8 +181,6 @@ public final class DownloadRequest implements Parcelable {
* @param keySetId The key set ID of the copy.
* @return The copy with the specified key set ID.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public DownloadRequest copyWithKeySetId(@Nullable byte[] keySetId) {
return new DownloadRequest(id, uri, mimeType, streamKeys, keySetId, customCacheKey, data);
}
......
......@@ -114,8 +114,6 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
* @param mediaSourceEventDispatcher A dispatcher to notify of {@link MediaSourceEventListener}
* events.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public ChunkSampleStream(
int primaryTrackType,
@Nullable int[] embeddedTrackTypes,
......
......@@ -45,8 +45,6 @@ public abstract class DataChunk extends Chunk {
* @param trackSelectionData See {@link #trackSelectionData}.
* @param data An optional recycled array that can be used as a holder for the data.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public DataChunk(
DataSource dataSource,
DataSpec dataSpec,
......
......@@ -138,10 +138,7 @@ public final class MediaParserChunkExtractor implements ChunkExtractor {
// Internal methods.
private void maybeExecutePendingSeek() {
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Nullable
MediaParser.SeekMap dummySeekMap = outputConsumerAdapter.getDummySeekMap();
@Nullable MediaParser.SeekMap dummySeekMap = outputConsumerAdapter.getDummySeekMap();
if (pendingSeekUs != C.TIME_UNSET && dummySeekMap != null) {
mediaParser.seek(dummySeekMap.getSeekPoints(pendingSeekUs).first);
pendingSeekUs = C.TIME_UNSET;
......
......@@ -55,8 +55,6 @@ public final class ByteArrayDataSink implements DataSink {
* Returns the data written to the sink since the last call to {@link #open(DataSpec)}, or null if
* {@link #open(DataSpec)} has never been called.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
public byte[] getData() {
return stream == null ? null : stream.toByteArray();
......
......@@ -34,11 +34,7 @@ public final class DataSchemeDataSource extends BaseDataSource {
public static final String SCHEME_DATA = "data";
@Nullable private DataSpec dataSpec;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private byte[] data;
@Nullable private byte[] data;
private int endPosition;
private int readPosition;
......
......@@ -32,11 +32,7 @@ public final class DefaultAllocator implements Allocator {
private final boolean trimOnReset;
private final int individualAllocationSize;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
private final byte[] initialAllocationBlock;
@Nullable private final byte[] initialAllocationBlock;
private final Allocation[] singleAllocationReleaseHolder;
private int targetBufferSize;
......
......@@ -334,11 +334,7 @@ public final class Loader implements LoaderErrorThrower {
private final T loadable;
private final long startTimeMs;
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Nullable
private Loader.Callback<T> callback;
@Nullable private Loader.Callback<T> callback;
@Nullable private IOException currentError;
private int errorCount;
......
......@@ -45,8 +45,6 @@ import java.util.Map;
* Returns the {@code encryptionKey} cached against this {@code uri}, or null if {@code uri} is
* null or not present in the cache.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
public byte[] get(@Nullable Uri uri) {
if (uri == null) {
......@@ -60,8 +58,6 @@ import java.util.Map;
*
* @throws NullPointerException if {@code uri} or {@code encryptionKey} are null.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
public byte[] put(Uri uri, byte[] encryptionKey) {
return backingMap.put(Assertions.checkNotNull(uri), Assertions.checkNotNull(encryptionKey));
......@@ -82,8 +78,6 @@ import java.util.Map;
*
* @throws NullPointerException if {@code uri} is null.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
public byte[] remove(Uri uri) {
return backingMap.remove(Assertions.checkNotNull(uri));
......
......@@ -669,10 +669,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return null;
}
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
byte[] encryptionKey = keyCache.remove(keyUri);
@Nullable byte[] encryptionKey = keyCache.remove(keyUri);
if (encryptionKey != null) {
// The key was present in the key cache. We re-insert it to prevent it from being evicted by
// the following key addition. Note that removal of the key is necessary to affect the
......@@ -691,8 +688,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
scratchSpace);
}
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Nullable
private static Uri getFullEncryptionKeyUri(
HlsMediaPlaylist playlist, @Nullable HlsMediaPlaylist.SegmentBase segmentBase) {
......@@ -796,8 +791,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
/** Return the result of this chunk, or null if loading is not complete. */
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
public byte[] getResult() {
return result;
......
......@@ -73,8 +73,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* @param initSegmentKey The initialization segment decryption key, if fully encrypted. Null
* otherwise.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
public static HlsMediaChunk createInstance(
HlsExtractorFactory extractorFactory,
DataSource dataSource,
......@@ -99,8 +97,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
mediaSegment.byteRangeOffset,
mediaSegment.byteRangeLength);
boolean mediaSegmentEncrypted = mediaSegmentKey != null;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
byte[] mediaSegmentIv =
mediaSegmentEncrypted
......@@ -115,8 +111,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@Nullable DataSource initDataSource = null;
if (initSegment != null) {
initSegmentEncrypted = initSegmentKey != null;
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Nullable
byte[] initSegmentIv =
initSegmentEncrypted
......@@ -542,8 +536,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*
* <p>{@code fullSegmentEncryptionKey} & {@code encryptionIv} can either both be null, or neither.
*/
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
private static DataSource buildDataSource(
DataSource dataSource,
@Nullable byte[] fullSegmentEncryptionKey,
......
......@@ -211,8 +211,6 @@ public final class HlsMediaSource extends BaseMediaSource
* @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances.
* @return This factory, for convenience.
*/
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
public Factory setPlaylistTrackerFactory(
@Nullable HlsPlaylistTracker.Factory playlistTrackerFactory) {
this.playlistTrackerFactory =
......@@ -297,8 +295,6 @@ public final class HlsMediaSource extends BaseMediaSource
return this;
}
// nullness annotations are not applicable to outer types
@SuppressWarnings("nullness:nullness.on.outer")
@Override
public Factory setDrmHttpDataSourceFactory(
@Nullable HttpDataSource.Factory drmHttpDataSourceFactory) {
......
......@@ -255,8 +255,6 @@ public final class MediaParserHlsMediaChunkExtractor implements HlsMediaChunkExt
this.extractorInput = extractorInput;
}
// nullness annotations are not applicable to primitive types
@SuppressWarnings("nullness:nullness.on.primitive")
@Override
public int read(@NonNull byte[] buffer, int offset, int readLength) throws IOException {
int peekedBytes = extractorInput.peek(buffer, offset, readLength);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment