Effect: Use element instead of peek, when throwing if null.

If nullness should result in an exception, we should throw as soon as possible,
so that stack traces are easier to follow.

Did a quick scan of media3.effect+transformer and this covers all uses of
peek that immediately throw there.

PiperOrigin-RevId: 603393366
This commit is contained in:
huangdarwin 2024-02-01 09:27:37 -08:00 committed by Copybara-Service
parent 42ac0e5492
commit dd7846ee1c
2 changed files with 2 additions and 2 deletions

View File

@ -158,7 +158,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
return;
}
BitmapFrameSequenceInfo currentBitmapInfo = checkNotNull(pendingBitmaps.peek());
BitmapFrameSequenceInfo currentBitmapInfo = pendingBitmaps.element();
FrameInfo currentFrameInfo = currentBitmapInfo.frameInfo;
TimestampIterator inStreamOffsetsUs = currentBitmapInfo.inStreamOffsetsUs;
checkState(currentBitmapInfo.inStreamOffsetsUs.hasNext());

View File

@ -299,7 +299,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
surfaceTexture.updateTexImage();
availableFrameCount--;
this.currentFrame = pendingFrames.peek();
this.currentFrame = pendingFrames.element();
FrameInfo currentFrame = checkStateNotNull(this.currentFrame);
externalShaderProgramInputCapacity.decrementAndGet();