mirror of
https://github.com/samsonjs/media.git
synced 2026-04-21 13:55:47 +00:00
Add NonNull at package level for extractor
PiperOrigin-RevId: 286381499
This commit is contained in:
parent
fc4b258c10
commit
0f94ebfb7d
7 changed files with 30 additions and 8 deletions
|
|
@ -91,7 +91,7 @@ public abstract class BinarySearchSeeker {
|
|||
|
||||
protected final BinarySearchSeekMap seekMap;
|
||||
protected final TimestampSeeker timestampSeeker;
|
||||
protected @Nullable SeekOperationParams seekOperationParams;
|
||||
@Nullable protected SeekOperationParams seekOperationParams;
|
||||
|
||||
private final int minimumSearchRange;
|
||||
|
||||
|
|
@ -173,7 +173,6 @@ public abstract class BinarySearchSeeker {
|
|||
*/
|
||||
public int handlePendingSeek(ExtractorInput input, PositionHolder seekPositionHolder)
|
||||
throws InterruptedException, IOException {
|
||||
TimestampSeeker timestampSeeker = Assertions.checkNotNull(this.timestampSeeker);
|
||||
while (true) {
|
||||
SeekOperationParams seekOperationParams = Assertions.checkNotNull(this.seekOperationParams);
|
||||
long floorPosition = seekOperationParams.getFloorBytePosition();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public final class ChunkIndex implements SeekMap {
|
|||
* @return The index of the corresponding chunk.
|
||||
*/
|
||||
public int getChunkIndex(long timeUs) {
|
||||
return Util.binarySearchFloor(timesUs, timeUs, true, true);
|
||||
return Util.binarySearchFloor(timesUs, timeUs, /* inclusive= */ true, /* stayInBounds= */ true);
|
||||
}
|
||||
|
||||
// SeekMap implementation.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.extractor;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.extractor.amr.AmrExtractor;
|
||||
import com.google.android.exoplayer2.extractor.flac.FlacExtractor;
|
||||
import com.google.android.exoplayer2.extractor.flv.FlvExtractor;
|
||||
|
|
@ -56,10 +57,11 @@ import java.lang.reflect.Constructor;
|
|||
*/
|
||||
public final class DefaultExtractorsFactory implements ExtractorsFactory {
|
||||
|
||||
@Nullable
|
||||
private static final Constructor<? extends Extractor> FLAC_EXTENSION_EXTRACTOR_CONSTRUCTOR;
|
||||
|
||||
static {
|
||||
Constructor<? extends Extractor> flacExtensionExtractorConstructor = null;
|
||||
@Nullable Constructor<? extends Extractor> flacExtensionExtractorConstructor = null;
|
||||
try {
|
||||
// LINT.IfChange
|
||||
flacExtensionExtractorConstructor =
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public final class FlacMetadataReader {
|
|||
if (type == FlacConstants.METADATA_TYPE_STREAM_INFO) {
|
||||
metadataHolder.flacStreamMetadata = readStreamInfoBlock(input);
|
||||
} else {
|
||||
FlacStreamMetadata flacStreamMetadata = metadataHolder.flacStreamMetadata;
|
||||
@Nullable FlacStreamMetadata flacStreamMetadata = metadataHolder.flacStreamMetadata;
|
||||
if (flacStreamMetadata == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.extractor;
|
||||
|
||||
import static com.google.android.exoplayer2.util.Util.castNonNull;
|
||||
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.metadata.Metadata;
|
||||
import com.google.android.exoplayer2.metadata.id3.CommentFrame;
|
||||
|
|
@ -107,8 +109,8 @@ public final class GaplessInfoHolder {
|
|||
Matcher matcher = GAPLESS_COMMENT_PATTERN.matcher(data);
|
||||
if (matcher.find()) {
|
||||
try {
|
||||
int encoderDelay = Integer.parseInt(matcher.group(1), 16);
|
||||
int encoderPadding = Integer.parseInt(matcher.group(2), 16);
|
||||
int encoderDelay = Integer.parseInt(castNonNull(matcher.group(1)), 16);
|
||||
int encoderPadding = Integer.parseInt(castNonNull(matcher.group(2)), 16);
|
||||
if (encoderDelay > 0 || encoderPadding > 0) {
|
||||
this.encoderDelay = encoderDelay;
|
||||
this.encoderPadding = encoderPadding;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public final class Id3Peeker {
|
|||
ExtractorInput input, @Nullable Id3Decoder.FramePredicate id3FramePredicate)
|
||||
throws IOException, InterruptedException {
|
||||
int peekedId3Bytes = 0;
|
||||
Metadata metadata = null;
|
||||
@Nullable Metadata metadata = null;
|
||||
while (true) {
|
||||
try {
|
||||
input.peekFully(scratch.data, /* offset= */ 0, Id3Decoder.ID3_HEADER_LENGTH);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@NonNullApi
|
||||
package com.google.android.exoplayer2.extractor;
|
||||
|
||||
import com.google.android.exoplayer2.util.NonNullApi;
|
||||
Loading…
Reference in a new issue