mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add missing empty lines
PiperOrigin-RevId: 539100987
This commit is contained in:
parent
3cf21bd5d5
commit
edf30433b6
@ -42,19 +42,23 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
/* package */ final class BitmapTextureManager implements TextureManager {
|
/* package */ final class BitmapTextureManager implements TextureManager {
|
||||||
|
|
||||||
private static final String UNSUPPORTED_IMAGE_CONFIGURATION =
|
private static final String UNSUPPORTED_IMAGE_CONFIGURATION =
|
||||||
"Unsupported Image Configuration: No more than 8 bits of precision should be used for each"
|
"Unsupported Image Configuration: No more than 8 bits of precision should be used for each"
|
||||||
+ " RGB channel.";
|
+ " RGB channel.";
|
||||||
|
|
||||||
private final GlShaderProgram shaderProgram;
|
private final GlShaderProgram shaderProgram;
|
||||||
private final VideoFrameProcessingTaskExecutor videoFrameProcessingTaskExecutor;
|
private final VideoFrameProcessingTaskExecutor videoFrameProcessingTaskExecutor;
|
||||||
// The queue holds all bitmaps with one or more frames pending to be sent downstream.
|
// The queue holds all bitmaps with one or more frames pending to be sent downstream.
|
||||||
private final Queue<BitmapFrameSequenceInfo> pendingBitmaps;
|
private final Queue<BitmapFrameSequenceInfo> pendingBitmaps;
|
||||||
|
|
||||||
private @MonotonicNonNull GlTextureInfo currentGlTextureInfo;
|
private @MonotonicNonNull GlTextureInfo currentGlTextureInfo;
|
||||||
private int downstreamShaderProgramCapacity;
|
private int downstreamShaderProgramCapacity;
|
||||||
private int framesToQueueForCurrentBitmap;
|
private int framesToQueueForCurrentBitmap;
|
||||||
private double currentPresentationTimeUs;
|
private double currentPresentationTimeUs;
|
||||||
private boolean useHdr;
|
private boolean useHdr;
|
||||||
private boolean currentInputStreamEnded;
|
private boolean currentInputStreamEnded;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
*
|
*
|
||||||
@ -140,6 +144,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
checkState(
|
checkState(
|
||||||
!bitmap.getConfig().equals(Bitmap.Config.RGBA_1010102), UNSUPPORTED_IMAGE_CONFIGURATION);
|
!bitmap.getConfig().equals(Bitmap.Config.RGBA_1010102), UNSUPPORTED_IMAGE_CONFIGURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.useHdr = useHdr;
|
this.useHdr = useHdr;
|
||||||
int framesToAdd = round(frameRate * (durationUs / (float) C.MICROS_PER_SECOND));
|
int framesToAdd = round(frameRate * (durationUs / (float) C.MICROS_PER_SECOND));
|
||||||
double frameDurationUs = C.MICROS_PER_SECOND / frameRate;
|
double frameDurationUs = C.MICROS_PER_SECOND / frameRate;
|
||||||
@ -152,6 +157,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
if (pendingBitmaps.isEmpty() || downstreamShaderProgramCapacity == 0) {
|
if (pendingBitmaps.isEmpty() || downstreamShaderProgramCapacity == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapFrameSequenceInfo currentBitmapInfo = checkNotNull(pendingBitmaps.peek());
|
BitmapFrameSequenceInfo currentBitmapInfo = checkNotNull(pendingBitmaps.peek());
|
||||||
if (framesToQueueForCurrentBitmap == 0) {
|
if (framesToQueueForCurrentBitmap == 0) {
|
||||||
Bitmap bitmap = currentBitmapInfo.bitmap;
|
Bitmap bitmap = currentBitmapInfo.bitmap;
|
||||||
@ -173,6 +179,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
} catch (GlUtil.GlException e) {
|
} catch (GlUtil.GlException e) {
|
||||||
throw VideoFrameProcessingException.from(e);
|
throw VideoFrameProcessingException.from(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentGlTextureInfo =
|
currentGlTextureInfo =
|
||||||
new GlTextureInfo(
|
new GlTextureInfo(
|
||||||
currentTexId,
|
currentTexId,
|
||||||
@ -181,11 +188,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
currentBitmapInfo.frameInfo.width,
|
currentBitmapInfo.frameInfo.width,
|
||||||
currentBitmapInfo.frameInfo.height);
|
currentBitmapInfo.frameInfo.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
framesToQueueForCurrentBitmap--;
|
framesToQueueForCurrentBitmap--;
|
||||||
downstreamShaderProgramCapacity--;
|
downstreamShaderProgramCapacity--;
|
||||||
shaderProgram.queueInputFrame(
|
shaderProgram.queueInputFrame(
|
||||||
checkNotNull(currentGlTextureInfo), round(currentPresentationTimeUs));
|
checkNotNull(currentGlTextureInfo), round(currentPresentationTimeUs));
|
||||||
currentPresentationTimeUs += currentBitmapInfo.frameDurationUs;
|
currentPresentationTimeUs += currentBitmapInfo.frameDurationUs;
|
||||||
|
|
||||||
if (framesToQueueForCurrentBitmap == 0) {
|
if (framesToQueueForCurrentBitmap == 0) {
|
||||||
pendingBitmaps.remove();
|
pendingBitmaps.remove();
|
||||||
if (pendingBitmaps.isEmpty() && currentInputStreamEnded) {
|
if (pendingBitmaps.isEmpty() && currentInputStreamEnded) {
|
||||||
@ -196,6 +205,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Information to generate all the frames associated with a specific {@link Bitmap}. */
|
/** Information to generate all the frames associated with a specific {@link Bitmap}. */
|
||||||
private static final class BitmapFrameSequenceInfo {
|
private static final class BitmapFrameSequenceInfo {
|
||||||
public final Bitmap bitmap;
|
public final Bitmap bitmap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user