diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java index cacb094742..8900629912 100644 --- a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java @@ -47,6 +47,13 @@ public final class Mp3ExtractorTest { Mp3Extractor::new, "media/mp3/test-cbr-info-header.mp3", simulationConfig); } + // https://github.com/androidx/media/issues/1376#issuecomment-2117393653 + @Test + public void mp3SampleWithInfoHeaderAndPcutFrame() throws Exception { + ExtractorAsserts.assertBehavior( + Mp3Extractor::new, "media/mp3/test-cbr-info-header-pcut-frame.mp3", simulationConfig); + } + @Test public void mp3SampleWithCbrSeeker() throws Exception { ExtractorAsserts.assertBehavior( diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump new file mode 100644 index 0000000000..67c6563098 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump @@ -0,0 +1,185 @@ +seekMap: + isSeekable = true + duration = 2115750 + getPosition(0) = [[timeUs=0, position=227]] + getPosition(1) = [[timeUs=0, position=227], [timeUs=26000, position=331]] + getPosition(1057875) = [[timeUs=1040000, position=4387], [timeUs=1066000, position=4491]] + getPosition(2115750) = [[timeUs=2089750, position=8586]] +numberOfTracks = 1 +track 0: + total output bytes = 8463 + sample count = 41 + format 0: + averageBitrate = 32000 + sampleMimeType = audio/mpeg + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + encoderDelay = 576 + encoderPadding = 1404 + metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] + sample 0: + time = 0 + flags = 1 + data = length 104, hash BF3B0C83 + sample 1: + time = 26122 + flags = 1 + data = length 208, hash 5E56C6DF + sample 2: + time = 52244 + flags = 1 + data = length 209, hash 4FA4483 + sample 3: + time = 78367 + flags = 1 + data = length 209, hash E1201788 + sample 4: + time = 104489 + flags = 1 + data = length 209, hash FDB8052B + sample 5: + time = 130612 + flags = 1 + data = length 209, hash A8FF2C9 + sample 6: + time = 156734 + flags = 1 + data = length 209, hash FD4AE506 + sample 7: + time = 182857 + flags = 1 + data = length 209, hash EA0AC2FE + sample 8: + time = 208979 + flags = 1 + data = length 209, hash 84B9DDE0 + sample 9: + time = 235102 + flags = 1 + data = length 209, hash 796A4F65 + sample 10: + time = 261224 + flags = 1 + data = length 209, hash 4DE92719 + sample 11: + time = 287346 + flags = 1 + data = length 209, hash 458A4711 + sample 12: + time = 313469 + flags = 1 + data = length 209, hash 27954F2B + sample 13: + time = 339591 + flags = 1 + data = length 209, hash 1A5042B0 + sample 14: + time = 365714 + flags = 1 + data = length 209, hash 6CCBBB3B + sample 15: + time = 391836 + flags = 1 + data = length 209, hash 34191E1 + sample 16: + time = 417959 + flags = 1 + data = length 209, hash 57323ED7 + sample 17: + time = 444081 + flags = 1 + data = length 209, hash 75618CF3 + sample 18: + time = 470204 + flags = 1 + data = length 209, hash 784C973B + sample 19: + time = 496326 + flags = 1 + data = length 209, hash 49106390 + sample 20: + time = 522448 + flags = 1 + data = length 209, hash 70F6A563 + sample 21: + time = 548571 + flags = 1 + data = length 209, hash 721882B0 + sample 22: + time = 574693 + flags = 1 + data = length 209, hash 81C62AEE + sample 23: + time = 600816 + flags = 1 + data = length 209, hash 16D22463 + sample 24: + time = 626938 + flags = 1 + data = length 209, hash 47033534 + sample 25: + time = 653061 + flags = 1 + data = length 209, hash CECB37A6 + sample 26: + time = 679183 + flags = 1 + data = length 209, hash 6C9C307B + sample 27: + time = 705306 + flags = 1 + data = length 209, hash 3EB1A364 + sample 28: + time = 731428 + flags = 1 + data = length 209, hash 30962500 + sample 29: + time = 757551 + flags = 1 + data = length 209, hash 2C5CCBB7 + sample 30: + time = 783673 + flags = 1 + data = length 209, hash F9CB9E37 + sample 31: + time = 809795 + flags = 1 + data = length 209, hash F75BC8C0 + sample 32: + time = 835918 + flags = 1 + data = length 209, hash D00ED607 + sample 33: + time = 862040 + flags = 1 + data = length 209, hash B4338395 + sample 34: + time = 888163 + flags = 1 + data = length 209, hash E3E838A0 + sample 35: + time = 914285 + flags = 1 + data = length 209, hash 2B0CF78 + sample 36: + time = 940408 + flags = 1 + data = length 209, hash 31906FA9 + sample 37: + time = 966530 + flags = 1 + data = length 209, hash C92FC08F + sample 38: + time = 992653 + flags = 1 + data = length 209, hash 7C89994 + sample 39: + time = 1018775 + flags = 1 + data = length 209, hash EC37743B + sample 40: + time = 1044897 + flags = 1 + data = length 209, hash C974F6FB +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump new file mode 100644 index 0000000000..980313e82a --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump @@ -0,0 +1,129 @@ +seekMap: + isSeekable = true + duration = 2115750 + getPosition(0) = [[timeUs=0, position=227]] + getPosition(1) = [[timeUs=0, position=227], [timeUs=26000, position=331]] + getPosition(1057875) = [[timeUs=1040000, position=4387], [timeUs=1066000, position=4491]] + getPosition(2115750) = [[timeUs=2089750, position=8586]] +numberOfTracks = 1 +track 0: + total output bytes = 5643 + sample count = 27 + format 0: + averageBitrate = 32000 + sampleMimeType = audio/mpeg + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + encoderDelay = 576 + encoderPadding = 1404 + metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] + sample 0: + time = 705000 + flags = 1 + data = length 209, hash 6CCBBB3B + sample 1: + time = 731122 + flags = 1 + data = length 209, hash 34191E1 + sample 2: + time = 757244 + flags = 1 + data = length 209, hash 57323ED7 + sample 3: + time = 783367 + flags = 1 + data = length 209, hash 75618CF3 + sample 4: + time = 809489 + flags = 1 + data = length 209, hash 784C973B + sample 5: + time = 835612 + flags = 1 + data = length 209, hash 49106390 + sample 6: + time = 861734 + flags = 1 + data = length 209, hash 70F6A563 + sample 7: + time = 887857 + flags = 1 + data = length 209, hash 721882B0 + sample 8: + time = 913979 + flags = 1 + data = length 209, hash 81C62AEE + sample 9: + time = 940102 + flags = 1 + data = length 209, hash 16D22463 + sample 10: + time = 966224 + flags = 1 + data = length 209, hash 47033534 + sample 11: + time = 992346 + flags = 1 + data = length 209, hash CECB37A6 + sample 12: + time = 1018469 + flags = 1 + data = length 209, hash 6C9C307B + sample 13: + time = 1044591 + flags = 1 + data = length 209, hash 3EB1A364 + sample 14: + time = 1070714 + flags = 1 + data = length 209, hash 30962500 + sample 15: + time = 1096836 + flags = 1 + data = length 209, hash 2C5CCBB7 + sample 16: + time = 1122959 + flags = 1 + data = length 209, hash F9CB9E37 + sample 17: + time = 1149081 + flags = 1 + data = length 209, hash F75BC8C0 + sample 18: + time = 1175204 + flags = 1 + data = length 209, hash D00ED607 + sample 19: + time = 1201326 + flags = 1 + data = length 209, hash B4338395 + sample 20: + time = 1227448 + flags = 1 + data = length 209, hash E3E838A0 + sample 21: + time = 1253571 + flags = 1 + data = length 209, hash 2B0CF78 + sample 22: + time = 1279693 + flags = 1 + data = length 209, hash 31906FA9 + sample 23: + time = 1305816 + flags = 1 + data = length 209, hash C92FC08F + sample 24: + time = 1331938 + flags = 1 + data = length 209, hash 7C89994 + sample 25: + time = 1358061 + flags = 1 + data = length 209, hash EC37743B + sample 26: + time = 1384183 + flags = 1 + data = length 209, hash C974F6FB +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump new file mode 100644 index 0000000000..27ea66dd9d --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump @@ -0,0 +1,73 @@ +seekMap: + isSeekable = true + duration = 2115750 + getPosition(0) = [[timeUs=0, position=227]] + getPosition(1) = [[timeUs=0, position=227], [timeUs=26000, position=331]] + getPosition(1057875) = [[timeUs=1040000, position=4387], [timeUs=1066000, position=4491]] + getPosition(2115750) = [[timeUs=2089750, position=8586]] +numberOfTracks = 1 +track 0: + total output bytes = 2717 + sample count = 13 + format 0: + averageBitrate = 32000 + sampleMimeType = audio/mpeg + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + encoderDelay = 576 + encoderPadding = 1404 + metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] + sample 0: + time = 1436500 + flags = 1 + data = length 209, hash 30962500 + sample 1: + time = 1462622 + flags = 1 + data = length 209, hash 2C5CCBB7 + sample 2: + time = 1488744 + flags = 1 + data = length 209, hash F9CB9E37 + sample 3: + time = 1514867 + flags = 1 + data = length 209, hash F75BC8C0 + sample 4: + time = 1540989 + flags = 1 + data = length 209, hash D00ED607 + sample 5: + time = 1567112 + flags = 1 + data = length 209, hash B4338395 + sample 6: + time = 1593234 + flags = 1 + data = length 209, hash E3E838A0 + sample 7: + time = 1619357 + flags = 1 + data = length 209, hash 2B0CF78 + sample 8: + time = 1645479 + flags = 1 + data = length 209, hash 31906FA9 + sample 9: + time = 1671602 + flags = 1 + data = length 209, hash C92FC08F + sample 10: + time = 1697724 + flags = 1 + data = length 209, hash 7C89994 + sample 11: + time = 1723846 + flags = 1 + data = length 209, hash EC37743B + sample 12: + time = 1749969 + flags = 1 + data = length 209, hash C974F6FB +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump new file mode 100644 index 0000000000..c8ea78c118 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump @@ -0,0 +1,21 @@ +seekMap: + isSeekable = true + duration = 2115750 + getPosition(0) = [[timeUs=0, position=227]] + getPosition(1) = [[timeUs=0, position=227], [timeUs=26000, position=331]] + getPosition(1057875) = [[timeUs=1040000, position=4387], [timeUs=1066000, position=4491]] + getPosition(2115750) = [[timeUs=2089750, position=8586]] +numberOfTracks = 1 +track 0: + total output bytes = 0 + sample count = 0 + format 0: + averageBitrate = 32000 + sampleMimeType = audio/mpeg + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + encoderDelay = 576 + encoderPadding = 1404 + metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump new file mode 100644 index 0000000000..67c6563098 --- /dev/null +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump @@ -0,0 +1,185 @@ +seekMap: + isSeekable = true + duration = 2115750 + getPosition(0) = [[timeUs=0, position=227]] + getPosition(1) = [[timeUs=0, position=227], [timeUs=26000, position=331]] + getPosition(1057875) = [[timeUs=1040000, position=4387], [timeUs=1066000, position=4491]] + getPosition(2115750) = [[timeUs=2089750, position=8586]] +numberOfTracks = 1 +track 0: + total output bytes = 8463 + sample count = 41 + format 0: + averageBitrate = 32000 + sampleMimeType = audio/mpeg + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + encoderDelay = 576 + encoderPadding = 1404 + metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] + sample 0: + time = 0 + flags = 1 + data = length 104, hash BF3B0C83 + sample 1: + time = 26122 + flags = 1 + data = length 208, hash 5E56C6DF + sample 2: + time = 52244 + flags = 1 + data = length 209, hash 4FA4483 + sample 3: + time = 78367 + flags = 1 + data = length 209, hash E1201788 + sample 4: + time = 104489 + flags = 1 + data = length 209, hash FDB8052B + sample 5: + time = 130612 + flags = 1 + data = length 209, hash A8FF2C9 + sample 6: + time = 156734 + flags = 1 + data = length 209, hash FD4AE506 + sample 7: + time = 182857 + flags = 1 + data = length 209, hash EA0AC2FE + sample 8: + time = 208979 + flags = 1 + data = length 209, hash 84B9DDE0 + sample 9: + time = 235102 + flags = 1 + data = length 209, hash 796A4F65 + sample 10: + time = 261224 + flags = 1 + data = length 209, hash 4DE92719 + sample 11: + time = 287346 + flags = 1 + data = length 209, hash 458A4711 + sample 12: + time = 313469 + flags = 1 + data = length 209, hash 27954F2B + sample 13: + time = 339591 + flags = 1 + data = length 209, hash 1A5042B0 + sample 14: + time = 365714 + flags = 1 + data = length 209, hash 6CCBBB3B + sample 15: + time = 391836 + flags = 1 + data = length 209, hash 34191E1 + sample 16: + time = 417959 + flags = 1 + data = length 209, hash 57323ED7 + sample 17: + time = 444081 + flags = 1 + data = length 209, hash 75618CF3 + sample 18: + time = 470204 + flags = 1 + data = length 209, hash 784C973B + sample 19: + time = 496326 + flags = 1 + data = length 209, hash 49106390 + sample 20: + time = 522448 + flags = 1 + data = length 209, hash 70F6A563 + sample 21: + time = 548571 + flags = 1 + data = length 209, hash 721882B0 + sample 22: + time = 574693 + flags = 1 + data = length 209, hash 81C62AEE + sample 23: + time = 600816 + flags = 1 + data = length 209, hash 16D22463 + sample 24: + time = 626938 + flags = 1 + data = length 209, hash 47033534 + sample 25: + time = 653061 + flags = 1 + data = length 209, hash CECB37A6 + sample 26: + time = 679183 + flags = 1 + data = length 209, hash 6C9C307B + sample 27: + time = 705306 + flags = 1 + data = length 209, hash 3EB1A364 + sample 28: + time = 731428 + flags = 1 + data = length 209, hash 30962500 + sample 29: + time = 757551 + flags = 1 + data = length 209, hash 2C5CCBB7 + sample 30: + time = 783673 + flags = 1 + data = length 209, hash F9CB9E37 + sample 31: + time = 809795 + flags = 1 + data = length 209, hash F75BC8C0 + sample 32: + time = 835918 + flags = 1 + data = length 209, hash D00ED607 + sample 33: + time = 862040 + flags = 1 + data = length 209, hash B4338395 + sample 34: + time = 888163 + flags = 1 + data = length 209, hash E3E838A0 + sample 35: + time = 914285 + flags = 1 + data = length 209, hash 2B0CF78 + sample 36: + time = 940408 + flags = 1 + data = length 209, hash 31906FA9 + sample 37: + time = 966530 + flags = 1 + data = length 209, hash C92FC08F + sample 38: + time = 992653 + flags = 1 + data = length 209, hash 7C89994 + sample 39: + time = 1018775 + flags = 1 + data = length 209, hash EC37743B + sample 40: + time = 1044897 + flags = 1 + data = length 209, hash C974F6FB +tracksEnded = true diff --git a/libraries/test_data/src/test/assets/media/mp3/test-cbr-info-header-pcut-frame.mp3 b/libraries/test_data/src/test/assets/media/mp3/test-cbr-info-header-pcut-frame.mp3 new file mode 100644 index 0000000000..2fee1312e0 Binary files /dev/null and b/libraries/test_data/src/test/assets/media/mp3/test-cbr-info-header-pcut-frame.mp3 differ