diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/ts/TsExtractorTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/ts/TsExtractorTest.java index 5658523dca..1e7ea06ada 100644 --- a/libraries/extractor/src/test/java/androidx/media3/extractor/ts/TsExtractorTest.java +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/ts/TsExtractorTest.java @@ -237,6 +237,14 @@ public final class TsExtractorTest { simulationConfig); } + @Test + public void streamWithAudioTypeOfMpegAudio() throws Exception { + ExtractorAsserts.assertBehavior( + getExtractorFactory(subtitlesParsedDuringExtraction), + "media/ts/sample_mpeg_audio_with_audio_type.ts", + simulationConfig); + } + @Test public void customPesReader() throws Exception { CustomTsPayloadReaderFactory factory = new CustomTsPayloadReaderFactory(true, false); diff --git a/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.0.dump b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.0.dump new file mode 100644 index 0000000000..2659604267 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.0.dump @@ -0,0 +1,188 @@ +seekMap: + isSeekable = true + duration = 720000 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(360000) = [[timeUs=360000, position=4544]] + getPosition(720000) = [[timeUs=720000, position=9277]] +numberOfTracks = 1 +track 256: + total output bytes = 8064 + sample count = 42 + format 0: + id = 1/256 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 48000 + roleFlags = [describes-video] + language = en + sample 0: + time = 0 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 1: + time = 24000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 2: + time = 48000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 3: + time = 72000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 4: + time = 96000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 5: + time = 120000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 6: + time = 144000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 7: + time = 168000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 8: + time = 192000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 9: + time = 216000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 10: + time = 240000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 11: + time = 264000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 12: + time = 288000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 13: + time = 312000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 14: + time = 336000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 15: + time = 360000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 16: + time = 384000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 17: + time = 408000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 18: + time = 432000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 19: + time = 456000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 20: + time = 480000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 21: + time = 504000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 22: + time = 528000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 23: + time = 552000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 24: + time = 576000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 25: + time = 600000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 26: + time = 624000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 27: + time = 648000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 28: + time = 672000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 29: + time = 696000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 30: + time = 720000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 31: + time = 744000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 32: + time = 768000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 33: + time = 792000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 34: + time = 816000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 35: + time = 840000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 36: + time = 864000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 37: + time = 888000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 38: + time = 912000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 39: + time = 936000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 40: + time = 960000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 41: + time = 984000 + flags = 1 + data = length 192, hash 6EF2DD4B +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.1.dump b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.1.dump new file mode 100644 index 0000000000..2659604267 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.1.dump @@ -0,0 +1,188 @@ +seekMap: + isSeekable = true + duration = 720000 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(360000) = [[timeUs=360000, position=4544]] + getPosition(720000) = [[timeUs=720000, position=9277]] +numberOfTracks = 1 +track 256: + total output bytes = 8064 + sample count = 42 + format 0: + id = 1/256 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 48000 + roleFlags = [describes-video] + language = en + sample 0: + time = 0 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 1: + time = 24000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 2: + time = 48000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 3: + time = 72000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 4: + time = 96000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 5: + time = 120000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 6: + time = 144000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 7: + time = 168000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 8: + time = 192000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 9: + time = 216000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 10: + time = 240000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 11: + time = 264000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 12: + time = 288000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 13: + time = 312000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 14: + time = 336000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 15: + time = 360000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 16: + time = 384000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 17: + time = 408000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 18: + time = 432000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 19: + time = 456000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 20: + time = 480000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 21: + time = 504000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 22: + time = 528000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 23: + time = 552000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 24: + time = 576000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 25: + time = 600000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 26: + time = 624000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 27: + time = 648000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 28: + time = 672000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 29: + time = 696000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 30: + time = 720000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 31: + time = 744000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 32: + time = 768000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 33: + time = 792000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 34: + time = 816000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 35: + time = 840000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 36: + time = 864000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 37: + time = 888000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 38: + time = 912000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 39: + time = 936000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 40: + time = 960000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 41: + time = 984000 + flags = 1 + data = length 192, hash 6EF2DD4B +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.2.dump b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.2.dump new file mode 100644 index 0000000000..bf8ed25b17 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.2.dump @@ -0,0 +1,128 @@ +seekMap: + isSeekable = true + duration = 720000 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(360000) = [[timeUs=360000, position=4544]] + getPosition(720000) = [[timeUs=720000, position=9277]] +numberOfTracks = 1 +track 256: + total output bytes = 5184 + sample count = 27 + format 0: + id = 1/256 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 48000 + roleFlags = [describes-video] + language = en + sample 0: + time = 360000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 1: + time = 384000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 2: + time = 408000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 3: + time = 432000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 4: + time = 456000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 5: + time = 480000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 6: + time = 504000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 7: + time = 528000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 8: + time = 552000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 9: + time = 576000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 10: + time = 600000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 11: + time = 624000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 12: + time = 648000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 13: + time = 672000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 14: + time = 696000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 15: + time = 720000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 16: + time = 744000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 17: + time = 768000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 18: + time = 792000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 19: + time = 816000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 20: + time = 840000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 21: + time = 864000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 22: + time = 888000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 23: + time = 912000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 24: + time = 936000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 25: + time = 960000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 26: + time = 984000 + flags = 1 + data = length 192, hash 6EF2DD4B +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.3.dump b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.3.dump new file mode 100644 index 0000000000..42d68e1e98 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.3.dump @@ -0,0 +1,20 @@ +seekMap: + isSeekable = true + duration = 720000 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(360000) = [[timeUs=360000, position=4544]] + getPosition(720000) = [[timeUs=720000, position=9277]] +numberOfTracks = 1 +track 256: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/256 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 48000 + roleFlags = [describes-video] + language = en +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.unknown_length.dump new file mode 100644 index 0000000000..61a26f2629 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.unknown_length.dump @@ -0,0 +1,185 @@ +seekMap: + isSeekable = false + duration = UNSET TIME + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 1 +track 256: + total output bytes = 8064 + sample count = 42 + format 0: + id = 1/256 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 48000 + roleFlags = [describes-video] + language = en + sample 0: + time = 0 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 1: + time = 24000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 2: + time = 48000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 3: + time = 72000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 4: + time = 96000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 5: + time = 120000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 6: + time = 144000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 7: + time = 168000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 8: + time = 192000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 9: + time = 216000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 10: + time = 240000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 11: + time = 264000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 12: + time = 288000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 13: + time = 312000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 14: + time = 336000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 15: + time = 360000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 16: + time = 384000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 17: + time = 408000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 18: + time = 432000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 19: + time = 456000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 20: + time = 480000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 21: + time = 504000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 22: + time = 528000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 23: + time = 552000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 24: + time = 576000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 25: + time = 600000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 26: + time = 624000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 27: + time = 648000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 28: + time = 672000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 29: + time = 696000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 30: + time = 720000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 31: + time = 744000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 32: + time = 768000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 33: + time = 792000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 34: + time = 816000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 35: + time = 840000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 36: + time = 864000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 37: + time = 888000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 38: + time = 912000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 39: + time = 936000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 40: + time = 960000 + flags = 1 + data = length 192, hash 6EF2DD4B + sample 41: + time = 984000 + flags = 1 + data = length 192, hash 6EF2DD4B +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/media/ts/sample_mpeg_audio_with_audio_type.ts b/libraries/test_data/src/test/assets/media/ts/sample_mpeg_audio_with_audio_type.ts new file mode 100644 index 0000000000..983d76098b Binary files /dev/null and b/libraries/test_data/src/test/assets/media/ts/sample_mpeg_audio_with_audio_type.ts differ