Commit 3e5ae92b by andrewlewis Committed by christosts

Fix some minor nits

PiperOrigin-RevId: 509879029
parent 482871fe
Showing with 83 additions and 83 deletions
......@@ -136,6 +136,7 @@ public interface FrameProcessor {
* @param inputBitmap The {@link Bitmap} queued to the {@link FrameProcessor}.
* @param durationUs The duration for which to display the {@code inputBitmap}, in microseconds.
* @param frameRate The frame rate at which to display the {@code inputBitmap}, in frames per
* second.
*/
// TODO(b/262693274): Remove duration and frameRate parameters when EditedMediaItem can be
// signalled down to the processors.
......
......@@ -106,7 +106,7 @@ public final class CropPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -127,7 +127,7 @@ public final class CropPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -148,7 +148,7 @@ public final class CropPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......
......@@ -109,7 +109,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight);
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -131,7 +131,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight);
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -151,7 +151,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight);
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -171,7 +171,7 @@ public final class MatrixShaderProgramPixelTest {
Bitmap actualBitmap = createArgb8888BitmapFromCurrentGlFramebuffer(inputWidth, inputHeight);
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......
......@@ -115,7 +115,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -136,7 +136,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -157,7 +157,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -180,7 +180,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -203,7 +203,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -224,7 +224,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......@@ -245,7 +245,7 @@ public final class PresentationPixelTest {
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.getWidth(), outputSize.getHeight());
maybeSaveTestBitmapToCacheDirectory(testId, /* bitmapLabel= */ "actual", actualBitmap);
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
......
......@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* Forwards externally produced frames that become available via a {@link SurfaceTexture} to an
* {@link ExternalShaderProgram} for consumption.
*/
/* package */ class ExternalTextureManager implements InputListener {
/* package */ final class ExternalTextureManager implements InputListener {
private final FrameProcessingTaskExecutor frameProcessingTaskExecutor;
private final ExternalShaderProgram externalShaderProgram;
......
......@@ -27,7 +27,7 @@ import com.google.android.exoplayer2.util.FrameProcessingException;
* <p>Example usage: cache the processed frames when presenting them on screen, to accommodate for
* the possible fluctuation in frame processing time between frames.
*/
public class FrameCache implements GlEffect {
public final class FrameCache implements GlEffect {
/** The capacity of the frame cache. */
public final int capacity;
......
......@@ -35,7 +35,7 @@ import java.util.concurrent.Executor;
*
* <p>Implements {@link FrameCache}.
*/
/* package */ class FrameCacheShaderProgram implements GlShaderProgram {
/* package */ final class FrameCacheShaderProgram implements GlShaderProgram {
private static final String VERTEX_SHADER_TRANSFORMATION_ES2_PATH =
"shaders/vertex_shader_transformation_es2.glsl";
private static final String FRAGMENT_SHADER_TRANSFORMATION_ES2_PATH =
......
......@@ -30,11 +30,11 @@ import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* Forwards a frame produced from a {@link Bitmap} to a {@link GlShaderProgram} for consumption
* Forwards a frame produced from a {@link Bitmap} to a {@link GlShaderProgram} for consumption.
*
* <p>Methods in this class can be called from any thread.
*/
/* package */ class InternalTextureManager implements GlShaderProgram.InputListener {
/* package */ final class InternalTextureManager implements GlShaderProgram.InputListener {
private final GlShaderProgram shaderProgram;
private final FrameProcessingTaskExecutor frameProcessingTaskExecutor;
// The queue holds all bitmaps with one or more frames pending to be sent downstream.
......@@ -94,7 +94,7 @@ import java.util.concurrent.LinkedBlockingQueue;
frameProcessingTaskExecutor.submit(
() -> {
inputEnded = true;
signalEndOfOutput();
maybeSignalEndOfOutput();
});
}
......@@ -145,12 +145,12 @@ import java.util.concurrent.LinkedBlockingQueue;
currentPresentationTimeUs += currentBitmap.frameDurationUs;
if (framesToQueueForCurrentBitmap == 0) {
pendingBitmaps.remove();
signalEndOfOutput();
maybeSignalEndOfOutput();
}
}
@WorkerThread
private void signalEndOfOutput() {
private void maybeSignalEndOfOutput() {
if (framesToQueueForCurrentBitmap == 0
&& pendingBitmaps.isEmpty()
&& inputEnded
......@@ -160,10 +160,7 @@ import java.util.concurrent.LinkedBlockingQueue;
}
}
/**
* Value class specifying 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 {
public final TextureInfo textureInfo;
public final long frameDurationUs;
......
......@@ -38,12 +38,13 @@ public final class OverlaySettings {
/** A builder for {@link OverlaySettings} instances. */
public static final class Builder {
private boolean useHdr;
private float alpha = 1;
private float alpha;
private float[] matrix;
private Pair<Float, Float> anchor;
/** Creates a new {@link Builder}. */
public Builder() {
alpha = 1f;
matrix = GlUtil.create4x4IdentityMatrix();
anchor = Pair.create(0f, 0f);
}
......@@ -94,18 +95,14 @@ public final class OverlaySettings {
* <p>The coordinates are specified in Normalised Device Coordinates (NDCs). Set to always
* return {@code (0,0)} (the center) by default.
*
* @param x the NDC x-coordinate.
* @param y the NDC y-coordinate.
* @param x The NDC x-coordinate in the range [-1, 1].
* @param y The NDC y-coordinate in the range [-1, 1].
*/
@CanIgnoreReturnValue
public Builder setAnchor(
@FloatRange(from = -1, to = 1) float x, @FloatRange(from = -1, to = 1) float y) {
checkArgument(
-1 <= x && x <= 1,
"x needs to be specified in terms of NDCs which lie in the interval [-1, 1].");
checkArgument(
-1 <= y && y <= 1,
"y needs to be specified in terms of NDCs which lie in the interval [-1, 1].");
checkArgument(-1 <= x && x <= 1);
checkArgument(-1 <= y && y <= 1);
this.anchor = Pair.create(x, y);
return this;
}
......
......@@ -139,7 +139,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
}
Log.i(TAG, "Successfully tone mapped.");
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference)
......@@ -202,7 +202,7 @@ public final class ToneMapHdrToSdrUsingOpenGlPixelTest {
}
Log.i(TAG, "Successfully tone mapped.");
// TODO(b/207848601): switch to using proper tooling for testing against golden data.
// TODO(b/207848601): Switch to using proper tooling for testing against golden data.
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(expectedBitmap, actualBitmap, testId);
assertThat(averagePixelAbsoluteDifference)
......
......@@ -22,7 +22,6 @@ import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSE
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_1080P_5_SECOND_HLG10_FORMAT;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.recordTestSkipped;
import static com.google.android.exoplayer2.transformer.mh.FileUtil.assertFileHasColorTransfer;
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
import android.content.Context;
import android.net.Uri;
......@@ -91,10 +90,9 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(testId, mediaItem);
Log.i(TAG, "Tone mapped.");
assertFileHasColorTransfer(exportTestResult.filePath, C.COLOR_TRANSFER_SDR);
} catch (TransformationException exception) {
Log.i(TAG, checkNotNull(exception.getCause()).toString());
Log.e(TAG, "Error during transformation.", exception);
if (exception.errorCode != TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED) {
throw exception;
}
......@@ -142,10 +140,9 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(testId, mediaItem);
Log.i(TAG, "Tone mapped.");
assertFileHasColorTransfer(exportTestResult.filePath, C.COLOR_TRANSFER_SDR);
} catch (TransformationException exception) {
Log.i(TAG, checkNotNull(exception.getCause()).toString());
Log.e(TAG, "Error during transformation.", exception);
if (exception.errorCode != TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED) {
throw exception;
}
......
......@@ -299,18 +299,18 @@ public final class ExoPlayerAssetLoader implements AssetLoader {
if (tracks.isTypeSelected(C.TRACK_TYPE_VIDEO)) {
trackCount++;
}
if (trackCount == 0) {
if (trackCount > 0) {
assetLoaderListener.onTrackCount(trackCount);
// Start the renderers after having registered all the tracks to make sure the AssetLoader
// listener callbacks are called in the right order.
player.play();
} else {
assetLoaderListener.onError(
TransformationException.createForAssetLoader(
new IllegalStateException("The asset loader has no track to output."),
ERROR_CODE_FAILED_RUNTIME_CHECK));
return;
} else {
assetLoaderListener.onTrackCount(trackCount);
}
// Start the renderers after having registered all the tracks to make sure the AssetLoader
// listener callbacks are called in the right order.
player.play();
}
@Override
......
......@@ -399,7 +399,7 @@ public final class Transformer {
* <li>Duration will match duration of the input media.
* <li>Sample mime type will match {@link TransformationRequest#audioMimeType}, or {@link
* MimeTypes#AUDIO_AAC} if {@code null}.
* <li>Sample rate will be {@code 44100} hz. This can be modified by creating a {@link
* <li>Sample rate will be {@code 44100} Hz. This can be modified by creating a {@link
* SonicAudioProcessor}, setting its {@linkplain
* SonicAudioProcessor#setOutputSampleRateHz(int) sample rate}, and passing it to the
* {@link EditedMediaItem} used to start the export.
......@@ -422,8 +422,8 @@ public final class Transformer {
*
* @throws IllegalStateException If both audio and video have been removed (otherwise the output
* would not contain any samples).
* @throws IllegalStateException If the muxer doesn't support the requested audio MIME type.
* @throws IllegalStateException If the muxer doesn't support the requested video MIME type.
* @throws IllegalStateException If the muxer doesn't support the requested audio/video MIME
* type.
*/
public Transformer build() {
if (transformationRequest.audioMimeType != null) {
......
......@@ -55,6 +55,9 @@ import org.checkerframework.dataflow.qual.Pure;
/** Pipeline to process, re-encode and mux raw video frames. */
/* package */ final class VideoSamplePipeline extends SamplePipeline {
/** MIME type to use for output video if the input type is not a video. */
private static final String DEFAULT_OUTPUT_MIME_TYPE = MimeTypes.VIDEO_H265;
private final FrameProcessor frameProcessor;
private final ColorInfo frameProcessorInputColor;
private final FrameInfo firstFrameInfo;
......@@ -364,7 +367,7 @@ import org.checkerframework.dataflow.qual.Pure;
if (transformationRequest.videoMimeType != null) {
requestedOutputMimeType = transformationRequest.videoMimeType;
} else if (MimeTypes.isImage(inputSampleMimeType)) {
requestedOutputMimeType = MimeTypes.VIDEO_H265;
requestedOutputMimeType = DEFAULT_OUTPUT_MIME_TYPE;
} else {
requestedOutputMimeType = inputSampleMimeType;
}
......
......@@ -84,7 +84,8 @@ public class EncoderUtilTest {
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(encoderInfo, VIDEO_H264, 1920, 1080);
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, /* width= */ 1920, /* height= */ 1080);
assertThat(closestSupportedResolution).isNotNull();
assertThat(closestSupportedResolution.getWidth()).isEqualTo(1920);
......@@ -98,7 +99,8 @@ public class EncoderUtilTest {
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(encoderInfo, VIDEO_H264, 1919, 1081);
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, /* width= */ 1919, /* height= */ 1081);
assertThat(closestSupportedResolution).isNotNull();
assertThat(closestSupportedResolution.getWidth()).isEqualTo(1920);
......@@ -113,7 +115,8 @@ public class EncoderUtilTest {
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(encoderInfo, VIDEO_H264, 1920, 1920);
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, /* width= */ 1920, /* height= */ 1920);
assertThat(closestSupportedResolution).isNotNull();
assertThat(closestSupportedResolution.getWidth()).isEqualTo(1440);
......@@ -127,7 +130,8 @@ public class EncoderUtilTest {
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(encoderInfo, VIDEO_H264, 2880, 1620);
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, /* width= */ 2880, /* height= */ 1620);
assertThat(closestSupportedResolution).isNotNull();
assertThat(closestSupportedResolution.getWidth()).isEqualTo(1920);
......@@ -141,7 +145,8 @@ public class EncoderUtilTest {
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(encoderInfo, VIDEO_H264, 2160, 3840);
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, /* width= */ 2160, /* height= */ 3840);
assertThat(closestSupportedResolution).isNotNull();
assertThat(closestSupportedResolution.getWidth()).isEqualTo(1080);
......@@ -155,7 +160,8 @@ public class EncoderUtilTest {
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(encoderInfo, VIDEO_H264, 7680, 4320);
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, /* width= */ 7680, /* height= */ 4320);
assertThat(closestSupportedResolution).isNotNull();
assertThat(closestSupportedResolution.getWidth()).isEqualTo(1920);
......@@ -167,16 +173,15 @@ public class EncoderUtilTest {
ImmutableList<MediaCodecInfo> supportedEncoders = EncoderUtil.getSupportedEncoders(VIDEO_H264);
MediaCodecInfo encoderInfo = supportedEncoders.get(0);
double aspectRatio = 1.5;
@Nullable
Size closestSupportedResolution =
EncoderUtil.getSupportedResolution(
encoderInfo, VIDEO_H264, (int) (aspectRatio * 5000), 5000);
encoderInfo, VIDEO_H264, /* width= */ 7500, /* height= */ 5000);
assertThat(closestSupportedResolution).isNotNull();
assertThat(
(double) closestSupportedResolution.getWidth() / closestSupportedResolution.getHeight())
.isEqualTo(aspectRatio);
.isEqualTo(7500.0 / 5000);
}
/**
......
......@@ -38,7 +38,7 @@ import java.nio.ByteBuffer;
import org.checkerframework.checker.nullness.qual.Nullable;
/** Utilities for decoding a frame for tests. */
public class DecodeOneFrameUtil {
public final class DecodeOneFrameUtil {
public static final String NO_DECODER_SUPPORT_ERROR_STRING =
"No MediaCodec decoders on this device support this value.";
......
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