Commit ea3a85f8 by michaelkatz Committed by microkatz

Add RequiresApi annotations to some unittest methods

PiperOrigin-RevId: 518258380
parent 7c7a6298
...@@ -31,6 +31,7 @@ import android.media.Image; ...@@ -31,6 +31,7 @@ import android.media.Image;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.opengl.GLUtils; import android.opengl.GLUtils;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.util.GlUtil; import androidx.media3.common.util.GlUtil;
import androidx.media3.common.util.Log; import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
...@@ -83,6 +84,7 @@ public class BitmapPixelTestUtil { ...@@ -83,6 +84,7 @@ public class BitmapPixelTestUtil {
* Returns a bitmap with the same information as the provided alpha/red/green/blue 8-bits per * Returns a bitmap with the same information as the provided alpha/red/green/blue 8-bits per
* component image. * component image.
*/ */
@RequiresApi(19)
public static Bitmap createArgb8888BitmapFromRgba8888Image(Image image) { public static Bitmap createArgb8888BitmapFromRgba8888Image(Image image) {
int width = image.getWidth(); int width = image.getWidth();
int height = image.getHeight(); int height = image.getHeight();
......
...@@ -22,6 +22,7 @@ import static androidx.media3.test.utils.BitmapPixelTestUtil.maybeSaveTestBitmap ...@@ -22,6 +22,7 @@ import static androidx.media3.test.utils.BitmapPixelTestUtil.maybeSaveTestBitmap
import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import android.annotation.SuppressLint;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.media.Image; import android.media.Image;
...@@ -261,6 +262,7 @@ public final class VideoFrameProcessorTestRunner { ...@@ -261,6 +262,7 @@ public final class VideoFrameProcessorTestRunner {
/* releaseFramesAutomatically= */ true, /* releaseFramesAutomatically= */ true,
MoreExecutors.directExecutor(), MoreExecutors.directExecutor(),
new VideoFrameProcessor.Listener() { new VideoFrameProcessor.Listener() {
@SuppressLint("WrongConstant")
@Override @Override
public void onOutputSizeChanged(int width, int height) { public void onOutputSizeChanged(int width, int height) {
outputImageReader = outputImageReader =
...@@ -289,6 +291,7 @@ public final class VideoFrameProcessorTestRunner { ...@@ -289,6 +291,7 @@ public final class VideoFrameProcessorTestRunner {
}); });
} }
@RequiresApi(19)
public Bitmap processFirstFrameAndEnd() throws Exception { public Bitmap processFirstFrameAndEnd() throws Exception {
DecodeOneFrameUtil.decodeOneAssetFileFrame( DecodeOneFrameUtil.decodeOneAssetFileFrame(
checkNotNull(videoAssetPath), checkNotNull(videoAssetPath),
...@@ -321,6 +324,7 @@ public final class VideoFrameProcessorTestRunner { ...@@ -321,6 +324,7 @@ public final class VideoFrameProcessorTestRunner {
videoFrameProcessor.queueInputBitmap(inputBitmap, durationUs, frameRate); videoFrameProcessor.queueInputBitmap(inputBitmap, durationUs, frameRate);
} }
@RequiresApi(19)
public Bitmap endFrameProcessingAndGetImage() throws Exception { public Bitmap endFrameProcessingAndGetImage() throws Exception {
videoFrameProcessor.signalEndOfInput(); videoFrameProcessor.signalEndOfInput();
Thread.sleep(VIDEO_FRAME_PROCESSING_WAIT_MS); Thread.sleep(VIDEO_FRAME_PROCESSING_WAIT_MS);
......
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