Update mixed input test to include images of different aspect ratios

Makes this test a little more thorough.

PiperOrigin-RevId: 532386515
(cherry picked from commit 88642587ac9faa4ba0d7ea9870fa1898ef90277e)
This commit is contained in:
tofunmi 2023-05-16 10:28:04 +01:00 committed by Tofunmi Adigun-Hameed
parent 04a00c7ac4
commit 43f8d080df
2 changed files with 8 additions and 8 deletions

View File

@ -64,6 +64,7 @@ public final class AndroidTestUtil {
public static final String PNG_ASSET_URI_STRING = public static final String PNG_ASSET_URI_STRING =
"asset:///media/bitmap/input_images/media3test.png"; "asset:///media/bitmap/input_images/media3test.png";
public static final String JPG_ASSET_URI_STRING = "asset:///media/bitmap/input_images/london.jpg";
public static final String MP4_ASSET_URI_STRING = "asset:///media/mp4/sample.mp4"; public static final String MP4_ASSET_URI_STRING = "asset:///media/mp4/sample.mp4";
public static final Format MP4_ASSET_FORMAT = public static final Format MP4_ASSET_FORMAT =

View File

@ -17,6 +17,7 @@
package androidx.media3.transformer; package androidx.media3.transformer;
import static androidx.media3.transformer.AndroidTestUtil.JPG_ASSET_URI_STRING;
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING; import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING;
import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET_URI_STRING; import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET_URI_STRING;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@ -89,8 +90,6 @@ public class TransformerMixedInputEndToEndTest {
int imageFrameCount = 32; int imageFrameCount = 32;
EditedMediaItem imageEditedMediaItem = EditedMediaItem imageEditedMediaItem =
createImageEditedMediaItem(PNG_ASSET_URI_STRING, /* frameCount= */ imageFrameCount); createImageEditedMediaItem(PNG_ASSET_URI_STRING, /* frameCount= */ imageFrameCount);
// Result of the following command:
// ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames sample.mp4
EditedMediaItem videoEditedMediaItem = EditedMediaItem videoEditedMediaItem =
createVideoEditedMediaItem(MP4_ASSET_URI_STRING, /* height= */ 480); createVideoEditedMediaItem(MP4_ASSET_URI_STRING, /* height= */ 480);
ExportTestResult result = ExportTestResult result =
@ -117,10 +116,10 @@ public class TransformerMixedInputEndToEndTest {
.build(); .build();
int imageFrameCount = 33; int imageFrameCount = 33;
EditedMediaItem imageEditedMediaItem = EditedMediaItem imageEditedMediaItem1 =
createImageEditedMediaItem(PNG_ASSET_URI_STRING, /* frameCount= */ imageFrameCount); createImageEditedMediaItem(PNG_ASSET_URI_STRING, /* frameCount= */ imageFrameCount);
// Result of the following command: EditedMediaItem imageEditedMediaItem2 =
// ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames sample.mp4 createImageEditedMediaItem(JPG_ASSET_URI_STRING, /* frameCount= */ imageFrameCount);
EditedMediaItem videoEditedMediaItem = EditedMediaItem videoEditedMediaItem =
createVideoEditedMediaItem(MP4_ASSET_URI_STRING, /* height= */ 360); createVideoEditedMediaItem(MP4_ASSET_URI_STRING, /* height= */ 360);
ExportTestResult result = ExportTestResult result =
@ -132,10 +131,10 @@ public class TransformerMixedInputEndToEndTest {
ImmutableList.of( ImmutableList.of(
videoEditedMediaItem, videoEditedMediaItem,
videoEditedMediaItem, videoEditedMediaItem,
imageEditedMediaItem, imageEditedMediaItem1,
imageEditedMediaItem, imageEditedMediaItem2,
videoEditedMediaItem, videoEditedMediaItem,
imageEditedMediaItem, imageEditedMediaItem1,
videoEditedMediaItem))); videoEditedMediaItem)));
assertThat(result.exportResult.videoFrameCount) assertThat(result.exportResult.videoFrameCount)