From 286b1f52d906914af38492b90af19018f3e751eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Va=C5=99e=C4=8Dka?= Date: Tue, 16 Jan 2024 01:50:00 +0100 Subject: [PATCH] Add test for MPEG audio with audio type --- .../media3/extractor/ts/TsExtractorTest.java | 8 + ...ample_mpeg_audio_with_audio_type.ts.0.dump | 188 ++++++++++++++++++ ...ample_mpeg_audio_with_audio_type.ts.1.dump | 188 ++++++++++++++++++ ...ample_mpeg_audio_with_audio_type.ts.2.dump | 128 ++++++++++++ ...ample_mpeg_audio_with_audio_type.ts.3.dump | 20 ++ ...dio_with_audio_type.ts.unknown_length.dump | 185 +++++++++++++++++ .../ts/sample_mpeg_audio_with_audio_type.ts | Bin 0 -> 9964 bytes 7 files changed, 717 insertions(+) create mode 100644 libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.0.dump create mode 100644 libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.1.dump create mode 100644 libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.2.dump create mode 100644 libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.3.dump create mode 100644 libraries/test_data/src/test/assets/extractordumps/ts/sample_mpeg_audio_with_audio_type.ts.unknown_length.dump create mode 100644 libraries/test_data/src/test/assets/media/ts/sample_mpeg_audio_with_audio_type.ts 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 0000000000000000000000000000000000000000..983d76098bf4841ed03aa8a29acb2deecd35a5cf GIT binary patch literal 9964 zcmZ>F5ENi=`k>0dc#whNKjVJ}#y<@r9zu+4Zf>~+sp*`-sYPX($*Bg0~;pm4-8rxSvCzWC*pLCdjQbwOdBM?Zhy$|fq@xFuyL`Z=A|<)b;_QK zQ{y0zaCc-dU=LtmsOG6-U|?W8!0pk{z^cf=ek1Y!Uzan^NZ~d(Ad+*-PpY;=Hz_qQPn;plKLFh>L{yLsLO%fAE)0qpqN9Bf`2py55nSnMu%{)U+eHcGiNWdzpxecW z&DVp?4?wqzlUgNi^zsAH z?J~4#Z_wHgK)1`%y3Ir@KLFh>N3V7twfz8eyS*j@v5j$hw{r3O7T9kR9K!u3!J*!7 z+7*J*Z{ob#IC%RUu>J-xy^r>r$m#@8)_(KH6_0bx4>B@c<0>(S8#ViLOf#c%Wdkt(4Gj0u zxiZ+20V=c)i5*i1hWqGT8Lp)pG>ivexR1`25xazjitzvpcN<5d=RI)Ej||Lg8vqok Ba`pfK literal 0 HcmV?d00001