diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java index 486a79f7cf..942ff61c86 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java @@ -585,8 +585,8 @@ public final class Mp4Extractor implements Extractor, SeekMap { isQuickTime, /* modifyTrackFunction= */ track -> track); - int trackCount = trackSampleTables.size(); - for (int i = 0; i < trackCount; i++) { + int trackIndex = 0; + for (int i = 0; i < trackSampleTables.size(); i++) { TrackSampleTable trackSampleTable = trackSampleTables.get(i); if (trackSampleTable.sampleCount == 0) { continue; @@ -596,7 +596,7 @@ public final class Mp4Extractor implements Extractor, SeekMap { track.durationUs != C.TIME_UNSET ? track.durationUs : trackSampleTable.durationUs; durationUs = max(durationUs, trackDurationUs); Mp4Track mp4Track = - new Mp4Track(track, trackSampleTable, extractorOutput.track(i, track.type)); + new Mp4Track(track, trackSampleTable, extractorOutput.track(trackIndex++, track.type)); int maxInputSize; if (MimeTypes.AUDIO_TRUEHD.equals(track.format.sampleMimeType)) { diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/mp4/Mp4ExtractorTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/mp4/Mp4ExtractorTest.java index b28d20ed29..42adc72fd8 100644 --- a/libraries/extractor/src/test/java/androidx/media3/extractor/mp4/Mp4ExtractorTest.java +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/mp4/Mp4ExtractorTest.java @@ -16,10 +16,19 @@ package androidx.media3.extractor.mp4; import static androidx.media3.extractor.mp4.FragmentedMp4Extractor.FLAG_EMIT_RAW_SUBTITLE_DATA; +import static com.google.common.truth.Truth.assertThat; +import androidx.media3.extractor.Extractor; +import androidx.media3.extractor.PositionHolder; import androidx.media3.extractor.text.DefaultSubtitleParserFactory; import androidx.media3.extractor.text.SubtitleParser; import androidx.media3.test.utils.ExtractorAsserts; +import androidx.media3.test.utils.FakeExtractorInput; +import androidx.media3.test.utils.FakeExtractorOutput; +import androidx.media3.test.utils.FakeTrackOutput; +import androidx.media3.test.utils.TestUtil; +import androidx.test.core.app.ApplicationProvider; +import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; import org.junit.Test; @@ -226,6 +235,51 @@ public final class Mp4ExtractorTest { simulationConfig); } + @Test + public void mp4SampleWithEmptyTrack() throws Exception { + ExtractorAsserts.assertBehavior( + getExtractorFactory(subtitlesParsedDuringExtraction), + "media/mp4/sample_empty_track.mp4", + simulationConfig); + } + + @Test + public void getSeekPoints_withEmptyTracks_returnsValidInformation() throws Exception { + Mp4Extractor extractor = + (Mp4Extractor) getExtractorFactory(subtitlesParsedDuringExtraction).create(); + FakeExtractorInput input = + new FakeExtractorInput.Builder() + .setData( + TestUtil.getByteArray( + ApplicationProvider.getApplicationContext(), + "media/mp4/sample_empty_track.mp4")) + .build(); + FakeExtractorOutput output = + new FakeExtractorOutput( + (id, type) -> new FakeTrackOutput(/* deduplicateConsecutiveFormats= */ true)); + PositionHolder seekPositionHolder = new PositionHolder(); + extractor.init(output); + int readResult = Extractor.RESULT_CONTINUE; + while (readResult != Extractor.RESULT_END_OF_INPUT) { + readResult = extractor.read(input, seekPositionHolder); + if (readResult == Extractor.RESULT_SEEK) { + long seekPosition = seekPositionHolder.position; + input.setPosition((int) seekPosition); + } + } + ImmutableList.Builder trackSeekTimesUs = ImmutableList.builder(); + long testPositionUs = output.seekMap.getDurationUs() / 2; + + for (int i = 0; i < output.numberOfTracks; i++) { + int trackId = output.trackOutputs.keyAt(i); + trackSeekTimesUs.add(extractor.getSeekPoints(testPositionUs, trackId).first.timeUs); + } + long extractorSeekTimeUs = extractor.getSeekPoints(testPositionUs).first.timeUs; + + assertThat(output.numberOfTracks).isEqualTo(2); + assertThat(extractorSeekTimeUs).isIn(trackSeekTimesUs.build()); + } + private static ExtractorAsserts.ExtractorFactory getExtractorFactory( boolean subtitlesParsedDuringExtraction) { SubtitleParser.Factory subtitleParserFactory; diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.0.dump new file mode 100644 index 0000000000..cb3e4b9d2d --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.0.dump @@ -0,0 +1,344 @@ +seekMap: + isSeekable = true + duration = 1065600 + getPosition(0) = [[timeUs=0, position=44]] + getPosition(1) = [[timeUs=0, position=44]] + getPosition(532800) = [[timeUs=0, position=44]] + getPosition(1065600) = [[timeUs=0, position=44]] +numberOfTracks = 2 +track 0: + total output bytes = 301392 + sample count = 30 + format 0: + id = 1 + sampleMimeType = video/avc + codecs = avc1.640034 + maxInputSize = 22910 + width = 1080 + height = 720 + frameRate = 31.004547 + colorInfo: + colorSpace = 1 + colorRange = 2 + colorTransfer = 3 + lumaBitdepth = 8 + chromaBitdepth = 8 + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 23, hash 33E412EE + data = length 9, hash FBAFBC0C + sample 0: + time = 0 + flags = 1 + data = length 7744, hash DDF91733 + sample 1: + time = 33355 + flags = 0 + data = length 1168, hash 89E48A20 + sample 2: + time = 66722 + flags = 0 + data = length 960, hash D4AD9EF0 + sample 3: + time = 100100 + flags = 0 + data = length 976, hash CD49C23C + sample 4: + time = 133455 + flags = 0 + data = length 1360, hash 337B78A9 + sample 5: + time = 166822 + flags = 0 + data = length 2288, hash 5D5FD1C8 + sample 6: + time = 200200 + flags = 0 + data = length 3856, hash 3D7DCD46 + sample 7: + time = 233555 + flags = 0 + data = length 4048, hash 47C78814 + sample 8: + time = 266922 + flags = 0 + data = length 6144, hash 8FD9AD7D + sample 9: + time = 300300 + flags = 0 + data = length 7632, hash 4245F848 + sample 10: + time = 333655 + flags = 0 + data = length 9792, hash B2B9AB4B + sample 11: + time = 367022 + flags = 0 + data = length 14496, hash E0F2E0BA + sample 12: + time = 400400 + flags = 0 + data = length 17664, hash 3E3189E + sample 13: + time = 433755 + flags = 0 + data = length 5712, hash CA808ECF + sample 14: + time = 467122 + flags = 0 + data = length 9776, hash C875D1AA + sample 15: + time = 500500 + flags = 0 + data = length 17712, hash 69AE17D4 + sample 16: + time = 533855 + flags = 0 + data = length 11440, hash 7370E78C + sample 17: + time = 567222 + flags = 0 + data = length 8544, hash 5A581986 + sample 18: + time = 600600 + flags = 0 + data = length 19904, hash 98AB5C44 + sample 19: + time = 633955 + flags = 0 + data = length 14352, hash 74B754E3 + sample 20: + time = 667322 + flags = 0 + data = length 9568, hash 369746A6 + sample 21: + time = 700700 + flags = 0 + data = length 12192, hash E0F8A71A + sample 22: + time = 734055 + flags = 0 + data = length 22880, hash 75E833BA + sample 23: + time = 767422 + flags = 0 + data = length 16832, hash E8BFCFE3 + sample 24: + time = 800800 + flags = 0 + data = length 5120, hash E04AEF94 + sample 25: + time = 834155 + flags = 0 + data = length 9888, hash 1166103E + sample 26: + time = 867522 + flags = 0 + data = length 17024, hash F9A96740 + sample 27: + time = 900900 + flags = 0 + data = length 20864, hash DF9E88B8 + sample 28: + time = 934255 + flags = 0 + data = length 7216, hash BE22BE2F + sample 29: + time = 967622 + flags = 536870912 + data = length 14240, hash E190BF31 +track 1: + total output bytes = 9529 + sample count = 45 + format 0: + id = 3 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.2 + maxInputSize = 294 + channelCount = 1 + sampleRate = 44100 + language = und + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 2, hash 5F7 + sample 0: + time = 0 + flags = 1 + data = length 23, hash 47DE9131 + sample 1: + time = 67208 + flags = 1 + data = length 6, hash 31EC5206 + sample 2: + time = 90437 + flags = 1 + data = length 148, hash 894A176B + sample 3: + time = 113645 + flags = 1 + data = length 189, hash CEF235A1 + sample 4: + time = 136875 + flags = 1 + data = length 205, hash BBF5F7B0 + sample 5: + time = 160083 + flags = 1 + data = length 210, hash F278B193 + sample 6: + time = 183312 + flags = 1 + data = length 210, hash 82DA1589 + sample 7: + time = 206520 + flags = 1 + data = length 207, hash 5BE231DF + sample 8: + time = 229750 + flags = 1 + data = length 225, hash 18819EE1 + sample 9: + time = 252958 + flags = 1 + data = length 215, hash CA7FA67B + sample 10: + time = 276187 + flags = 1 + data = length 211, hash 581A1C18 + sample 11: + time = 299416 + flags = 1 + data = length 216, hash ADB88187 + sample 12: + time = 322625 + flags = 1 + data = length 229, hash 2E8BA4DC + sample 13: + time = 345854 + flags = 1 + data = length 232, hash 22F0C510 + sample 14: + time = 369062 + flags = 1 + data = length 235, hash 867AD0DC + sample 15: + time = 392291 + flags = 1 + data = length 231, hash 84E823A8 + sample 16: + time = 415500 + flags = 1 + data = length 226, hash 1BEF3A95 + sample 17: + time = 438729 + flags = 1 + data = length 216, hash EAA345AE + sample 18: + time = 461958 + flags = 1 + data = length 229, hash 6957411F + sample 19: + time = 485166 + flags = 1 + data = length 219, hash 41275022 + sample 20: + time = 508395 + flags = 1 + data = length 241, hash 6495DF96 + sample 21: + time = 531604 + flags = 1 + data = length 228, hash 63D95906 + sample 22: + time = 554833 + flags = 1 + data = length 238, hash 34F676F9 + sample 23: + time = 578041 + flags = 1 + data = length 234, hash E5CBC045 + sample 24: + time = 601270 + flags = 1 + data = length 231, hash 5FC43661 + sample 25: + time = 624479 + flags = 1 + data = length 217, hash 682708ED + sample 26: + time = 647708 + flags = 1 + data = length 239, hash D43780FC + sample 27: + time = 670937 + flags = 1 + data = length 243, hash C5E17980 + sample 28: + time = 694145 + flags = 1 + data = length 231, hash AC5837BA + sample 29: + time = 717375 + flags = 1 + data = length 230, hash 169EE895 + sample 30: + time = 740583 + flags = 1 + data = length 238, hash C48FF3F1 + sample 31: + time = 763812 + flags = 1 + data = length 225, hash 531E4599 + sample 32: + time = 787020 + flags = 1 + data = length 232, hash CB3C6B8D + sample 33: + time = 810250 + flags = 1 + data = length 243, hash F8C94C7 + sample 34: + time = 833458 + flags = 1 + data = length 232, hash A646A7D0 + sample 35: + time = 856687 + flags = 1 + data = length 237, hash E8B787A5 + sample 36: + time = 879916 + flags = 1 + data = length 228, hash 3FA7A29F + sample 37: + time = 903125 + flags = 1 + data = length 235, hash B9B33B0A + sample 38: + time = 926354 + flags = 1 + data = length 264, hash 71A4869E + sample 39: + time = 949562 + flags = 1 + data = length 257, hash D049B54C + sample 40: + time = 972791 + flags = 1 + data = length 227, hash 66757231 + sample 41: + time = 996000 + flags = 1 + data = length 227, hash BD374F1B + sample 42: + time = 1019229 + flags = 1 + data = length 235, hash 999477F6 + sample 43: + time = 1042437 + flags = 1 + data = length 229, hash FFF98DF0 + sample 44: + time = 1065666 + flags = 536870913 + data = length 6, hash 31B22286 +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.1.dump new file mode 100644 index 0000000000..24d533db5e --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.1.dump @@ -0,0 +1,292 @@ +seekMap: + isSeekable = true + duration = 1065600 + getPosition(0) = [[timeUs=0, position=44]] + getPosition(1) = [[timeUs=0, position=44]] + getPosition(532800) = [[timeUs=0, position=44]] + getPosition(1065600) = [[timeUs=0, position=44]] +numberOfTracks = 2 +track 0: + total output bytes = 301392 + sample count = 30 + format 0: + id = 1 + sampleMimeType = video/avc + codecs = avc1.640034 + maxInputSize = 22910 + width = 1080 + height = 720 + frameRate = 31.004547 + colorInfo: + colorSpace = 1 + colorRange = 2 + colorTransfer = 3 + lumaBitdepth = 8 + chromaBitdepth = 8 + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 23, hash 33E412EE + data = length 9, hash FBAFBC0C + sample 0: + time = 0 + flags = 1 + data = length 7744, hash DDF91733 + sample 1: + time = 33355 + flags = 0 + data = length 1168, hash 89E48A20 + sample 2: + time = 66722 + flags = 0 + data = length 960, hash D4AD9EF0 + sample 3: + time = 100100 + flags = 0 + data = length 976, hash CD49C23C + sample 4: + time = 133455 + flags = 0 + data = length 1360, hash 337B78A9 + sample 5: + time = 166822 + flags = 0 + data = length 2288, hash 5D5FD1C8 + sample 6: + time = 200200 + flags = 0 + data = length 3856, hash 3D7DCD46 + sample 7: + time = 233555 + flags = 0 + data = length 4048, hash 47C78814 + sample 8: + time = 266922 + flags = 0 + data = length 6144, hash 8FD9AD7D + sample 9: + time = 300300 + flags = 0 + data = length 7632, hash 4245F848 + sample 10: + time = 333655 + flags = 0 + data = length 9792, hash B2B9AB4B + sample 11: + time = 367022 + flags = 0 + data = length 14496, hash E0F2E0BA + sample 12: + time = 400400 + flags = 0 + data = length 17664, hash 3E3189E + sample 13: + time = 433755 + flags = 0 + data = length 5712, hash CA808ECF + sample 14: + time = 467122 + flags = 0 + data = length 9776, hash C875D1AA + sample 15: + time = 500500 + flags = 0 + data = length 17712, hash 69AE17D4 + sample 16: + time = 533855 + flags = 0 + data = length 11440, hash 7370E78C + sample 17: + time = 567222 + flags = 0 + data = length 8544, hash 5A581986 + sample 18: + time = 600600 + flags = 0 + data = length 19904, hash 98AB5C44 + sample 19: + time = 633955 + flags = 0 + data = length 14352, hash 74B754E3 + sample 20: + time = 667322 + flags = 0 + data = length 9568, hash 369746A6 + sample 21: + time = 700700 + flags = 0 + data = length 12192, hash E0F8A71A + sample 22: + time = 734055 + flags = 0 + data = length 22880, hash 75E833BA + sample 23: + time = 767422 + flags = 0 + data = length 16832, hash E8BFCFE3 + sample 24: + time = 800800 + flags = 0 + data = length 5120, hash E04AEF94 + sample 25: + time = 834155 + flags = 0 + data = length 9888, hash 1166103E + sample 26: + time = 867522 + flags = 0 + data = length 17024, hash F9A96740 + sample 27: + time = 900900 + flags = 0 + data = length 20864, hash DF9E88B8 + sample 28: + time = 934255 + flags = 0 + data = length 7216, hash BE22BE2F + sample 29: + time = 967622 + flags = 536870912 + data = length 14240, hash E190BF31 +track 1: + total output bytes = 7235 + sample count = 32 + format 0: + id = 3 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.2 + maxInputSize = 294 + channelCount = 1 + sampleRate = 44100 + language = und + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 2, hash 5F7 + sample 0: + time = 345854 + flags = 1 + data = length 232, hash 22F0C510 + sample 1: + time = 369062 + flags = 1 + data = length 235, hash 867AD0DC + sample 2: + time = 392291 + flags = 1 + data = length 231, hash 84E823A8 + sample 3: + time = 415500 + flags = 1 + data = length 226, hash 1BEF3A95 + sample 4: + time = 438729 + flags = 1 + data = length 216, hash EAA345AE + sample 5: + time = 461958 + flags = 1 + data = length 229, hash 6957411F + sample 6: + time = 485166 + flags = 1 + data = length 219, hash 41275022 + sample 7: + time = 508395 + flags = 1 + data = length 241, hash 6495DF96 + sample 8: + time = 531604 + flags = 1 + data = length 228, hash 63D95906 + sample 9: + time = 554833 + flags = 1 + data = length 238, hash 34F676F9 + sample 10: + time = 578041 + flags = 1 + data = length 234, hash E5CBC045 + sample 11: + time = 601270 + flags = 1 + data = length 231, hash 5FC43661 + sample 12: + time = 624479 + flags = 1 + data = length 217, hash 682708ED + sample 13: + time = 647708 + flags = 1 + data = length 239, hash D43780FC + sample 14: + time = 670937 + flags = 1 + data = length 243, hash C5E17980 + sample 15: + time = 694145 + flags = 1 + data = length 231, hash AC5837BA + sample 16: + time = 717375 + flags = 1 + data = length 230, hash 169EE895 + sample 17: + time = 740583 + flags = 1 + data = length 238, hash C48FF3F1 + sample 18: + time = 763812 + flags = 1 + data = length 225, hash 531E4599 + sample 19: + time = 787020 + flags = 1 + data = length 232, hash CB3C6B8D + sample 20: + time = 810250 + flags = 1 + data = length 243, hash F8C94C7 + sample 21: + time = 833458 + flags = 1 + data = length 232, hash A646A7D0 + sample 22: + time = 856687 + flags = 1 + data = length 237, hash E8B787A5 + sample 23: + time = 879916 + flags = 1 + data = length 228, hash 3FA7A29F + sample 24: + time = 903125 + flags = 1 + data = length 235, hash B9B33B0A + sample 25: + time = 926354 + flags = 1 + data = length 264, hash 71A4869E + sample 26: + time = 949562 + flags = 1 + data = length 257, hash D049B54C + sample 27: + time = 972791 + flags = 1 + data = length 227, hash 66757231 + sample 28: + time = 996000 + flags = 1 + data = length 227, hash BD374F1B + sample 29: + time = 1019229 + flags = 1 + data = length 235, hash 999477F6 + sample 30: + time = 1042437 + flags = 1 + data = length 229, hash FFF98DF0 + sample 31: + time = 1065666 + flags = 536870913 + data = length 6, hash 31B22286 +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.2.dump new file mode 100644 index 0000000000..44d6e70358 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.2.dump @@ -0,0 +1,232 @@ +seekMap: + isSeekable = true + duration = 1065600 + getPosition(0) = [[timeUs=0, position=44]] + getPosition(1) = [[timeUs=0, position=44]] + getPosition(532800) = [[timeUs=0, position=44]] + getPosition(1065600) = [[timeUs=0, position=44]] +numberOfTracks = 2 +track 0: + total output bytes = 301392 + sample count = 30 + format 0: + id = 1 + sampleMimeType = video/avc + codecs = avc1.640034 + maxInputSize = 22910 + width = 1080 + height = 720 + frameRate = 31.004547 + colorInfo: + colorSpace = 1 + colorRange = 2 + colorTransfer = 3 + lumaBitdepth = 8 + chromaBitdepth = 8 + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 23, hash 33E412EE + data = length 9, hash FBAFBC0C + sample 0: + time = 0 + flags = 1 + data = length 7744, hash DDF91733 + sample 1: + time = 33355 + flags = 0 + data = length 1168, hash 89E48A20 + sample 2: + time = 66722 + flags = 0 + data = length 960, hash D4AD9EF0 + sample 3: + time = 100100 + flags = 0 + data = length 976, hash CD49C23C + sample 4: + time = 133455 + flags = 0 + data = length 1360, hash 337B78A9 + sample 5: + time = 166822 + flags = 0 + data = length 2288, hash 5D5FD1C8 + sample 6: + time = 200200 + flags = 0 + data = length 3856, hash 3D7DCD46 + sample 7: + time = 233555 + flags = 0 + data = length 4048, hash 47C78814 + sample 8: + time = 266922 + flags = 0 + data = length 6144, hash 8FD9AD7D + sample 9: + time = 300300 + flags = 0 + data = length 7632, hash 4245F848 + sample 10: + time = 333655 + flags = 0 + data = length 9792, hash B2B9AB4B + sample 11: + time = 367022 + flags = 0 + data = length 14496, hash E0F2E0BA + sample 12: + time = 400400 + flags = 0 + data = length 17664, hash 3E3189E + sample 13: + time = 433755 + flags = 0 + data = length 5712, hash CA808ECF + sample 14: + time = 467122 + flags = 0 + data = length 9776, hash C875D1AA + sample 15: + time = 500500 + flags = 0 + data = length 17712, hash 69AE17D4 + sample 16: + time = 533855 + flags = 0 + data = length 11440, hash 7370E78C + sample 17: + time = 567222 + flags = 0 + data = length 8544, hash 5A581986 + sample 18: + time = 600600 + flags = 0 + data = length 19904, hash 98AB5C44 + sample 19: + time = 633955 + flags = 0 + data = length 14352, hash 74B754E3 + sample 20: + time = 667322 + flags = 0 + data = length 9568, hash 369746A6 + sample 21: + time = 700700 + flags = 0 + data = length 12192, hash E0F8A71A + sample 22: + time = 734055 + flags = 0 + data = length 22880, hash 75E833BA + sample 23: + time = 767422 + flags = 0 + data = length 16832, hash E8BFCFE3 + sample 24: + time = 800800 + flags = 0 + data = length 5120, hash E04AEF94 + sample 25: + time = 834155 + flags = 0 + data = length 9888, hash 1166103E + sample 26: + time = 867522 + flags = 0 + data = length 17024, hash F9A96740 + sample 27: + time = 900900 + flags = 0 + data = length 20864, hash DF9E88B8 + sample 28: + time = 934255 + flags = 0 + data = length 7216, hash BE22BE2F + sample 29: + time = 967622 + flags = 536870912 + data = length 14240, hash E190BF31 +track 1: + total output bytes = 3776 + sample count = 17 + format 0: + id = 3 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.2 + maxInputSize = 294 + channelCount = 1 + sampleRate = 44100 + language = und + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 2, hash 5F7 + sample 0: + time = 694145 + flags = 1 + data = length 231, hash AC5837BA + sample 1: + time = 717375 + flags = 1 + data = length 230, hash 169EE895 + sample 2: + time = 740583 + flags = 1 + data = length 238, hash C48FF3F1 + sample 3: + time = 763812 + flags = 1 + data = length 225, hash 531E4599 + sample 4: + time = 787020 + flags = 1 + data = length 232, hash CB3C6B8D + sample 5: + time = 810250 + flags = 1 + data = length 243, hash F8C94C7 + sample 6: + time = 833458 + flags = 1 + data = length 232, hash A646A7D0 + sample 7: + time = 856687 + flags = 1 + data = length 237, hash E8B787A5 + sample 8: + time = 879916 + flags = 1 + data = length 228, hash 3FA7A29F + sample 9: + time = 903125 + flags = 1 + data = length 235, hash B9B33B0A + sample 10: + time = 926354 + flags = 1 + data = length 264, hash 71A4869E + sample 11: + time = 949562 + flags = 1 + data = length 257, hash D049B54C + sample 12: + time = 972791 + flags = 1 + data = length 227, hash 66757231 + sample 13: + time = 996000 + flags = 1 + data = length 227, hash BD374F1B + sample 14: + time = 1019229 + flags = 1 + data = length 235, hash 999477F6 + sample 15: + time = 1042437 + flags = 1 + data = length 229, hash FFF98DF0 + sample 16: + time = 1065666 + flags = 536870913 + data = length 6, hash 31B22286 +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.3.dump new file mode 100644 index 0000000000..424f1ddbd9 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.3.dump @@ -0,0 +1,172 @@ +seekMap: + isSeekable = true + duration = 1065600 + getPosition(0) = [[timeUs=0, position=44]] + getPosition(1) = [[timeUs=0, position=44]] + getPosition(532800) = [[timeUs=0, position=44]] + getPosition(1065600) = [[timeUs=0, position=44]] +numberOfTracks = 2 +track 0: + total output bytes = 301392 + sample count = 30 + format 0: + id = 1 + sampleMimeType = video/avc + codecs = avc1.640034 + maxInputSize = 22910 + width = 1080 + height = 720 + frameRate = 31.004547 + colorInfo: + colorSpace = 1 + colorRange = 2 + colorTransfer = 3 + lumaBitdepth = 8 + chromaBitdepth = 8 + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 23, hash 33E412EE + data = length 9, hash FBAFBC0C + sample 0: + time = 0 + flags = 1 + data = length 7744, hash DDF91733 + sample 1: + time = 33355 + flags = 0 + data = length 1168, hash 89E48A20 + sample 2: + time = 66722 + flags = 0 + data = length 960, hash D4AD9EF0 + sample 3: + time = 100100 + flags = 0 + data = length 976, hash CD49C23C + sample 4: + time = 133455 + flags = 0 + data = length 1360, hash 337B78A9 + sample 5: + time = 166822 + flags = 0 + data = length 2288, hash 5D5FD1C8 + sample 6: + time = 200200 + flags = 0 + data = length 3856, hash 3D7DCD46 + sample 7: + time = 233555 + flags = 0 + data = length 4048, hash 47C78814 + sample 8: + time = 266922 + flags = 0 + data = length 6144, hash 8FD9AD7D + sample 9: + time = 300300 + flags = 0 + data = length 7632, hash 4245F848 + sample 10: + time = 333655 + flags = 0 + data = length 9792, hash B2B9AB4B + sample 11: + time = 367022 + flags = 0 + data = length 14496, hash E0F2E0BA + sample 12: + time = 400400 + flags = 0 + data = length 17664, hash 3E3189E + sample 13: + time = 433755 + flags = 0 + data = length 5712, hash CA808ECF + sample 14: + time = 467122 + flags = 0 + data = length 9776, hash C875D1AA + sample 15: + time = 500500 + flags = 0 + data = length 17712, hash 69AE17D4 + sample 16: + time = 533855 + flags = 0 + data = length 11440, hash 7370E78C + sample 17: + time = 567222 + flags = 0 + data = length 8544, hash 5A581986 + sample 18: + time = 600600 + flags = 0 + data = length 19904, hash 98AB5C44 + sample 19: + time = 633955 + flags = 0 + data = length 14352, hash 74B754E3 + sample 20: + time = 667322 + flags = 0 + data = length 9568, hash 369746A6 + sample 21: + time = 700700 + flags = 0 + data = length 12192, hash E0F8A71A + sample 22: + time = 734055 + flags = 0 + data = length 22880, hash 75E833BA + sample 23: + time = 767422 + flags = 0 + data = length 16832, hash E8BFCFE3 + sample 24: + time = 800800 + flags = 0 + data = length 5120, hash E04AEF94 + sample 25: + time = 834155 + flags = 0 + data = length 9888, hash 1166103E + sample 26: + time = 867522 + flags = 0 + data = length 17024, hash F9A96740 + sample 27: + time = 900900 + flags = 0 + data = length 20864, hash DF9E88B8 + sample 28: + time = 934255 + flags = 0 + data = length 7216, hash BE22BE2F + sample 29: + time = 967622 + flags = 536870912 + data = length 14240, hash E190BF31 +track 1: + total output bytes = 235 + sample count = 2 + format 0: + id = 3 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.2 + maxInputSize = 294 + channelCount = 1 + sampleRate = 44100 + language = und + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 2, hash 5F7 + sample 0: + time = 1042437 + flags = 1 + data = length 229, hash FFF98DF0 + sample 1: + time = 1065666 + flags = 536870913 + data = length 6, hash 31B22286 +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.unknown_length.dump new file mode 100644 index 0000000000..cb3e4b9d2d --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp4/sample_empty_track.mp4.unknown_length.dump @@ -0,0 +1,344 @@ +seekMap: + isSeekable = true + duration = 1065600 + getPosition(0) = [[timeUs=0, position=44]] + getPosition(1) = [[timeUs=0, position=44]] + getPosition(532800) = [[timeUs=0, position=44]] + getPosition(1065600) = [[timeUs=0, position=44]] +numberOfTracks = 2 +track 0: + total output bytes = 301392 + sample count = 30 + format 0: + id = 1 + sampleMimeType = video/avc + codecs = avc1.640034 + maxInputSize = 22910 + width = 1080 + height = 720 + frameRate = 31.004547 + colorInfo: + colorSpace = 1 + colorRange = 2 + colorTransfer = 3 + lumaBitdepth = 8 + chromaBitdepth = 8 + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 23, hash 33E412EE + data = length 9, hash FBAFBC0C + sample 0: + time = 0 + flags = 1 + data = length 7744, hash DDF91733 + sample 1: + time = 33355 + flags = 0 + data = length 1168, hash 89E48A20 + sample 2: + time = 66722 + flags = 0 + data = length 960, hash D4AD9EF0 + sample 3: + time = 100100 + flags = 0 + data = length 976, hash CD49C23C + sample 4: + time = 133455 + flags = 0 + data = length 1360, hash 337B78A9 + sample 5: + time = 166822 + flags = 0 + data = length 2288, hash 5D5FD1C8 + sample 6: + time = 200200 + flags = 0 + data = length 3856, hash 3D7DCD46 + sample 7: + time = 233555 + flags = 0 + data = length 4048, hash 47C78814 + sample 8: + time = 266922 + flags = 0 + data = length 6144, hash 8FD9AD7D + sample 9: + time = 300300 + flags = 0 + data = length 7632, hash 4245F848 + sample 10: + time = 333655 + flags = 0 + data = length 9792, hash B2B9AB4B + sample 11: + time = 367022 + flags = 0 + data = length 14496, hash E0F2E0BA + sample 12: + time = 400400 + flags = 0 + data = length 17664, hash 3E3189E + sample 13: + time = 433755 + flags = 0 + data = length 5712, hash CA808ECF + sample 14: + time = 467122 + flags = 0 + data = length 9776, hash C875D1AA + sample 15: + time = 500500 + flags = 0 + data = length 17712, hash 69AE17D4 + sample 16: + time = 533855 + flags = 0 + data = length 11440, hash 7370E78C + sample 17: + time = 567222 + flags = 0 + data = length 8544, hash 5A581986 + sample 18: + time = 600600 + flags = 0 + data = length 19904, hash 98AB5C44 + sample 19: + time = 633955 + flags = 0 + data = length 14352, hash 74B754E3 + sample 20: + time = 667322 + flags = 0 + data = length 9568, hash 369746A6 + sample 21: + time = 700700 + flags = 0 + data = length 12192, hash E0F8A71A + sample 22: + time = 734055 + flags = 0 + data = length 22880, hash 75E833BA + sample 23: + time = 767422 + flags = 0 + data = length 16832, hash E8BFCFE3 + sample 24: + time = 800800 + flags = 0 + data = length 5120, hash E04AEF94 + sample 25: + time = 834155 + flags = 0 + data = length 9888, hash 1166103E + sample 26: + time = 867522 + flags = 0 + data = length 17024, hash F9A96740 + sample 27: + time = 900900 + flags = 0 + data = length 20864, hash DF9E88B8 + sample 28: + time = 934255 + flags = 0 + data = length 7216, hash BE22BE2F + sample 29: + time = 967622 + flags = 536870912 + data = length 14240, hash E190BF31 +track 1: + total output bytes = 9529 + sample count = 45 + format 0: + id = 3 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.2 + maxInputSize = 294 + channelCount = 1 + sampleRate = 44100 + language = und + metadata = entries=[mdta: key=com.android.version, value=13, xyz: latitude=40.68, longitude=-74.4999, Mp4Timestamp: creation time=2000000000, modification time=2000000000, timescale=10000] + initializationData: + data = length 2, hash 5F7 + sample 0: + time = 0 + flags = 1 + data = length 23, hash 47DE9131 + sample 1: + time = 67208 + flags = 1 + data = length 6, hash 31EC5206 + sample 2: + time = 90437 + flags = 1 + data = length 148, hash 894A176B + sample 3: + time = 113645 + flags = 1 + data = length 189, hash CEF235A1 + sample 4: + time = 136875 + flags = 1 + data = length 205, hash BBF5F7B0 + sample 5: + time = 160083 + flags = 1 + data = length 210, hash F278B193 + sample 6: + time = 183312 + flags = 1 + data = length 210, hash 82DA1589 + sample 7: + time = 206520 + flags = 1 + data = length 207, hash 5BE231DF + sample 8: + time = 229750 + flags = 1 + data = length 225, hash 18819EE1 + sample 9: + time = 252958 + flags = 1 + data = length 215, hash CA7FA67B + sample 10: + time = 276187 + flags = 1 + data = length 211, hash 581A1C18 + sample 11: + time = 299416 + flags = 1 + data = length 216, hash ADB88187 + sample 12: + time = 322625 + flags = 1 + data = length 229, hash 2E8BA4DC + sample 13: + time = 345854 + flags = 1 + data = length 232, hash 22F0C510 + sample 14: + time = 369062 + flags = 1 + data = length 235, hash 867AD0DC + sample 15: + time = 392291 + flags = 1 + data = length 231, hash 84E823A8 + sample 16: + time = 415500 + flags = 1 + data = length 226, hash 1BEF3A95 + sample 17: + time = 438729 + flags = 1 + data = length 216, hash EAA345AE + sample 18: + time = 461958 + flags = 1 + data = length 229, hash 6957411F + sample 19: + time = 485166 + flags = 1 + data = length 219, hash 41275022 + sample 20: + time = 508395 + flags = 1 + data = length 241, hash 6495DF96 + sample 21: + time = 531604 + flags = 1 + data = length 228, hash 63D95906 + sample 22: + time = 554833 + flags = 1 + data = length 238, hash 34F676F9 + sample 23: + time = 578041 + flags = 1 + data = length 234, hash E5CBC045 + sample 24: + time = 601270 + flags = 1 + data = length 231, hash 5FC43661 + sample 25: + time = 624479 + flags = 1 + data = length 217, hash 682708ED + sample 26: + time = 647708 + flags = 1 + data = length 239, hash D43780FC + sample 27: + time = 670937 + flags = 1 + data = length 243, hash C5E17980 + sample 28: + time = 694145 + flags = 1 + data = length 231, hash AC5837BA + sample 29: + time = 717375 + flags = 1 + data = length 230, hash 169EE895 + sample 30: + time = 740583 + flags = 1 + data = length 238, hash C48FF3F1 + sample 31: + time = 763812 + flags = 1 + data = length 225, hash 531E4599 + sample 32: + time = 787020 + flags = 1 + data = length 232, hash CB3C6B8D + sample 33: + time = 810250 + flags = 1 + data = length 243, hash F8C94C7 + sample 34: + time = 833458 + flags = 1 + data = length 232, hash A646A7D0 + sample 35: + time = 856687 + flags = 1 + data = length 237, hash E8B787A5 + sample 36: + time = 879916 + flags = 1 + data = length 228, hash 3FA7A29F + sample 37: + time = 903125 + flags = 1 + data = length 235, hash B9B33B0A + sample 38: + time = 926354 + flags = 1 + data = length 264, hash 71A4869E + sample 39: + time = 949562 + flags = 1 + data = length 257, hash D049B54C + sample 40: + time = 972791 + flags = 1 + data = length 227, hash 66757231 + sample 41: + time = 996000 + flags = 1 + data = length 227, hash BD374F1B + sample 42: + time = 1019229 + flags = 1 + data = length 235, hash 999477F6 + sample 43: + time = 1042437 + flags = 1 + data = length 229, hash FFF98DF0 + sample 44: + time = 1065666 + flags = 536870913 + data = length 6, hash 31B22286 +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/media/mp4/sample_empty_track.mp4 b/libraries/test_data/src/test/assets/media/mp4/sample_empty_track.mp4 new file mode 100644 index 0000000000..50d96651a3 Binary files /dev/null and b/libraries/test_data/src/test/assets/media/mp4/sample_empty_track.mp4 differ