Skip to content

Commit c789bd8

Browse files
authored
Merge pull request #2864 from video-dev/feature/remove-lhls-support
Remove LHLS support
2 parents 9478cc9 + cc5fdfd commit c789bd8

File tree

7 files changed

+4
-163
lines changed

7 files changed

+4
-163
lines changed

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export const hlsDefaultConfig: HlsConfig = {
248248
drmSystemOptions: {}, // used by eme-controller
249249
requestMediaKeySystemAccessFunc: requestMediaKeySystemAccess, // used by eme-controller
250250
testBandwidth: true,
251-
progressive: true,
251+
progressive: false,
252252

253253
// Dynamic Modules
254254
...timelineConfig(),

src/controller/audio-stream-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class AudioStreamController extends BaseStreamController implements ComponentAPI
214214
}
215215

216216
// if video not attached AND
217-
// start fragment already requested OR start frag prefetch disable
217+
// start fragment already requested OR start frag prefetch not enabled
218218
// exit loop
219219
// => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop
220220
if (!media && (this.startFragRequested || !config.startFragPrefetch)) {

src/controller/level-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export function computeReloadInterval (newDetails: LevelDetails, stats: LoaderSt
263263

264264
export function getProgramDateTimeAtEndOfLastEncodedFragment (levelDetails: LevelDetails): number | null {
265265
if (levelDetails.hasProgramDateTime) {
266-
const encodedFragments = levelDetails.fragments.filter((fragment) => !fragment.prefetch);
266+
const encodedFragments = levelDetails.fragments;
267267
const lastEncodedFrag = encodedFragments[encodedFragments.length - 1];
268268
const programDateTime = lastEncodedFrag.programDateTime as number;
269269
if (Number.isFinite(programDateTime)) {

src/controller/stream-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export default class StreamController extends BaseStreamController implements Ne
191191
const { config, nextLoadLevel: level } = hls;
192192

193193
// if start level not parsed yet OR
194-
// if video not attached AND start fragment already requested OR start frag prefetch disable
194+
// if video not attached AND start fragment already requested OR start frag prefetch not enabled
195195
// exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment
196196
if (levelLastLoaded === null || (!media && (this.startFragRequested || !config.startFragPrefetch))) {
197197
return;

src/loader/fragment.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ export default class Fragment {
7474
public start: number = 0;
7575
// Set when the fragment was loaded and transmuxed, but was stopped from buffering due to dropped frames.
7676
public backtracked: boolean = false;
77-
// LHLS prefetch flag
78-
public prefetch?: boolean;
7977
// Set by `updateFragPTSDTS` in level-helper
8078
public deltaPTS?: number;
8179
public maxStartPTS?: number;

src/loader/m3u8-parser.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ const LEVEL_PLAYLIST_REGEX_SLOW = new RegExp([
3838
/#EXT-X-(ENDLIST)/.source,
3939
/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,
4040
/#EXT-X-(DIS)CONTINUITY/.source,
41-
/#EXT-X-(PREFETCH-DIS)CONTINUITY/.source, // TODO: deprecate LHLS
42-
/#EXT-X-(PREFETCH):(.+)/.source, // TODO: deprecate LHLS
4341
/#EXT-X-(VERSION):(\d+)/.source,
4442
/#EXT-X-(MAP):(.+)/.source,
4543
/(#)([^:]*):(.*)/.source,
@@ -197,7 +195,6 @@ export default class M3U8Parser {
197195
while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {
198196
const duration = result[1];
199197
if (duration) { // INF
200-
frag.prefetch = false;
201198
frag.duration = parseFloat(duration);
202199
// avoid sliced strings https://github.com/video-dev/hls.js/issues/939
203200
const title = (' ' + result[2]).slice(1);
@@ -284,31 +281,6 @@ export default class M3U8Parser {
284281
case 'DISCONTINUITY-SEQ':
285282
discontinuityCounter = parseInt(value1);
286283
break;
287-
case 'PREFETCH':
288-
frag.prefetch = true;
289-
frag.duration = level.targetduration;
290-
frag.title = null;
291-
frag.type = type;
292-
frag.start = totalduration;
293-
frag.levelkey = levelkey;
294-
frag.sn = currentSN++;
295-
frag.level = id;
296-
frag.cc = discontinuityCounter;
297-
frag.urlId = levelUrlId;
298-
frag.baseurl = baseurl;
299-
frag.relurl = value1;
300-
assignProgramDateTime(frag, prevFrag);
301-
302-
level.fragments.push(frag);
303-
prevFrag = frag;
304-
totalduration += frag.duration;
305-
306-
frag = new Fragment();
307-
break;
308-
case 'PREFETCH-DIS':
309-
discontinuityCounter++;
310-
frag.tagList.push(['PREFETCH-DIS']);
311-
break;
312284
case 'KEY': {
313285
// https://tools.ietf.org/html/rfc8216#section-4.3.2.4
314286
const decryptparams = value1;

tests/unit/loader/playlist-loader.js

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import M3U8Parser from '../../../src/loader/m3u8-parser';
2-
import { mergeDetails } from '../../../src/controller/level-helper';
32
import AttrList from '../../../src/utils/attr-list';
43

54
describe('PlaylistLoader', function () {
@@ -966,132 +965,4 @@ http://dummy.url.com/hls/live/segment/segment_022916_164500865_719928.ts
966965
expect(result.fragments[0].url).to.equal('http://dummy.url.com/180724_Allison VLOG v3_00001.ts');
967966
expect(result.fragments[1].url).to.equal('http://dummy.url.com/180724_Allison VLOG v3_00002.ts');
968967
});
969-
970-
describe('LHLS Parsing', function () {
971-
const level = `#EXTM3U
972-
#EXT-X-VERSION:3
973-
#EXT-X-TARGETDURATION:2
974-
#EXT-X-MEDIA-SEQUENCE: 0
975-
#EXT-X-DISCONTINUITY-SEQUENCE: 0
976-
#EXT-X-PROGRAM-DATE-TIME:2018-09-05T20:59:06.531Z
977-
#EXTINF:2.000
978-
https://foo.com/bar/0.ts
979-
#EXT-X-PROGRAM-DATE-TIME:2018-09-05T20:59:08.531Z
980-
#EXTINF:2.000
981-
https://foo.com/bar/1.ts
982-
983-
#EXT-X-PREFETCH:https://foo.com/bar/2.ts
984-
`;
985-
const levelRefreshed = `#EXTM3U
986-
#EXT-X-VERSION:3
987-
#EXT-X-TARGETDURATION:2
988-
#EXT-X-MEDIA-SEQUENCE: 1
989-
#EXT-X-DISCONTINUITY-SEQUENCE: 0
990-
#EXT-X-PROGRAM-DATE-TIME:2018-09-05T20:59:08.531Z
991-
#EXTINF:2.000
992-
https://foo.com/bar/1.ts
993-
#EXT-X-PROGRAM-DATE-TIME:2018-09-05T20:59:10.531Z
994-
#EXTINF:2.000
995-
https://foo.com/bar/2.ts
996-
997-
#EXT-X-PREFETCH:https://foo.com/bar/3.ts
998-
`;
999-
const levelWithDiscontinuity = `#EXTM3U
1000-
#EXT-X-VERSION:3
1001-
#EXT-X-TARGETDURATION:2
1002-
#EXT-X-MEDIA-SEQUENCE: 100
1003-
#EXT-X-DISCONTINUITY-SEQUENCE: 5
1004-
#EXT-X-PROGRAM-DATE-TIME:2018-09-05T20:59:06.531Z
1005-
#EXTINF:2.000
1006-
https://foo.com/bar/0.ts
1007-
#EXT-X-PROGRAM-DATE-TIME:2018-09-05T20:59:08.531Z
1008-
#EXTINF:2.000
1009-
https://foo.com/bar/1.ts
1010-
1011-
#EXT-X-PREFETCH-DISCONTINUITY
1012-
#EXT-X-PREFETCH:https://foo.com/bar/5.ts
1013-
`;
1014-
1015-
it('Adds prefetch segments to the appropriate Level object', function () {
1016-
const result = M3U8Parser.parseLevelPlaylist(level, 'http://dummy.url.com/playlist.m3u8', 2, 'main', 0);
1017-
expect(result.fragments).to.have.lengthOf(3);
1018-
expect(result.fragments[2].baseurl).to.equal('http://dummy.url.com/playlist.m3u8');
1019-
expect(result.fragments[2].level).to.equal(2);
1020-
expect(result.fragments[2].type).to.equal('main');
1021-
expect(result.fragments[2].urlId).to.equal(0);
1022-
expect(result.fragments[2].relurl).to.equal('https://foo.com/bar/2.ts');
1023-
});
1024-
it('Adds `prefetch: true` to prefetch segments', function () {
1025-
const result = M3U8Parser.parseLevelPlaylist(level, 'http://dummy.url.com/playlist.m3u8', 0);
1026-
expect(result.fragments[2]).to.have.property('prefetch').which.equals(true);
1027-
});
1028-
it('Adds `prefetch: false` to complete segments', function () {
1029-
const result = M3U8Parser.parseLevelPlaylist(level, 'http://dummy.url.com/playlist.m3u8', 0);
1030-
expect(result.fragments[0]).to.have.property('prefetch').which.equals(false);
1031-
expect(result.fragments[1]).to.have.property('prefetch').which.equals(false);
1032-
});
1033-
it('Updates `prefetch` to `false` when prefetch segments transform to complete segments', function () {
1034-
const result1 = M3U8Parser.parseLevelPlaylist(level, 'http://dummy.url.com/playlist.m3u8', 0);
1035-
const result2 = M3U8Parser.parseLevelPlaylist(levelRefreshed, 'http://dummy.url.com/playlist.m3u8', 0);
1036-
1037-
expect(result1.fragments).to.have.lengthOf(3);
1038-
expect(result1.endSN).to.equal(2);
1039-
expect(result1.fragments[0].start).to.equal(0);
1040-
expect(result1.fragments[0].sn).to.equal(0);
1041-
expect(result1.fragments[1].sn).to.equal(1);
1042-
expect(result1.fragments[2].sn).to.equal(2);
1043-
expect(result1.fragments[0].prefetch).to.equal(false);
1044-
expect(result1.fragments[1].prefetch).to.equal(false);
1045-
expect(result1.fragments[2].prefetch).to.equal(true);
1046-
expect(result1.fragments[1].relurl).to.equal('https://foo.com/bar/1.ts');
1047-
expect(result1.fragments[2].relurl).to.equal('https://foo.com/bar/2.ts');
1048-
1049-
expect(result2.fragments).to.have.lengthOf(3);
1050-
expect(result2.endSN).to.equal(3);
1051-
expect(result2.fragments[0].start).to.equal(0);
1052-
expect(result2.fragments[0].sn).to.equal(1);
1053-
expect(result2.fragments[1].sn).to.equal(2);
1054-
expect(result2.fragments[2].sn).to.equal(3);
1055-
expect(result2.fragments[0].prefetch).to.equal(false);
1056-
expect(result2.fragments[1].prefetch).to.equal(false);
1057-
expect(result2.fragments[2].prefetch).to.equal(true);
1058-
expect(result2.fragments[1].relurl).to.equal('https://foo.com/bar/2.ts');
1059-
expect(result2.fragments[2].relurl).to.equal('https://foo.com/bar/3.ts');
1060-
1061-
// Clone the new results that mergeDetails will change
1062-
const newDetails = JSON.parse(JSON.stringify(result2));
1063-
mergeDetails(result1, newDetails);
1064-
1065-
expect(newDetails.fragments[0].start).to.equal(2);
1066-
});
1067-
1068-
it('Calculates the correct start time, duration and program date time for prefetch segments', function () {
1069-
const result = M3U8Parser.parseLevelPlaylist(level, 'http://dummy.url.com/playlist.m3u8', 0);
1070-
const previousPDT = 1536181148531;
1071-
expect(result.fragments[2].duration).to.equal(2);
1072-
expect(result.fragments[2].start).to.equal(4);
1073-
expect(result.fragments[1].programDateTime).to.equal(previousPDT);
1074-
expect(result.fragments[2].programDateTime).to.equal(previousPDT + 2000);
1075-
});
1076-
1077-
it('Adds "PREFETCH-DIS" to `frag.tagList` and updates discontinuity sequence (cc) tags', function () {
1078-
const result = M3U8Parser.parseLevelPlaylist(levelWithDiscontinuity, 'http://dummy.url.com/playlist.m3u8', 0);
1079-
expect(result.fragments[0].cc).to.equal(5);
1080-
expect(result.fragments[2].cc).to.equal(6);
1081-
expect(result.fragments[2].tagList).to.have.lengthOf(1);
1082-
expect(result.fragments[2].tagList[0][0]).to.equal('PREFETCH-DIS');
1083-
});
1084-
1085-
it('Calculates the correct SN, start time and duration for prefetch segments with discontinuity', function () {
1086-
const result = M3U8Parser.parseLevelPlaylist(levelWithDiscontinuity, 'http://dummy.url.com/playlist.m3u8', 0);
1087-
const previousPDT = 1536181148531;
1088-
expect(result.fragments[0].sn).to.equal(100);
1089-
expect(result.fragments[1].sn).to.equal(101);
1090-
expect(result.fragments[2].sn).to.equal(102);
1091-
expect(result.fragments[2].duration).to.equal(2);
1092-
expect(result.fragments[2].start).to.equal(4);
1093-
expect(result.fragments[1].programDateTime).to.equal(previousPDT);
1094-
expect(result.fragments[2].programDateTime).to.equal(previousPDT + 2000);
1095-
});
1096-
});
1097968
});

0 commit comments

Comments
 (0)