Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use serverControl and preloadSegment llhls features behind a flag #1078

Merged
merged 30 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
123aba7
feat: Add ll-hls ext-x-part support behind a flag
brandonocasey Jan 26, 2021
32de23e
code review
brandonocasey Mar 1, 2021
3f8ad12
change option from llhls -> experimentalLLHLS
brandonocasey Mar 2, 2021
9c9493a
update to camelcase
brandonocasey Mar 2, 2021
73278fa
cr
brandonocasey Mar 3, 2021
e7598c6
separate updateSegment function
brandonocasey Mar 3, 2021
d3236ca
m3u8-parser update
brandonocasey Mar 4, 2021
c2ebf7b
test fixes with m3u8-parser update
brandonocasey Mar 4, 2021
a8957ff
ie 11 fix
brandonocasey Mar 5, 2021
2ce6e59
feat(llhls): serverControl, preloadSegment, and partTargetDuration
brandonocasey Feb 10, 2021
0fa6dee
getHoldBack -> liveEdgeDelay
brandonocasey Mar 17, 2021
b4e219c
use part length
brandonocasey Mar 17, 2021
a58bcef
getAllSegments helper
brandonocasey Mar 17, 2021
83bf171
partSegments -> partsAndSegments
brandonocasey Mar 17, 2021
43720f0
msn -> mediaSequenceNumber
brandonocasey Mar 17, 2021
6ce8c1e
cr add comments
brandonocasey Mar 18, 2021
c3bef56
test text update
brandonocasey Mar 18, 2021
5d78a1f
better test
brandonocasey Mar 18, 2021
467832f
Merge remote-tracking branch 'origin/main' into feat/llhls-2
brandonocasey Mar 22, 2021
d35fa4d
code review
brandonocasey Mar 22, 2021
4374c0e
remove last three durations logic
brandonocasey Mar 25, 2021
e80c0fb
Merge branch 'main' into feat/llhls-2
brandonocasey Mar 29, 2021
b77c94c
Update src/playlist.js
brandonocasey Mar 30, 2021
dffa291
Merge remote-tracking branch 'origin/main' into feat/llhls-2
brandonocasey Mar 30, 2021
3aa8582
code review
brandonocasey Mar 30, 2021
1aa7785
null check
brandonocasey Mar 30, 2021
b381d96
Merge branch 'main' into feat/llhls-2
brandonocasey Mar 30, 2021
088ee6e
set to largest duration, add test
brandonocasey Apr 5, 2021
d7c30d2
Update test/manifest.test.js
brandonocasey Apr 5, 2021
01a6763
Merge remote-tracking branch 'origin/main' into feat/llhls-2
brandonocasey Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ export const parseManifest = ({
});
}
}
if (manifest.segments && manifest.segments.length && !manifest.targetDuration) {
const lastSegment = manifest.segments[manifest.segments.length - 1];
const lastDuration = lastSegment && Math.round(lastSegment) || 10;

if (onwarn) {
onwarn(`manifest has no targetDuration defaulting to ${lastDuration}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may be better off using the largest segment duration found (and 10 if no segments included), since the TARGETDURATION is supposed to be the highest duration that will be encountered in a stream (and we will run into issues if the target duration is shorter than some segment durations).

Would also be worth having a test for it.

}
manifest.targetDuration = lastDuration;
}

return manifest;
};
Expand Down
13 changes: 6 additions & 7 deletions src/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ export const liveEdgeDelay = (master, media) => {
return 0;
}

const lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
const hasParts = lastSegment && lastSegment.parts && lastSegment.parts.length;
// by default we use the last three durations of segments if
// part target duration or target duration isn't found.
// see: https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-4.4.3.8

// dash suggestedPresentationDelay trumps everything
if (master && master.suggestedPresentationDelay) {
return master.suggestedPresentationDelay;
}

const lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
const hasParts = lastSegment && lastSegment.parts && lastSegment.parts.length;

// look for "part" delays from ll-hls first
} else if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
return media.serverControl.partHoldBack;
} else if (hasParts && media.partTargetDuration) {
return media.partTargetDuration * 3;
Expand Down