Skip to content

Commit c3fcac9

Browse files
committed
Add basic h264 sample unit test to ensure correct sample flags, including key frames
1 parent dfc41cd commit c3fcac9

File tree

7 files changed

+505
-0
lines changed

7 files changed

+505
-0
lines changed

‎libraries/extractor/src/test/java/androidx/media3/extractor/ts/TsExtractorTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public void sampleWithH263() throws Exception {
6666
}
6767

6868
@Test
69+
public void sampleWithH264() throws Exception {
70+
ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_h264.ts", simulationConfig);
71+
}
72+
6973
public void sampleWithH264AndMpegAudio() throws Exception {
7074
ExtractorAsserts.assertBehavior(
7175
TsExtractor::new, "media/ts/sample_h264_mpeg_audio.ts", simulationConfig);
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
seekMap:
2+
isSeekable = true
3+
duration = 900000
4+
getPosition(0) = [[timeUs=0, position=0]]
5+
getPosition(1) = [[timeUs=1, position=0]]
6+
getPosition(450000) = [[timeUs=450000, position=23030]]
7+
getPosition(900000) = [[timeUs=900000, position=46248]]
8+
numberOfTracks = 1
9+
track 256:
10+
total output bytes = 41614
11+
sample count = 30
12+
format 0:
13+
id = 1/256
14+
sampleMimeType = video/avc
15+
codecs = avc1.64001F
16+
width = 854
17+
height = 480
18+
colorInfo:
19+
lumaBitdepth = 8
20+
chromaBitdepth = 8
21+
initializationData:
22+
data = length 29, hash A220FDE0
23+
data = length 9, hash D971CD89
24+
sample 0:
25+
time = 66666
26+
flags = 1
27+
data = length 856, hash E3FC14FA
28+
sample 1:
29+
time = 100000
30+
flags = 0
31+
data = length 3330, hash ACE433CC
32+
sample 2:
33+
time = 166666
34+
flags = 0
35+
data = length 6849, hash 2762E298
36+
sample 3:
37+
time = 133333
38+
flags = 0
39+
data = length 794, hash 16489833
40+
sample 4:
41+
time = 233333
42+
flags = 0
43+
data = length 1874, hash 24DF8A2D
44+
sample 5:
45+
time = 200000
46+
flags = 0
47+
data = length 1209, hash B137200F
48+
sample 6:
49+
time = 366666
50+
flags = 0
51+
data = length 476, hash 1D70B27E
52+
sample 7:
53+
time = 300000
54+
flags = 0
55+
data = length 325, hash D3FB2CC2
56+
sample 8:
57+
time = 266666
58+
flags = 0
59+
data = length 89, hash F66C5D60
60+
sample 9:
61+
time = 333333
62+
flags = 0
63+
data = length 177, hash 7E6DB5B7
64+
sample 10:
65+
time = 400000
66+
flags = 1
67+
data = length 11054, hash 1FC7442D
68+
sample 11:
69+
time = 533333
70+
flags = 0
71+
data = length 302, hash 5432E85C
72+
sample 12:
73+
time = 466666
74+
flags = 0
75+
data = length 302, hash 95A21C90
76+
sample 13:
77+
time = 433333
78+
flags = 0
79+
data = length 96, hash 8C98DBB8
80+
sample 14:
81+
time = 500000
82+
flags = 0
83+
data = length 198, hash 114E22D9
84+
sample 15:
85+
time = 666666
86+
flags = 0
87+
data = length 303, hash C2C45716
88+
sample 16:
89+
time = 600000
90+
flags = 0
91+
data = length 168, hash 1B048DCA
92+
sample 17:
93+
time = 566666
94+
flags = 0
95+
data = length 98, hash 3AA3B8B4
96+
sample 18:
97+
time = 633333
98+
flags = 0
99+
data = length 108, hash 4F67E6F8
100+
sample 19:
101+
time = 700000
102+
flags = 0
103+
data = length 110, hash 625A9B91
104+
sample 20:
105+
time = 733333
106+
flags = 1
107+
data = length 11235, hash 8EDDEB9
108+
sample 21:
109+
time = 866666
110+
flags = 0
111+
data = length 358, hash 797276E4
112+
sample 22:
113+
time = 800000
114+
flags = 0
115+
data = length 336, hash B92DBED9
116+
sample 23:
117+
time = 766666
118+
flags = 0
119+
data = length 105, hash 223F3D12
120+
sample 24:
121+
time = 833333
122+
flags = 0
123+
data = length 106, hash DF8D1552
124+
sample 25:
125+
time = 1000000
126+
flags = 0
127+
data = length 235, hash 6127527D
128+
sample 26:
129+
time = 933333
130+
flags = 0
131+
data = length 109, hash E8E69F9F
132+
sample 27:
133+
time = 900000
134+
flags = 0
135+
data = length 84, hash 54E55CB4
136+
sample 28:
137+
time = 966666
138+
flags = 0
139+
data = length 93, hash B6B6263C
140+
sample 29:
141+
time = 1033333
142+
flags = 0
143+
data = length 234, hash A48D3D90
144+
tracksEnded = true
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
seekMap:
2+
isSeekable = true
3+
duration = 900000
4+
getPosition(0) = [[timeUs=0, position=0]]
5+
getPosition(1) = [[timeUs=1, position=0]]
6+
getPosition(450000) = [[timeUs=450000, position=23030]]
7+
getPosition(900000) = [[timeUs=900000, position=46248]]
8+
numberOfTracks = 1
9+
track 256:
10+
total output bytes = 25812
11+
sample count = 21
12+
format 0:
13+
id = 1/256
14+
sampleMimeType = video/avc
15+
codecs = avc1.64001F
16+
width = 854
17+
height = 480
18+
colorInfo:
19+
lumaBitdepth = 8
20+
chromaBitdepth = 8
21+
initializationData:
22+
data = length 29, hash A220FDE0
23+
data = length 9, hash D971CD89
24+
sample 0:
25+
time = 333333
26+
flags = 0
27+
data = length 177, hash 7E6DB5B7
28+
sample 1:
29+
time = 400000
30+
flags = 1
31+
data = length 11054, hash 1FC7442D
32+
sample 2:
33+
time = 533333
34+
flags = 0
35+
data = length 302, hash 5432E85C
36+
sample 3:
37+
time = 466666
38+
flags = 0
39+
data = length 302, hash 95A21C90
40+
sample 4:
41+
time = 433333
42+
flags = 0
43+
data = length 96, hash 8C98DBB8
44+
sample 5:
45+
time = 500000
46+
flags = 0
47+
data = length 198, hash 114E22D9
48+
sample 6:
49+
time = 666666
50+
flags = 0
51+
data = length 303, hash C2C45716
52+
sample 7:
53+
time = 600000
54+
flags = 0
55+
data = length 168, hash 1B048DCA
56+
sample 8:
57+
time = 566666
58+
flags = 0
59+
data = length 98, hash 3AA3B8B4
60+
sample 9:
61+
time = 633333
62+
flags = 0
63+
data = length 108, hash 4F67E6F8
64+
sample 10:
65+
time = 700000
66+
flags = 0
67+
data = length 110, hash 625A9B91
68+
sample 11:
69+
time = 733333
70+
flags = 1
71+
data = length 11235, hash 8EDDEB9
72+
sample 12:
73+
time = 866666
74+
flags = 0
75+
data = length 358, hash 797276E4
76+
sample 13:
77+
time = 800000
78+
flags = 0
79+
data = length 336, hash B92DBED9
80+
sample 14:
81+
time = 766666
82+
flags = 0
83+
data = length 105, hash 223F3D12
84+
sample 15:
85+
time = 833333
86+
flags = 0
87+
data = length 106, hash DF8D1552
88+
sample 16:
89+
time = 1000000
90+
flags = 0
91+
data = length 235, hash 6127527D
92+
sample 17:
93+
time = 933333
94+
flags = 0
95+
data = length 109, hash E8E69F9F
96+
sample 18:
97+
time = 900000
98+
flags = 0
99+
data = length 84, hash 54E55CB4
100+
sample 19:
101+
time = 966666
102+
flags = 0
103+
data = length 93, hash B6B6263C
104+
sample 20:
105+
time = 1033333
106+
flags = 0
107+
data = length 234, hash A48D3D90
108+
tracksEnded = true
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
seekMap:
2+
isSeekable = true
3+
duration = 900000
4+
getPosition(0) = [[timeUs=0, position=0]]
5+
getPosition(1) = [[timeUs=1, position=0]]
6+
getPosition(450000) = [[timeUs=450000, position=23030]]
7+
getPosition(900000) = [[timeUs=900000, position=46248]]
8+
numberOfTracks = 1
9+
track 256:
10+
total output bytes = 13114
11+
sample count = 12
12+
format 0:
13+
id = 1/256
14+
sampleMimeType = video/avc
15+
codecs = avc1.64001F
16+
width = 854
17+
height = 480
18+
colorInfo:
19+
lumaBitdepth = 8
20+
chromaBitdepth = 8
21+
initializationData:
22+
data = length 29, hash A220FDE0
23+
data = length 9, hash D971CD89
24+
sample 0:
25+
time = 633333
26+
flags = 0
27+
data = length 108, hash 4F67E6F8
28+
sample 1:
29+
time = 700000
30+
flags = 0
31+
data = length 110, hash 625A9B91
32+
sample 2:
33+
time = 733333
34+
flags = 1
35+
data = length 11235, hash 8EDDEB9
36+
sample 3:
37+
time = 866666
38+
flags = 0
39+
data = length 358, hash 797276E4
40+
sample 4:
41+
time = 800000
42+
flags = 0
43+
data = length 336, hash B92DBED9
44+
sample 5:
45+
time = 766666
46+
flags = 0
47+
data = length 105, hash 223F3D12
48+
sample 6:
49+
time = 833333
50+
flags = 0
51+
data = length 106, hash DF8D1552
52+
sample 7:
53+
time = 1000000
54+
flags = 0
55+
data = length 235, hash 6127527D
56+
sample 8:
57+
time = 933333
58+
flags = 0
59+
data = length 109, hash E8E69F9F
60+
sample 9:
61+
time = 900000
62+
flags = 0
63+
data = length 84, hash 54E55CB4
64+
sample 10:
65+
time = 966666
66+
flags = 0
67+
data = length 93, hash B6B6263C
68+
sample 11:
69+
time = 1033333
70+
flags = 0
71+
data = length 234, hash A48D3D90
72+
tracksEnded = true
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
seekMap:
2+
isSeekable = true
3+
duration = 900000
4+
getPosition(0) = [[timeUs=0, position=0]]
5+
getPosition(1) = [[timeUs=1, position=0]]
6+
getPosition(450000) = [[timeUs=450000, position=23030]]
7+
getPosition(900000) = [[timeUs=900000, position=46248]]
8+
numberOfTracks = 1
9+
track 256:
10+
total output bytes = 412
11+
sample count = 3
12+
format 0:
13+
id = 1/256
14+
sampleMimeType = video/avc
15+
codecs = avc1.64001F
16+
width = 854
17+
height = 480
18+
colorInfo:
19+
lumaBitdepth = 8
20+
chromaBitdepth = 8
21+
initializationData:
22+
data = length 29, hash A220FDE0
23+
data = length 9, hash D971CD89
24+
sample 0:
25+
time = 900000
26+
flags = 0
27+
data = length 84, hash 54E55CB4
28+
sample 1:
29+
time = 966666
30+
flags = 0
31+
data = length 93, hash B6B6263C
32+
sample 2:
33+
time = 1033333
34+
flags = 0
35+
data = length 234, hash A48D3D90
36+
tracksEnded = true

0 commit comments

Comments
 (0)