Default segment duration to target duration if unspecified
When parsing a media playlist, if a URI is encountered without a corresponding #EXTINF with valid duration, default its value to the last encountered #EXT-X-TARGETDURATION tag.
Showing
7 changed files
with
43 additions
and
0 deletions
... | @@ -422,6 +422,15 @@ | ... | @@ -422,6 +422,15 @@ |
422 | currentUri.uri = entry.uri; | 422 | currentUri.uri = entry.uri; |
423 | uris.push(currentUri); | 423 | uris.push(currentUri); |
424 | 424 | ||
425 | // if no explicit duration was declared, use the target duration | ||
426 | if (this.manifest.targetDuration && | ||
427 | !('duration' in currentUri)) { | ||
428 | this.trigger('warn', { | ||
429 | message: 'defaulting segment duration to the target duration' | ||
430 | }); | ||
431 | currentUri.duration = this.manifest.targetDuration; | ||
432 | } | ||
433 | |||
425 | // prepare for the next URI | 434 | // prepare for the next URI |
426 | currentUri = {}; | 435 | currentUri = {}; |
427 | }, | 436 | }, | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | "length": 587500, | 16 | "length": 587500, |
17 | "offset": 522828 | 17 | "offset": 522828 |
18 | }, | 18 | }, |
19 | "duration": 10, | ||
19 | "uri": "hls_450k_video.ts" | 20 | "uri": "hls_450k_video.ts" |
20 | }, | 21 | }, |
21 | { | 22 | { |
... | @@ -135,6 +136,7 @@ | ... | @@ -135,6 +136,7 @@ |
135 | "length": 44556, | 136 | "length": 44556, |
136 | "offset": 8353216 | 137 | "offset": 8353216 |
137 | }, | 138 | }, |
139 | "duration": 10, | ||
138 | "uri": "hls_450k_video.ts" | 140 | "uri": "hls_450k_video.ts" |
139 | } | 141 | } |
140 | ], | 142 | ], | ... | ... |
... | @@ -8,9 +8,11 @@ | ... | @@ -8,9 +8,11 @@ |
8 | "uri": "/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts" | 8 | "uri": "/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts" |
9 | }, | 9 | }, |
10 | { | 10 | { |
11 | "duration": 8, | ||
11 | "uri": "/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts" | 12 | "uri": "/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts" |
12 | }, | 13 | }, |
13 | { | 14 | { |
15 | "duration": 8, | ||
14 | "uri": "/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts" | 16 | "uri": "/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts" |
15 | } | 17 | } |
16 | ], | 18 | ], | ... | ... |
... | @@ -8,12 +8,15 @@ | ... | @@ -8,12 +8,15 @@ |
8 | "uri": "/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts" | 8 | "uri": "/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts" |
9 | }, | 9 | }, |
10 | { | 10 | { |
11 | "duration": 8, | ||
11 | "uri": "/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts" | 12 | "uri": "/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts" |
12 | }, | 13 | }, |
13 | { | 14 | { |
15 | "duration": 8, | ||
14 | "uri": "/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts" | 16 | "uri": "/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts" |
15 | }, | 17 | }, |
16 | { | 18 | { |
19 | "duration": 8, | ||
17 | "uri": "/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts" | 20 | "uri": "/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts" |
18 | } | 21 | } |
19 | ], | 22 | ], | ... | ... |
test/manifest/multipleTargetDurations.json
0 → 100644
-
Please register or sign in to post a comment