Commit 4cc5080d by kimvde Committed by christosts

Rename occurrences of transform in lib-transformer

PiperOrigin-RevId: 510118760
parent 37768ed0
Showing with 69 additions and 73 deletions
......@@ -23,8 +23,7 @@ import org.json.JSONException;
import org.json.JSONObject;
/**
* A test only class for holding the details of what fallbacks were applied during a test
* transformation.
* A test only class for holding the details of what fallbacks were applied during a test export.
*/
/* package */ final class FallbackDetails {
......
......@@ -45,7 +45,7 @@ import org.json.JSONObject;
public class TransformerAndroidTestRunner {
private static final String TAG = "TransformerAndroidTest";
/** The default transformation timeout value. */
/** The default export timeout value. */
public static final int DEFAULT_TIMEOUT_SECONDS = 120;
/** A {@link Builder} for {@link TransformerAndroidTestRunner} instances. */
......@@ -61,7 +61,7 @@ public class TransformerAndroidTestRunner {
* Creates a {@link Builder}.
*
* @param context The {@link Context}.
* @param transformer The {@link Transformer} that performs the transformation.
* @param transformer The {@link Transformer} that performs the export.
*/
public Builder(Context context, Transformer transformer) {
this.context = context;
......@@ -70,7 +70,7 @@ public class TransformerAndroidTestRunner {
}
/**
* Sets the timeout in seconds for a single transformation. An exception is thrown when this is
* Sets the timeout in seconds for a single export. An exception is thrown when this is
* exceeded.
*
* <p>The default value is {@link #DEFAULT_TIMEOUT_SECONDS}.
......@@ -85,7 +85,7 @@ public class TransformerAndroidTestRunner {
}
/**
* Sets whether to calculate the SSIM of the transformation output compared to the input, if
* Sets whether to calculate the SSIM of the exported output compared to the input, if
* supported. Calculating SSIM is not supported if the input and output video dimensions don't
* match, or if the input video is trimmed.
*
......@@ -104,8 +104,8 @@ public class TransformerAndroidTestRunner {
}
/**
* Sets whether to suppress failures that occurs as a result of post-transformation analysis,
* such as SSIM calculation.
* Sets whether to suppress failures that occurs as a result of post-export analysis, such as
* SSIM calculation.
*
* <p>Regardless of this value, analysis exceptions are attached to the analysis file.
*
......@@ -124,13 +124,13 @@ public class TransformerAndroidTestRunner {
}
/**
* Sets a {@link Map} of transformer input values, which are propagated to the transformation
* summary JSON file.
* Sets a {@link Map} of transformer input values, which are propagated to the export summary
* JSON file.
*
* <p>Values in the map should be convertible according to {@link JSONObject#wrap(Object)} to be
* recorded properly in the summary file.
*
* @param inputValues A {@link Map} of values to be written to the transformation summary.
* @param inputValues A {@link Map} of values to be written to the export summary.
* @return This {@link Builder}.
*/
@CanIgnoreReturnValue
......@@ -337,7 +337,7 @@ public class TransformerAndroidTestRunner {
.build();
}
// No exceptions raised, transformation has succeeded.
// No exceptions raised, export has succeeded.
ExportTestResult.Builder testResultBuilder =
new ExportTestResult.Builder(
checkNotNull(exportResultReference.get())
......
......@@ -69,8 +69,8 @@ public class HdrEditingTest {
.build();
@Test
public void transform_noRequestedTranscode_hdr10File_transformsOrThrows() throws Exception {
String testId = "transform_noRequestedTranscode_hdr10File_transformsOrThrows";
public void export_noRequestedTranscode_hdr10File_exportsOrThrows() throws Exception {
String testId = "export_noRequestedTranscode_hdr10File_exportsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build();
......@@ -81,7 +81,7 @@ public class HdrEditingTest {
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(testId, mediaItem);
Log.i(TAG, "Transformed.");
Log.i(TAG, "Exported.");
assertFileHasColorTransfer(exportTestResult.filePath, C.COLOR_TRANSFER_ST2084);
} catch (ExportException exception) {
Log.i(TAG, checkNotNull(exception.getCause()).toString());
......@@ -94,8 +94,8 @@ public class HdrEditingTest {
}
@Test
public void transform_noRequestedTranscode_hlg10File_transformsOrThrows() throws Exception {
String testId = "transform_noRequestedTranscode_hlg10File_transformsOrThrows";
public void export_noRequestedTranscode_hlg10File_exportsOrThrows() throws Exception {
String testId = "export_noRequestedTranscode_hlg10File_exportsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build();
......@@ -106,7 +106,7 @@ public class HdrEditingTest {
new TransformerAndroidTestRunner.Builder(context, transformer)
.build()
.run(testId, mediaItem);
Log.i(TAG, "Transformed.");
Log.i(TAG, "Exported.");
assertFileHasColorTransfer(exportTestResult.filePath, C.COLOR_TRANSFER_HLG);
} catch (ExportException exception) {
Log.i(TAG, checkNotNull(exception.getCause()).toString());
......@@ -119,9 +119,8 @@ public class HdrEditingTest {
}
@Test
public void transformAndTranscode_hdr10File_whenHdrEditingIsSupported_transforms()
throws Exception {
String testId = "transformAndTranscode_hdr10File_whenHdrEditingIsSupported_transforms";
public void exportAndTranscode_hdr10File_whenHdrEditingIsSupported_exports() throws Exception {
String testId = "exportAndTranscode_hdr10File_whenHdrEditingIsSupported_exports";
Context context = ApplicationProvider.getApplicationContext();
if (!deviceSupportsHdrEditing(VIDEO_H265, HDR10_DEFAULT_COLOR_INFO)) {
recordTestSkipped(context, testId, /* reason= */ "Device lacks HDR10 editing support.");
......@@ -144,9 +143,8 @@ public class HdrEditingTest {
}
@Test
public void transformAndTranscode_hlg10File_whenHdrEditingIsSupported_transforms()
throws Exception {
String testId = "transformAndTranscode_hlg10File_whenHdrEditingIsSupported_transforms";
public void exportAndTranscode_hlg10File_whenHdrEditingIsSupported_exports() throws Exception {
String testId = "exportAndTranscode_hlg10File_whenHdrEditingIsSupported_exports";
Context context = ApplicationProvider.getApplicationContext();
if (!deviceSupportsHdrEditing(VIDEO_H265, HLG10_DEFAULT_COLOR_INFO)) {
recordTestSkipped(context, testId, /* reason= */ "Device lacks HLG10 editing support.");
......@@ -169,9 +167,9 @@ public class HdrEditingTest {
}
@Test
public void transformAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows()
public void exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows()
throws Exception {
String testId = "transformAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows";
String testId = "exportAndTranscode_hdr10File_whenHdrEditingUnsupported_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
if (deviceSupportsHdrEditing(VIDEO_H265, HDR10_DEFAULT_COLOR_INFO)) {
recordTestSkipped(context, testId, /* reason= */ "Device supports HDR10 editing.");
......@@ -223,9 +221,9 @@ public class HdrEditingTest {
}
@Test
public void transformAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows()
public void exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows()
throws Exception {
String testId = "transformAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows";
String testId = "exportAndTranscode_hlg10File_whenHdrEditingUnsupported_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
if (deviceSupportsHdrEditing(VIDEO_H265, HLG10_DEFAULT_COLOR_INFO)) {
recordTestSkipped(context, testId, /* reason= */ "Device supports HLG10 editing.");
......@@ -277,8 +275,8 @@ public class HdrEditingTest {
}
@Test
public void transformUnexpectedColorInfo() throws Exception {
String testId = "transformUnexpectedColorInfo";
public void exportUnexpectedColorInfo() throws Exception {
String testId = "exportUnexpectedColorInfo";
Context context = ApplicationProvider.getApplicationContext();
if (Util.SDK_INT < 29) {
recordTestSkipped(
......
......@@ -51,8 +51,8 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
public static final String TAG = "ToneMapHdrToSdrUsingMediaCodecTest";
@Test
public void transform_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "transform_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows";
public void export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapNoRequestedTranscode_hdr10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer =
......@@ -93,8 +93,8 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
}
@Test
public void transform_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "transform_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows";
public void export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapNoRequestedTranscode_hlg10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer =
......@@ -135,8 +135,8 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
}
@Test
public void transform_toneMapAndTranscode_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "transform_toneMapAndTranscode_hdr10File_toneMapsOrThrows";
public void export_toneMapAndTranscode_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapAndTranscode_hdr10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer =
......@@ -182,8 +182,8 @@ public class ToneMapHdrToSdrUsingMediaCodecTest {
}
@Test
public void transform_toneMapAndTranscode_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "transform_toneMapAndTranscode_hlg10File_toneMapsOrThrows";
public void export_toneMapAndTranscode_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "export_toneMapAndTranscode_hlg10File_toneMapsOrThrows";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer =
......
......@@ -50,8 +50,8 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
public static final String TAG = "ToneMapHdrToSdrUsingOpenGlTest";
@Test
public void transform_toneMap_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "transform_glToneMap_hlg10File_toneMapsOrThrows";
public void export_toneMap_hlg10File_toneMapsOrThrows() throws Exception {
String testId = "export_glToneMap_hlg10File_toneMapsOrThrows";
if (Util.SDK_INT < 29) {
recordTestSkipped(
......@@ -100,8 +100,8 @@ public class ToneMapHdrToSdrUsingOpenGlTest {
}
@Test
public void transform_toneMap_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "transform_glToneMap_hdr10File_toneMapsOrThrows";
public void export_toneMap_hdr10File_toneMapsOrThrows() throws Exception {
String testId = "export_glToneMap_hdr10File_toneMapsOrThrows";
if (Util.SDK_INT < 29) {
recordTestSkipped(
......
......@@ -39,7 +39,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public final class TranscodeQualityTest {
@Test
public void transformHighQualityTargetingAvcToAvc1920x1080_ssimIsGreaterThan95Percent()
public void exportHighQualityTargetingAvcToAvc1920x1080_ssimIsGreaterThan95Percent()
throws Exception {
Context context = ApplicationProvider.getApplicationContext();
String testId = "transformHighQualityTargetingAvcToAvc1920x1080_ssim";
......
......@@ -158,7 +158,7 @@ public class SsimMapperTest {
private static final String TAG = "SsimBinarySearcher";
private static final double SSIM_ACCEPTABLE_TOLERANCE = 0.005;
private static final double SSIM_TARGET = 0.95;
private static final int MAX_TRANSFORMATIONS = 12;
private static final int MAX_EXPORTS = 12;
private final Context context;
private final String testIdPrefix;
......@@ -166,7 +166,7 @@ public class SsimMapperTest {
private final Format format;
private final String outputMimeType;
private int transformationsLeft;
private int exportsLeft;
private double ssimLowerBound;
private double ssimUpperBound;
private int bitrateLowerBound;
......@@ -187,7 +187,7 @@ public class SsimMapperTest {
this.testIdPrefix = testIdPrefix;
this.videoUri = videoUri;
this.outputMimeType = outputMimeType;
transformationsLeft = MAX_TRANSFORMATIONS;
exportsLeft = MAX_EXPORTS;
format = AndroidTestUtil.getFormatForTestFile(videoUri);
}
......@@ -208,7 +208,7 @@ public class SsimMapperTest {
int maxBitrateToCheck = currentBitrate * 32;
do {
double currentSsim = transformAndGetSsim(currentBitrate);
double currentSsim = exportAndGetSsim(currentBitrate);
if (isSsimAcceptable(currentSsim)) {
return false;
}
......@@ -228,10 +228,9 @@ public class SsimMapperTest {
return false;
}
}
} while ((ssimLowerBound == SSIM_UNSET || ssimUpperBound == SSIM_UNSET)
&& transformationsLeft > 0);
} while ((ssimLowerBound == SSIM_UNSET || ssimUpperBound == SSIM_UNSET) && exportsLeft > 0);
return transformationsLeft > 0;
return exportsLeft > 0;
}
/**
......@@ -240,19 +239,19 @@ public class SsimMapperTest {
* <p>Performs a binary search of the bitrate between the {@link #bitrateLowerBound} and {@link
* #bitrateUpperBound}.
*
* <p>Runs until the target SSIM is found or the maximum number of transformations is reached.
* <p>Runs until the target SSIM is found or the maximum number of exports is reached.
*/
public void search() throws Exception {
if (!setupBinarySearchBounds()) {
return;
}
while (transformationsLeft > 0) {
while (exportsLeft > 0) {
// At this point, we have under and over bitrate bounds, with associated SSIMs.
// Go between the two, and replace either the under or the over.
int currentBitrate = (bitrateUpperBound + bitrateLowerBound) / 2;
double currentSsim = transformAndGetSsim(currentBitrate);
double currentSsim = exportAndGetSsim(currentBitrate);
if (isSsimAcceptable(currentSsim)) {
return;
}
......@@ -272,7 +271,7 @@ public class SsimMapperTest {
}
}
private double transformAndGetSsim(int bitrate) throws Exception {
private double exportAndGetSsim(int bitrate) throws Exception {
// TODO(b/238094555): Force specific encoders to be used.
String fileName = checkNotNull(getLast(FORWARD_SLASH_SPLITTER.split(videoUri)));
......@@ -305,7 +304,7 @@ public class SsimMapperTest {
.setRemoveAudio(true)
.build();
transformationsLeft--;
exportsLeft--;
double ssim =
new TransformerAndroidTestRunner.Builder(context, transformer)
......
......@@ -47,7 +47,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private final AssetLoader.Listener assetLoaderListener;
private final DecoderInputBuffer decoderInputBuffer;
private boolean isTransformationRunning;
private boolean isRunning;
private long streamStartPositionUs;
public ExoAssetLoaderBaseRenderer(
......@@ -92,7 +92,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@Override
public void render(long positionUs, long elapsedRealtimeUs) {
try {
if (!isTransformationRunning || isEnded() || !ensureConfigured()) {
if (!isRunning || isEnded() || !ensureConfigured()) {
return;
}
......@@ -102,7 +102,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
while (feedConsumerFromInput()) {}
}
} catch (ExportException e) {
isTransformationRunning = false;
isRunning = false;
assetLoaderListener.onError(e);
}
}
......@@ -120,12 +120,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@Override
protected void onStarted() {
isTransformationRunning = true;
isRunning = true;
}
@Override
protected void onStopped() {
isTransformationRunning = false;
isRunning = false;
}
@Override
......
......@@ -142,7 +142,7 @@ public final class ExoPlayerAssetLoader implements AssetLoader {
.setForceHighestSupportedBitrate(true)
.build());
// Arbitrarily decrease buffers for playback so that samples start being sent earlier to the
// pipelines (rebuffers are less problematic for the transformation use case).
// pipelines (rebuffers are less problematic for the export use case).
DefaultLoadControl loadControl =
new DefaultLoadControl.Builder()
.setBufferDurationsMs(
......@@ -280,7 +280,7 @@ public final class ExoPlayerAssetLoader implements AssetLoader {
if (!window.isPlaceholder) {
long durationUs = window.durationUs;
// Make progress permanently unavailable if the duration is unknown, so that it doesn't jump
// to a high value at the end of the transformation if the duration is set once the media is
// to a high value at the end of the export if the duration is set once the media is
// entirely loaded.
progressState =
durationUs <= 0 || durationUs == C.TIME_UNSET
......
......@@ -41,7 +41,7 @@ import com.google.android.exoplayer2.util.Util;
/**
* Creates a new instance.
*
* @param composition The {@link Composition} to transform.
* @param composition The {@link Composition} to export.
* @param transformerListeners The {@linkplain Transformer.Listener listeners} to call {@link
* Transformer.Listener#onFallbackApplied} on.
* @param transformerListenerHandler The {@link HandlerWrapper} to call {@link
......
......@@ -204,7 +204,7 @@ import java.nio.ByteBuffer;
try {
stopMuxer(mediaMuxer);
} catch (RuntimeException e) {
// It doesn't matter that stopping the muxer throws if the transformation is being cancelled.
// It doesn't matter that stopping the muxer throws if the export is being cancelled.
if (!forCancellation) {
throw new MuxerException("Failed to stop the muxer", e);
}
......
......@@ -91,7 +91,7 @@ public interface Muxer {
*
* <p>The muxer cannot be used anymore once this method has been called.
*
* @param forCancellation Whether the reason for releasing the resources is the transformation
* @param forCancellation Whether the reason for releasing the resources is the export
* cancellation.
* @throws MuxerException If the muxer fails to finish writing the output and {@code
* forCancellation} is false.
......@@ -105,8 +105,8 @@ public interface Muxer {
* <p>This is the maximum delay between samples of any track. They can be of the same or of
* different track types.
*
* <p>This value is used to abort the transformation when the maximum delay is reached. Note that
* there is no guarantee that the transformation will be aborted exactly at that time.
* <p>This value is used to abort the export when the maximum delay is reached. Note that there is
* no guarantee that the export will be aborted exactly at that time.
*/
long getMaxDelayBetweenSamplesMs();
}
......@@ -61,19 +61,19 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
/**
* Represents a reason for ending a transformation. May be one of {@link #END_REASON_COMPLETED},
* {@link #END_REASON_CANCELLED} or {@link #END_REASON_ERROR}.
* Represents a reason for ending an export. May be one of {@link #END_REASON_COMPLETED}, {@link
* #END_REASON_CANCELLED} or {@link #END_REASON_ERROR}.
*/
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target(TYPE_USE)
@IntDef({END_REASON_COMPLETED, END_REASON_CANCELLED, END_REASON_ERROR})
private @interface EndReason {}
/** The transformation completed successfully. */
/** The export completed successfully. */
private static final int END_REASON_COMPLETED = 0;
/** The transformation was cancelled. */
/** The export was cancelled. */
private static final int END_REASON_CANCELLED = 1;
/** An error occurred during the transformation. */
/** An error occurred during the export. */
private static final int END_REASON_ERROR = 2;
// Internal messages.
......
......@@ -36,7 +36,7 @@ public final class TransformerTestRunner {
*
* @param transformer The {@link Transformer}.
* @return The {@link ExportResult}.
* @throws ExportException If the transformation threw an exception.
* @throws ExportException If the export threw an exception.
* @throws TimeoutException If the {@link RobolectricUtil#DEFAULT_TIMEOUT_MS default timeout} is
* exceeded.
* @throws IllegalStateException If the method is not called from the main thread.
......
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