mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix Gradle Lint with @RequiresApi and SDK version
Gradle Lint doesn't recognise `checkState` assertion and TargetApi should only ever be used for suppressing a bug in Android Lint. Hence, we keep @RequiresApi and add an if-statement explicitly. Also, fixes >26 to >=26 for the version check.
PiperOrigin-RevId: 555144577
(cherry picked from commit f7c31bd3ef)
This commit is contained in:
parent
4af6fcb838
commit
2fb3a45b6c
1 changed files with 4 additions and 4 deletions
|
|
@ -15,15 +15,14 @@
|
||||||
*/
|
*/
|
||||||
package androidx.media3.transformer.mh;
|
package androidx.media3.transformer.mh;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkState;
|
|
||||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.os.Build;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import androidx.media3.common.GlTextureInfo;
|
import androidx.media3.common.GlTextureInfo;
|
||||||
import androidx.media3.common.VideoFrameProcessingException;
|
import androidx.media3.common.VideoFrameProcessingException;
|
||||||
import androidx.media3.common.util.GlUtil;
|
import androidx.media3.common.util.GlUtil;
|
||||||
import androidx.media3.common.util.Util;
|
|
||||||
import androidx.media3.effect.DefaultVideoFrameProcessor;
|
import androidx.media3.effect.DefaultVideoFrameProcessor;
|
||||||
import androidx.media3.test.utils.BitmapPixelTestUtil;
|
import androidx.media3.test.utils.BitmapPixelTestUtil;
|
||||||
import androidx.media3.test.utils.VideoFrameProcessorTestRunner;
|
import androidx.media3.test.utils.VideoFrameProcessorTestRunner;
|
||||||
|
|
@ -39,7 +38,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
* <p>Reads from an OpenGL texture. Only for use on physical devices.
|
* <p>Reads from an OpenGL texture. Only for use on physical devices.
|
||||||
*/
|
*/
|
||||||
public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.BitmapReader {
|
public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.BitmapReader {
|
||||||
// TODO(b/239172735): This outputs an incorrect black output image on emulators.
|
|
||||||
private final Map<Long, Bitmap> outputTimestampsToBitmaps;
|
private final Map<Long, Bitmap> outputTimestampsToBitmaps;
|
||||||
private boolean useHighPrecisionColorComponents;
|
private boolean useHighPrecisionColorComponents;
|
||||||
private @MonotonicNonNull Bitmap outputBitmap;
|
private @MonotonicNonNull Bitmap outputBitmap;
|
||||||
|
|
@ -91,7 +89,9 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
|
||||||
if (!useHighPrecisionColorComponents) {
|
if (!useHighPrecisionColorComponents) {
|
||||||
return BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
|
return BitmapPixelTestUtil.createArgb8888BitmapFromCurrentGlFramebuffer(width, height);
|
||||||
}
|
}
|
||||||
checkState(Util.SDK_INT > 26, "useHighPrecisionColorComponents only supported on API 26+");
|
if (Build.VERSION.SDK_INT < 26) {
|
||||||
|
throw new IllegalStateException("useHighPrecisionColorComponents only supported on API 26+");
|
||||||
|
}
|
||||||
return BitmapPixelTestUtil.createFp16BitmapFromCurrentGlFramebuffer(width, height);
|
return BitmapPixelTestUtil.createFp16BitmapFromCurrentGlFramebuffer(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue