Effect: Report errors during registerInputStream
Without this, GLSL compilation errors may lead to the test stalling indefinitely PiperOrigin-RevId: 603381111
This commit is contained in:
parent
198e3fb166
commit
42ac0e5492
@ -312,6 +312,7 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
public void onError(VideoFrameProcessingException exception) {
|
public void onError(VideoFrameProcessingException exception) {
|
||||||
videoFrameProcessingException.set(exception);
|
videoFrameProcessingException.set(exception);
|
||||||
checkNotNull(videoFrameProcessingEndedLatch).countDown();
|
checkNotNull(videoFrameProcessingEndedLatch).countDown();
|
||||||
|
videoFrameProcessorReadyCondition.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -340,12 +341,7 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
||||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||||
.build());
|
.build());
|
||||||
try {
|
awaitVideoFrameProcessorReady();
|
||||||
videoFrameProcessorReadyCondition.block();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
checkState(videoFrameProcessor.registerInputFrame());
|
checkState(videoFrameProcessor.registerInputFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,8 +361,11 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void queueInputBitmap(
|
public void queueInputBitmap(
|
||||||
Bitmap inputBitmap, long durationUs, long offsetToAddUs, float frameRate, ColorInfo colorInfo)
|
Bitmap inputBitmap,
|
||||||
throws InterruptedException {
|
long durationUs,
|
||||||
|
long offsetToAddUs,
|
||||||
|
float frameRate,
|
||||||
|
ColorInfo colorInfo) {
|
||||||
videoFrameProcessorReadyCondition.close();
|
videoFrameProcessorReadyCondition.close();
|
||||||
videoFrameProcessor.registerInputStream(
|
videoFrameProcessor.registerInputStream(
|
||||||
INPUT_TYPE_BITMAP,
|
INPUT_TYPE_BITMAP,
|
||||||
@ -375,20 +374,18 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||||
.setOffsetToAddUs(offsetToAddUs)
|
.setOffsetToAddUs(offsetToAddUs)
|
||||||
.build());
|
.build());
|
||||||
videoFrameProcessorReadyCondition.block();
|
awaitVideoFrameProcessorReady();
|
||||||
checkState(
|
checkState(
|
||||||
videoFrameProcessor.queueInputBitmap(
|
videoFrameProcessor.queueInputBitmap(
|
||||||
inputBitmap, new ConstantRateTimestampIterator(durationUs, frameRate)));
|
inputBitmap, new ConstantRateTimestampIterator(durationUs, frameRate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queueInputBitmaps(int width, int height, Pair<Bitmap, TimestampIterator>... frames)
|
public void queueInputBitmaps(int width, int height, Pair<Bitmap, TimestampIterator>... frames) {
|
||||||
throws InterruptedException {
|
|
||||||
queueInputBitmaps(width, height, ColorInfo.SRGB_BT709_FULL, frames);
|
queueInputBitmaps(width, height, ColorInfo.SRGB_BT709_FULL, frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queueInputBitmaps(
|
public void queueInputBitmaps(
|
||||||
int width, int height, ColorInfo colorInfo, Pair<Bitmap, TimestampIterator>... frames)
|
int width, int height, ColorInfo colorInfo, Pair<Bitmap, TimestampIterator>... frames) {
|
||||||
throws InterruptedException {
|
|
||||||
videoFrameProcessorReadyCondition.close();
|
videoFrameProcessorReadyCondition.close();
|
||||||
videoFrameProcessor.registerInputStream(
|
videoFrameProcessor.registerInputStream(
|
||||||
INPUT_TYPE_BITMAP,
|
INPUT_TYPE_BITMAP,
|
||||||
@ -396,7 +393,7 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
new FrameInfo.Builder(colorInfo, width, height)
|
new FrameInfo.Builder(colorInfo, width, height)
|
||||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||||
.build());
|
.build());
|
||||||
videoFrameProcessorReadyCondition.block();
|
awaitVideoFrameProcessorReady();
|
||||||
for (Pair<Bitmap, TimestampIterator> frame : frames) {
|
for (Pair<Bitmap, TimestampIterator> frame : frames) {
|
||||||
videoFrameProcessor.queueInputBitmap(frame.first, frame.second);
|
videoFrameProcessor.queueInputBitmap(frame.first, frame.second);
|
||||||
}
|
}
|
||||||
@ -419,7 +416,7 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
throw new VideoFrameProcessingException(e);
|
throw new VideoFrameProcessingException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
videoFrameProcessorReadyCondition.block();
|
awaitVideoFrameProcessorReady();
|
||||||
checkState(videoFrameProcessor.queueInputTexture(inputTexture.texId, pts));
|
checkState(videoFrameProcessor.queueInputTexture(inputTexture.texId, pts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,4 +554,14 @@ public final class VideoFrameProcessorTestRunner {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void awaitVideoFrameProcessorReady() {
|
||||||
|
try {
|
||||||
|
videoFrameProcessorReadyCondition.block();
|
||||||
|
assertThat(videoFrameProcessingException.get()).isNull();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user