Skip to content

Commit f5a6ed0

Browse files
committed
Experiment with adding a third SeekHead
This file was crafted by hand in a hex editor by modifying `sample.mkv`: 1. Adding two SeekHead elements at the end, each with a single Seek entry, with the first pointing at the Cues element and the second pointing at the Tags element. 2. Update the original SeekHead element so the Seek entries that previously pointed to the Cues and Tags element now point out the two new SeekHead elements we added. The resulting file is successfully parsed by `mkvinfo` and playable with VLC. The dump files were generated with all changes in MatroskaExtractor reverted (which is why they're unseekable). Bringing the MatroskaExtractor changes back and running the test results in a larger than expected diff in the dump file. Specifically all the samples are dropped.
1 parent 04c8b3d commit f5a6ed0

File tree

7 files changed

+1082
-0
lines changed

7 files changed

+1082
-0
lines changed

libraries/extractor/src/test/java/androidx/media3/extractor/mkv/MatroskaExtractorTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ public void mkvSample_withRecursiveSeekHead() throws Exception {
151151
simulationConfig);
152152
}
153153

154+
@Test
155+
public void mkvSample_threeSeekHeads() throws Exception {
156+
ExtractorAsserts.assertBehavior(
157+
getExtractorFactory(subtitlesParsedDuringExtraction),
158+
"media/mkv/sample_three_seekheads.mkv",
159+
getAssertionConfigWithPrefix(
160+
"media/mkv/sample_three_seekheads.mkv", subtitlesParsedDuringExtraction),
161+
simulationConfig);
162+
}
163+
154164
@Test
155165
public void mkvSample_withVorbisAudio() throws Exception {
156166
ExtractorAsserts.assertBehavior(
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
seekMap:
2+
isSeekable = false
3+
duration = 1072000
4+
getPosition(0) = [[timeUs=0, position=0]]
5+
numberOfTracks = 2
6+
track 1:
7+
total output bytes = 89502
8+
sample count = 30
9+
format 0:
10+
id = 1
11+
containerMimeType = video/x-matroska
12+
sampleMimeType = video/avc
13+
codecs = avc1.640034
14+
width = 1080
15+
height = 720
16+
selectionFlags = [default]
17+
language = und
18+
initializationData:
19+
data = length 30, hash F6F3D010
20+
data = length 10, hash 7A0D0F2B
21+
sample 0:
22+
time = 67000
23+
flags = 1
24+
data = length 36477, hash F0F36CFE
25+
sample 1:
26+
time = 134000
27+
flags = 0
28+
data = length 5341, hash 40B85E2
29+
sample 2:
30+
time = 100000
31+
flags = 0
32+
data = length 596, hash 357B4D92
33+
sample 3:
34+
time = 267000
35+
flags = 0
36+
data = length 7704, hash A39EDA06
37+
sample 4:
38+
time = 200000
39+
flags = 0
40+
data = length 989, hash 2813C72D
41+
sample 5:
42+
time = 167000
43+
flags = 0
44+
data = length 721, hash C50D1C73
45+
sample 6:
46+
time = 234000
47+
flags = 0
48+
data = length 519, hash 65FE1911
49+
sample 7:
50+
time = 400000
51+
flags = 0
52+
data = length 6160, hash E1CAC0EC
53+
sample 8:
54+
time = 334000
55+
flags = 0
56+
data = length 953, hash 7160C661
57+
sample 9:
58+
time = 300000
59+
flags = 0
60+
data = length 620, hash 7A7AE07C
61+
sample 10:
62+
time = 367000
63+
flags = 0
64+
data = length 405, hash 5CC7F4E7
65+
sample 11:
66+
time = 500000
67+
flags = 0
68+
data = length 4852, hash 9DB6979D
69+
sample 12:
70+
time = 467000
71+
flags = 0
72+
data = length 547, hash E31A6979
73+
sample 13:
74+
time = 434000
75+
flags = 0
76+
data = length 570, hash FEC40D00
77+
sample 14:
78+
time = 634000
79+
flags = 0
80+
data = length 5525, hash 7C478F7E
81+
sample 15:
82+
time = 567000
83+
flags = 0
84+
data = length 1082, hash DA07059A
85+
sample 16:
86+
time = 534000
87+
flags = 0
88+
data = length 807, hash 93478E6B
89+
sample 17:
90+
time = 600000
91+
flags = 0
92+
data = length 744, hash 9A8E6026
93+
sample 18:
94+
time = 767000
95+
flags = 0
96+
data = length 4732, hash C73B23C0
97+
sample 19:
98+
time = 700000
99+
flags = 0
100+
data = length 1004, hash 8A19A228
101+
sample 20:
102+
time = 667000
103+
flags = 0
104+
data = length 794, hash 8126022C
105+
sample 21:
106+
time = 734000
107+
flags = 0
108+
data = length 645, hash F08300E5
109+
sample 22:
110+
time = 900000
111+
flags = 0
112+
data = length 2684, hash 727FE378
113+
sample 23:
114+
time = 834000
115+
flags = 0
116+
data = length 787, hash 419A7821
117+
sample 24:
118+
time = 800000
119+
flags = 0
120+
data = length 649, hash 5C159346
121+
sample 25:
122+
time = 867000
123+
flags = 0
124+
data = length 509, hash F912D655
125+
sample 26:
126+
time = 1034000
127+
flags = 0
128+
data = length 1226, hash 29815C21
129+
sample 27:
130+
time = 967000
131+
flags = 0
132+
data = length 898, hash D997AD0A
133+
sample 28:
134+
time = 934000
135+
flags = 0
136+
data = length 476, hash A0423645
137+
sample 29:
138+
time = 1000000
139+
flags = 0
140+
data = length 486, hash DDF32CBB
141+
track 2:
142+
total output bytes = 12120
143+
sample count = 29
144+
format 0:
145+
id = 2
146+
containerMimeType = video/x-matroska
147+
sampleMimeType = audio/ac3
148+
channelCount = 1
149+
sampleRate = 44100
150+
selectionFlags = [default]
151+
language = und
152+
sample 0:
153+
time = 129000
154+
flags = 1
155+
data = length 416, hash 211F2286
156+
sample 1:
157+
time = 164000
158+
flags = 1
159+
data = length 418, hash 77425A86
160+
sample 2:
161+
time = 198829
162+
flags = 1
163+
data = length 418, hash A0FE5CA1
164+
sample 3:
165+
time = 233000
166+
flags = 1
167+
data = length 418, hash 2309B066
168+
sample 4:
169+
time = 268000
170+
flags = 1
171+
data = length 418, hash 928A653B
172+
sample 5:
173+
time = 303000
174+
flags = 1
175+
data = length 418, hash 3422F0CB
176+
sample 6:
177+
time = 337829
178+
flags = 1
179+
data = length 418, hash EFF43D5B
180+
sample 7:
181+
time = 373000
182+
flags = 1
183+
data = length 418, hash FC8093C7
184+
sample 8:
185+
time = 408000
186+
flags = 1
187+
data = length 418, hash CCC08A16
188+
sample 9:
189+
time = 443000
190+
flags = 1
191+
data = length 418, hash 2A6EE863
192+
sample 10:
193+
time = 477829
194+
flags = 1
195+
data = length 418, hash D69A9251
196+
sample 11:
197+
time = 512000
198+
flags = 1
199+
data = length 418, hash BCFB758D
200+
sample 12:
201+
time = 547000
202+
flags = 1
203+
data = length 418, hash 11B66799
204+
sample 13:
205+
time = 581829
206+
flags = 1
207+
data = length 418, hash C824D392
208+
sample 14:
209+
time = 617000
210+
flags = 1
211+
data = length 418, hash C167D872
212+
sample 15:
213+
time = 652000
214+
flags = 1
215+
data = length 418, hash 4221C855
216+
sample 16:
217+
time = 687000
218+
flags = 1
219+
data = length 418, hash 4D4FF934
220+
sample 17:
221+
time = 721829
222+
flags = 1
223+
data = length 418, hash 984AA025
224+
sample 18:
225+
time = 757000
226+
flags = 1
227+
data = length 418, hash BB788B46
228+
sample 19:
229+
time = 791000
230+
flags = 1
231+
data = length 418, hash 9EFBFD97
232+
sample 20:
233+
time = 826000
234+
flags = 1
235+
data = length 418, hash DF1A460C
236+
sample 21:
237+
time = 860829
238+
flags = 1
239+
data = length 418, hash 2BDB56A
240+
sample 22:
241+
time = 896000
242+
flags = 1
243+
data = length 418, hash CA230060
244+
sample 23:
245+
time = 931000
246+
flags = 1
247+
data = length 418, hash D2F19F41
248+
sample 24:
249+
time = 965000
250+
flags = 1
251+
data = length 418, hash AF392D79
252+
sample 25:
253+
time = 999829
254+
flags = 1
255+
data = length 418, hash C5D7F2A3
256+
sample 26:
257+
time = 1035000
258+
flags = 1
259+
data = length 418, hash 733A35AE
260+
sample 27:
261+
time = 1069829
262+
flags = 1
263+
data = length 418, hash DE46E5D3
264+
sample 28:
265+
time = 1104000
266+
flags = 1
267+
data = length 418, hash 56AB8D37
268+
tracksEnded = true

0 commit comments

Comments
 (0)