Add VP9 Mp4 clip to Mp4MuxerEndToEndParameterizedAndroidTest

The dump file for VP9 mp4 clips varied across SDK versions due to inconsistent CSDs from the platform extractor. By replacing the platform extractor with `MediaExtractorCompat`, the Media3 extractor will provide consistent CSDs across all SDK versions.

PiperOrigin-RevId: 707509473
This commit is contained in:
Googler 2024-12-18 05:12:38 -08:00 committed by Copybara-Service
parent 16dcf91c1c
commit 2d37823695
3 changed files with 512 additions and 32 deletions

View file

@ -17,11 +17,9 @@ package androidx.media3.muxer;
import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.muxer.AndroidMuxerTestUtil.feedInputDataToMuxer;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.media3.common.MimeTypes;
import androidx.media3.container.Mp4TimestampData;
import androidx.media3.extractor.mp4.Mp4Extractor;
import androidx.media3.extractor.text.DefaultSubtitleParserFactory;
@ -84,36 +82,6 @@ public class Mp4MuxerEndToEndNonParameterizedAndroidTest {
AndroidMuxerTestUtil.getExpectedDumpFilePath("partial_" + H265_HDR10_MP4));
}
@Test
public void createMp4File_fromVp9Mp4InputFileSampleData_matchesExpected() throws Exception {
// Contains CSD in vpcC format.
String vp9Mp4 = "bbb_800x640_768kbps_30fps_vp9.mp4";
@Nullable Mp4Muxer mp4Muxer = null;
try {
mp4Muxer = new Mp4Muxer.Builder(checkNotNull(outputStream)).build();
mp4Muxer.addMetadataEntry(
new Mp4TimestampData(
/* creationTimestampSeconds= */ 100_000_000L,
/* modificationTimestampSeconds= */ 500_000_000L));
feedInputDataToMuxer(context, mp4Muxer, checkNotNull(vp9Mp4));
} finally {
if (mp4Muxer != null) {
mp4Muxer.close();
}
}
FakeExtractorOutput fakeExtractorOutput =
TestUtil.extractAllSamplesFromFilePath(
new Mp4Extractor(new DefaultSubtitleParserFactory()), checkNotNull(outputPath));
// Only one VP9 video track should be present.
assertThat(fakeExtractorOutput.trackOutputs.get(0).lastFormat.sampleMimeType)
.isEqualTo(MimeTypes.VIDEO_VP9);
// TODO: b/373822496 - The produced dump file is different on different SDK versions.
/*DumpFileAsserts.assertOutput(
context, fakeExtractorOutput, AndroidMuxerTestUtil.getExpectedDumpFilePath(vp9Mp4));*/
}
@Test
public void createMp4File_withSampleBatchingDisabled_matchesExpected() throws Exception {
@Nullable Mp4Muxer mp4Muxer = null;

View file

@ -59,6 +59,7 @@ public class Mp4MuxerEndToEndParameterizedAndroidTest {
private static final String MPEG4_MP4 = "bbb_176x144_192kbps_15fps_mpeg4.mp4";
// Contains CSD in CodecPrivate format.
private static final String VP9_MP4 = "bbb_800x640_768kbps_30fps_vp9.mp4";
private static final String VP9_WEB = "bbb_642x642_768kbps_30fps_vp9.webm";
// Audio Codecs
private static final String AMR_NB_3GP = "bbb_mono_8kHz_12.2kbps_amrnb.3gp";
@ -79,6 +80,7 @@ public class Mp4MuxerEndToEndParameterizedAndroidTest {
APV_MP4,
AV1_MP4,
MPEG4_MP4,
VP9_MP4,
VP9_WEB,
AMR_NB_3GP,
AMR_WB_3GP,

View file

@ -0,0 +1,510 @@
seekMap:
isSeekable = true
duration = 4000000
getPosition(0) = [[timeUs=0, position=400052]]
getPosition(1) = [[timeUs=0, position=400052]]
getPosition(2000000) = [[timeUs=0, position=400052]]
getPosition(4000000) = [[timeUs=0, position=400052]]
numberOfTracks = 1
track 0:
total output bytes = 305806
sample count = 120
track duration = 4000000
format 0:
id = 1
containerMimeType = video/mp4
sampleMimeType = video/x-vnd.on2.vp9
maxInputSize = 100600
width = 800
height = 640
frameRate = 30.00
colorInfo:
colorSpace = 1
colorRange = 2
colorTransfer = 3
lumaBitdepth = 8
chromaBitdepth = 8
metadata = entries=[Mp4Timestamp: creation time=100000000, modification time=500000000, timescale=10000]
initializationData:
data = length 12, hash 53AEAE9A
sample 0:
time = 0
flags = 1
data = length 100570, hash F3505584
sample 1:
time = 33333
flags = 0
data = length 424, hash 351B7D98
sample 2:
time = 66666
flags = 0
data = length 968, hash CF97CA51
sample 3:
time = 100000
flags = 0
data = length 663, hash 5A9391FB
sample 4:
time = 133333
flags = 0
data = length 2344, hash 821F66F2
sample 5:
time = 166666
flags = 0
data = length 936, hash 9BA91F74
sample 6:
time = 200000
flags = 0
data = length 13724, hash 2AD413FC
sample 7:
time = 233333
flags = 0
data = length 87, hash 7A6DB23E
sample 8:
time = 266666
flags = 0
data = length 5818, hash 4BF1F91E
sample 9:
time = 300000
flags = 0
data = length 83, hash 7D4FE7E1
sample 10:
time = 333333
flags = 0
data = length 1073, hash 199BF05D
sample 11:
time = 366666
flags = 0
data = length 220, hash CD334AE5
sample 12:
time = 400000
flags = 0
data = length 249, hash C67C3DDC
sample 13:
time = 433333
flags = 0
data = length 120, hash 1177A230
sample 14:
time = 466666
flags = 0
data = length 159, hash AAD4B224
sample 15:
time = 500000
flags = 0
data = length 295, hash EF6900EA
sample 16:
time = 533333
flags = 0
data = length 2595, hash A23E20BF
sample 17:
time = 566666
flags = 0
data = length 1352, hash 312088B3
sample 18:
time = 600000
flags = 0
data = length 1544, hash E247E9B3
sample 19:
time = 633333
flags = 0
data = length 997, hash 99499D33
sample 20:
time = 666666
flags = 0
data = length 3525, hash 6588E6CE
sample 21:
time = 700000
flags = 0
data = length 1147, hash 3E9394F4
sample 22:
time = 733333
flags = 0
data = length 2040, hash 7C298FC4
sample 23:
time = 766666
flags = 0
data = length 1035, hash B31D7CA3
sample 24:
time = 800000
flags = 0
data = length 4952, hash 6C44AC2E
sample 25:
time = 833333
flags = 0
data = length 2136, hash D67B928
sample 26:
time = 866666
flags = 0
data = length 2647, hash 84319CF8
sample 27:
time = 900000
flags = 0
data = length 1548, hash 208E98A
sample 28:
time = 933333
flags = 0
data = length 2000, hash CEFB8707
sample 29:
time = 966666
flags = 0
data = length 594, hash C3795B6A
sample 30:
time = 1000000
flags = 0
data = length 8431, hash B5C47EB7
sample 31:
time = 1033333
flags = 0
data = length 455, hash CAE64BA3
sample 32:
time = 1066666
flags = 0
data = length 1319, hash 65E675D8
sample 33:
time = 1100000
flags = 0
data = length 505, hash F1847234
sample 34:
time = 1133333
flags = 0
data = length 530, hash DB450768
sample 35:
time = 1166666
flags = 0
data = length 331, hash D036DEA4
sample 36:
time = 1200000
flags = 0
data = length 4760, hash EDD70E31
sample 37:
time = 1233333
flags = 0
data = length 423, hash 95903FFF
sample 38:
time = 1266666
flags = 0
data = length 745, hash 5A6EBD10
sample 39:
time = 1300000
flags = 0
data = length 328, hash CE70CDBB
sample 40:
time = 1333333
flags = 0
data = length 5210, hash 2649A66E
sample 41:
time = 1366666
flags = 0
data = length 511, hash 419A4CA1
sample 42:
time = 1400000
flags = 0
data = length 452, hash 75825F28
sample 43:
time = 1433333
flags = 0
data = length 752, hash 10304F3D
sample 44:
time = 1466666
flags = 0
data = length 1198, hash A566BB01
sample 45:
time = 1500000
flags = 0
data = length 265, hash 78D51330
sample 46:
time = 1533333
flags = 0
data = length 537, hash CB719119
sample 47:
time = 1566666
flags = 0
data = length 359, hash 58A020C9
sample 48:
time = 1600000
flags = 0
data = length 2661, hash EBFD5510
sample 49:
time = 1633333
flags = 0
data = length 292, hash 6D9C5866
sample 50:
time = 1666666
flags = 0
data = length 1504, hash 91DC43F2
sample 51:
time = 1700000
flags = 0
data = length 267, hash 8F85CA3
sample 52:
time = 1733333
flags = 0
data = length 884, hash B28A5CBC
sample 53:
time = 1766666
flags = 0
data = length 1913, hash 31AF6E83
sample 54:
time = 1800000
flags = 0
data = length 2542, hash E89FB333
sample 55:
time = 1833333
flags = 0
data = length 1148, hash EB767F66
sample 56:
time = 1866666
flags = 0
data = length 3704, hash 7A975D4
sample 57:
time = 1900000
flags = 0
data = length 983, hash FBDB84D7
sample 58:
time = 1933333
flags = 0
data = length 1656, hash 41E53FEE
sample 59:
time = 1966666
flags = 0
data = length 1939, hash 3250B82D
sample 60:
time = 2000000
flags = 0
data = length 11450, hash 7B1889AC
sample 61:
time = 2033333
flags = 0
data = length 2056, hash A0CB367D
sample 62:
time = 2066666
flags = 0
data = length 2353, hash 53046A1
sample 63:
time = 2100000
flags = 0
data = length 1006, hash 44DDB4F2
sample 64:
time = 2133333
flags = 0
data = length 5342, hash 83F3F3AC
sample 65:
time = 2166666
flags = 0
data = length 955, hash 7AB9C26
sample 66:
time = 2200000
flags = 0
data = length 3268, hash E0E082C9
sample 67:
time = 2233333
flags = 0
data = length 644, hash E8B6DC7B
sample 68:
time = 2266666
flags = 0
data = length 2392, hash 1BF32E27
sample 69:
time = 2300000
flags = 0
data = length 593, hash 5DB64C00
sample 70:
time = 2333333
flags = 0
data = length 6948, hash 7895B079
sample 71:
time = 2366666
flags = 0
data = length 899, hash 5FFDFE17
sample 72:
time = 2400000
flags = 0
data = length 3788, hash 5A21D2E1
sample 73:
time = 2433333
flags = 0
data = length 1710, hash 89E8A39C
sample 74:
time = 2466666
flags = 0
data = length 3327, hash 3310ECDB
sample 75:
time = 2500000
flags = 0
data = length 2906, hash 8E0C412C
sample 76:
time = 2533333
flags = 0
data = length 4414, hash 11696B53
sample 77:
time = 2566666
flags = 0
data = length 2317, hash 657538A3
sample 78:
time = 2600000
flags = 0
data = length 1553, hash 5193D6AF
sample 79:
time = 2633333
flags = 0
data = length 468, hash 4376D976
sample 80:
time = 2666666
flags = 0
data = length 4568, hash E91D1E8F
sample 81:
time = 2700000
flags = 0
data = length 497, hash F4F1CD13
sample 82:
time = 2733333
flags = 0
data = length 610, hash 42AEFB70
sample 83:
time = 2766666
flags = 0
data = length 641, hash 5423E04A
sample 84:
time = 2800000
flags = 0
data = length 1165, hash F8637120
sample 85:
time = 2833333
flags = 0
data = length 314, hash ACEF2A81
sample 86:
time = 2866666
flags = 0
data = length 636, hash 5F2BB532
sample 87:
time = 2900000
flags = 0
data = length 647, hash B2729383
sample 88:
time = 2933333
flags = 0
data = length 3039, hash 2B1F361
sample 89:
time = 2966666
flags = 0
data = length 860, hash 9C0B862A
sample 90:
time = 3000000
flags = 0
data = length 8781, hash A2D4BE4D
sample 91:
time = 3033333
flags = 0
data = length 499, hash B9F70F2C
sample 92:
time = 3066666
flags = 0
data = length 1542, hash 1BA1174E
sample 93:
time = 3100000
flags = 0
data = length 695, hash 745CADCE
sample 94:
time = 3133333
flags = 0
data = length 586, hash 5742B4C3
sample 95:
time = 3166666
flags = 0
data = length 301, hash 9E00FE47
sample 96:
time = 3200000
flags = 0
data = length 4798, hash 67C484EB
sample 97:
time = 3233333
flags = 0
data = length 254, hash 71B22CF8
sample 98:
time = 3266666
flags = 0
data = length 461, hash DCB4FA15
sample 99:
time = 3300000
flags = 0
data = length 265, hash BB81E6E0
sample 100:
time = 3333333
flags = 0
data = length 2271, hash 66DAC7CC
sample 101:
time = 3366666
flags = 0
data = length 465, hash 16572B00
sample 102:
time = 3400000
flags = 0
data = length 525, hash 793F2DDA
sample 103:
time = 3433333
flags = 0
data = length 447, hash A96D7744
sample 104:
time = 3466666
flags = 0
data = length 2278, hash 462CE42B
sample 105:
time = 3500000
flags = 0
data = length 457, hash 13A273E0
sample 106:
time = 3533333
flags = 0
data = length 501, hash AE03F76E
sample 107:
time = 3566666
flags = 0
data = length 172, hash 75792E00
sample 108:
time = 3600000
flags = 0
data = length 464, hash C40933BB
sample 109:
time = 3633333
flags = 0
data = length 175, hash C46C8660
sample 110:
time = 3666666
flags = 0
data = length 1463, hash 44138497
sample 111:
time = 3700000
flags = 0
data = length 251, hash 8C44DDB
sample 112:
time = 3733333
flags = 0
data = length 1178, hash B96F4269
sample 113:
time = 3766666
flags = 0
data = length 320, hash B00BFAD9
sample 114:
time = 3800000
flags = 0
data = length 386, hash CAAB54FC
sample 115:
time = 3833333
flags = 0
data = length 322, hash 63896DFB
sample 116:
time = 3866666
flags = 0
data = length 583, hash 757FF234
sample 117:
time = 3900000
flags = 0
data = length 169, hash 281BE891
sample 118:
time = 3933333
flags = 0
data = length 540, hash CBDFC083
sample 119:
time = 3966666
flags = 536870912
data = length 842, hash D0C087E5
tracksEnded = true