diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java index 3830a1036f..26ad5cdafa 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java @@ -49,12 +49,12 @@ public final class TsExtractorTest { } @Test - public void sampleScte35() throws Exception { + public void sampleWithScte35() throws Exception { ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_scte35.ts"); } @Test - public void withAit() throws Exception { + public void sampleWithAit() throws Exception { ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_ait.ts"); } @@ -78,6 +78,16 @@ public final class TsExtractorTest { ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_eac3joc.ts"); } + @Test + public void sampleWithH264() throws Exception { + ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_h264.ts"); + } + + @Test + public void sampleWithLatm() throws Exception { + ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_latm.ts"); + } + @Test public void streamWithJunkData() throws Exception { ExtractorAsserts.assertBehavior( diff --git a/testdata/src/test/assets/ts/sample_h264.ts b/testdata/src/test/assets/ts/sample_h264.ts new file mode 100644 index 0000000000..dabf547e19 Binary files /dev/null and b/testdata/src/test/assets/ts/sample_h264.ts differ diff --git a/testdata/src/test/assets/ts/sample_h264.ts.0.dump b/testdata/src/test/assets/ts/sample_h264.ts.0.dump new file mode 100644 index 0000000000..49ec76ee00 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_h264.ts.0.dump @@ -0,0 +1,61 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=9545]] + getPosition(66733) = [[timeUs=66733, position=19279]] +numberOfTracks = 3 +track 256: + total output bytes = 13650 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/avc + codecs = avc1.64001E + width = 640 + height = 426 + initializationData: + data = length 29, hash 4C2CAE9C + data = length 9, hash D971CD89 + sample 0: + time = 66733 + flags = 1 + data = length 12394, hash A39F5311 + sample 1: + time = 100100 + flags = 0 + data = length 813, hash 99F7B4FA +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + id = 1/257 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + language = und + sample 0: + time = 66733 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 92855 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 118977 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 145099 + flags = 1 + data = length 1254, hash 73FB07B8 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_h264.ts.1.dump b/testdata/src/test/assets/ts/sample_h264.ts.1.dump new file mode 100644 index 0000000000..ddd38b6597 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_h264.ts.1.dump @@ -0,0 +1,61 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=9545]] + getPosition(66733) = [[timeUs=66733, position=19279]] +numberOfTracks = 3 +track 256: + total output bytes = 13650 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/avc + codecs = avc1.64001E + width = 640 + height = 426 + initializationData: + data = length 29, hash 4C2CAE9C + data = length 9, hash D971CD89 + sample 0: + time = 88977 + flags = 1 + data = length 12394, hash A39F5311 + sample 1: + time = 122344 + flags = 0 + data = length 813, hash 99F7B4FA +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + id = 1/257 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + language = und + sample 0: + time = 88977 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 115099 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 141221 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 167343 + flags = 1 + data = length 1254, hash 73FB07B8 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_h264.ts.2.dump b/testdata/src/test/assets/ts/sample_h264.ts.2.dump new file mode 100644 index 0000000000..53290c3fa3 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_h264.ts.2.dump @@ -0,0 +1,61 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=9545]] + getPosition(66733) = [[timeUs=66733, position=19279]] +numberOfTracks = 3 +track 256: + total output bytes = 13650 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/avc + codecs = avc1.64001E + width = 640 + height = 426 + initializationData: + data = length 29, hash 4C2CAE9C + data = length 9, hash D971CD89 + sample 0: + time = 111221 + flags = 1 + data = length 12394, hash A39F5311 + sample 1: + time = 144588 + flags = 0 + data = length 813, hash 99F7B4FA +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + id = 1/257 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + language = und + sample 0: + time = 111221 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 137343 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 163465 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 189587 + flags = 1 + data = length 1254, hash 73FB07B8 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_h264.ts.3.dump b/testdata/src/test/assets/ts/sample_h264.ts.3.dump new file mode 100644 index 0000000000..2be5c14165 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_h264.ts.3.dump @@ -0,0 +1,37 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=9545]] + getPosition(66733) = [[timeUs=66733, position=19279]] +numberOfTracks = 3 +track 256: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/256 + sampleMimeType = video/avc + codecs = avc1.64001E + width = 640 + height = 426 + initializationData: + data = length 29, hash 4C2CAE9C + data = length 9, hash D971CD89 +track 257: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/257 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + language = und +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_h264.ts.unknown_length.dump b/testdata/src/test/assets/ts/sample_h264.ts.unknown_length.dump new file mode 100644 index 0000000000..86327e7fa8 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_h264.ts.unknown_length.dump @@ -0,0 +1,58 @@ +seekMap: + isSeekable = false + duration = UNSET TIME + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 3 +track 256: + total output bytes = 13650 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/avc + codecs = avc1.64001E + width = 640 + height = 426 + initializationData: + data = length 29, hash 4C2CAE9C + data = length 9, hash D971CD89 + sample 0: + time = 66733 + flags = 1 + data = length 12394, hash A39F5311 + sample 1: + time = 100100 + flags = 0 + data = length 813, hash 99F7B4FA +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + id = 1/257 + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + channelCount = 1 + sampleRate = 44100 + language = und + sample 0: + time = 66733 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 92855 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 118977 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 145099 + flags = 1 + data = length 1254, hash 73FB07B8 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_latm.ts b/testdata/src/test/assets/ts/sample_latm.ts new file mode 100644 index 0000000000..6a5be6784a Binary files /dev/null and b/testdata/src/test/assets/ts/sample_latm.ts differ diff --git a/testdata/src/test/assets/ts/sample_latm.ts.0.dump b/testdata/src/test/assets/ts/sample_latm.ts.0.dump new file mode 100644 index 0000000000..a835568cd3 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_latm.ts.0.dump @@ -0,0 +1,65 @@ +seekMap: + isSeekable = true + duration = 0 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(0) = [[timeUs=0, position=0]] + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 3 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/mpeg2 + width = 640 + height = 426 + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33367 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 1396 + sample count = 5 + format 0: + id = 1/257 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.5 + channelCount = 1 + sampleRate = 44100 + language = und + initializationData: + data = length 4, hash 1FE978 + sample 0: + time = -92233 + flags = 1 + data = length 279, hash 79BF9F9B + sample 1: + time = -69014 + flags = 1 + data = length 279, hash C96F4684 + sample 2: + time = -45795 + flags = 1 + data = length 279, hash 65670B86 + sample 3: + time = -22576 + flags = 1 + data = length 280, hash 1AF29BCE + sample 4: + time = 643 + flags = 1 + data = length 279, hash C96F4684 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_latm.ts.1.dump b/testdata/src/test/assets/ts/sample_latm.ts.1.dump new file mode 100644 index 0000000000..a835568cd3 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_latm.ts.1.dump @@ -0,0 +1,65 @@ +seekMap: + isSeekable = true + duration = 0 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(0) = [[timeUs=0, position=0]] + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 3 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/mpeg2 + width = 640 + height = 426 + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33367 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 1396 + sample count = 5 + format 0: + id = 1/257 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.5 + channelCount = 1 + sampleRate = 44100 + language = und + initializationData: + data = length 4, hash 1FE978 + sample 0: + time = -92233 + flags = 1 + data = length 279, hash 79BF9F9B + sample 1: + time = -69014 + flags = 1 + data = length 279, hash C96F4684 + sample 2: + time = -45795 + flags = 1 + data = length 279, hash 65670B86 + sample 3: + time = -22576 + flags = 1 + data = length 280, hash 1AF29BCE + sample 4: + time = 643 + flags = 1 + data = length 279, hash C96F4684 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_latm.ts.2.dump b/testdata/src/test/assets/ts/sample_latm.ts.2.dump new file mode 100644 index 0000000000..a835568cd3 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_latm.ts.2.dump @@ -0,0 +1,65 @@ +seekMap: + isSeekable = true + duration = 0 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(0) = [[timeUs=0, position=0]] + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 3 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/mpeg2 + width = 640 + height = 426 + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33367 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 1396 + sample count = 5 + format 0: + id = 1/257 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.5 + channelCount = 1 + sampleRate = 44100 + language = und + initializationData: + data = length 4, hash 1FE978 + sample 0: + time = -92233 + flags = 1 + data = length 279, hash 79BF9F9B + sample 1: + time = -69014 + flags = 1 + data = length 279, hash C96F4684 + sample 2: + time = -45795 + flags = 1 + data = length 279, hash 65670B86 + sample 3: + time = -22576 + flags = 1 + data = length 280, hash 1AF29BCE + sample 4: + time = 643 + flags = 1 + data = length 279, hash C96F4684 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_latm.ts.3.dump b/testdata/src/test/assets/ts/sample_latm.ts.3.dump new file mode 100644 index 0000000000..a835568cd3 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_latm.ts.3.dump @@ -0,0 +1,65 @@ +seekMap: + isSeekable = true + duration = 0 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(0) = [[timeUs=0, position=0]] + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 3 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/mpeg2 + width = 640 + height = 426 + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33367 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 1396 + sample count = 5 + format 0: + id = 1/257 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.5 + channelCount = 1 + sampleRate = 44100 + language = und + initializationData: + data = length 4, hash 1FE978 + sample 0: + time = -92233 + flags = 1 + data = length 279, hash 79BF9F9B + sample 1: + time = -69014 + flags = 1 + data = length 279, hash C96F4684 + sample 2: + time = -45795 + flags = 1 + data = length 279, hash 65670B86 + sample 3: + time = -22576 + flags = 1 + data = length 280, hash 1AF29BCE + sample 4: + time = 643 + flags = 1 + data = length 279, hash C96F4684 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_latm.ts.unknown_length.dump b/testdata/src/test/assets/ts/sample_latm.ts.unknown_length.dump new file mode 100644 index 0000000000..cf7c502825 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_latm.ts.unknown_length.dump @@ -0,0 +1,62 @@ +seekMap: + isSeekable = false + duration = UNSET TIME + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 3 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + id = 1/256 + sampleMimeType = video/mpeg2 + width = 640 + height = 426 + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33367 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 1396 + sample count = 5 + format 0: + id = 1/257 + sampleMimeType = audio/mp4a-latm + codecs = mp4a.40.5 + channelCount = 1 + sampleRate = 44100 + language = und + initializationData: + data = length 4, hash 1FE978 + sample 0: + time = -92233 + flags = 1 + data = length 279, hash 79BF9F9B + sample 1: + time = -69014 + flags = 1 + data = length 279, hash C96F4684 + sample 2: + time = -45795 + flags = 1 + data = length 279, hash 65670B86 + sample 3: + time = -22576 + flags = 1 + data = length 280, hash 1AF29BCE + sample 4: + time = 643 + flags = 1 + data = length 279, hash C96F4684 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + id = 1/8448 + sampleMimeType = application/cea-608 +tracksEnded = true