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(HLS): Add new config for allow LL-HLS byterange optimization #5877

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ shakaDemo.Config = class {
'manifest.hls.ignoreManifestTimestampsInSegmentsMode')
.addBoolInput_('Disable codec guessing',
'manifest.hls.disableCodecGuessing')
.addBoolInput_('Allow LL-HLS byterange optimization',
'manifest.hls.allowLowLatencyByteRangeOptimization')
.addNumberInput_('Availability Window Override',
'manifest.availabilityWindowOverride',
/* canBeDecimal= */ true,
Expand Down
8 changes: 7 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,8 @@ shaka.extern.DashManifestConfiguration;
* liveSegmentsDelay: number,
* sequenceMode: boolean,
* ignoreManifestTimestampsInSegmentsMode: boolean,
* disableCodecGuessing: boolean
* disableCodecGuessing: boolean,
* allowLowLatencyByteRangeOptimization: boolean
* }}
*
* @property {boolean} ignoreTextStreamFailures
Expand Down Expand Up @@ -994,6 +995,11 @@ shaka.extern.DashManifestConfiguration;
* As a consequence, lazy-loading media playlists won't be possible for this
* use case, which may result in longer video startup times.
* <i>Defaults to <code>false</code>.</i>
* @property {boolean} allowLowLatencyByteRangeOptimization
* If set to true, the HLS parser will optimize operation with LL and partial
* byte range segments. More info in
* https://www.akamai.com/blog/performance/-using-ll-hls-with-byte-range-addressing-to-achieve-interoperabi
* <i>Defaults to <code>true</code>.</i>
* @exportDoc
*/
shaka.extern.HlsManifestConfiguration;
Expand Down
3 changes: 2 additions & 1 deletion lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2941,7 +2941,8 @@ shaka.hls.HlsParser = class {

if (this.lowLatencyMode_ && hlsSegment.partialSegments.length) {
const byterangeOptimizationSupport = (stream.mimeType == 'video/mp4' ||
stream.mimeType == 'audio/mp4') && window.ReadableStream;
stream.mimeType == 'audio/mp4') && window.ReadableStream &&
this.config_.hls.allowLowLatencyByteRangeOptimization;

let partialSyncTime = syncTime;
for (let i = 0; i < hlsSegment.partialSegments.length; i++) {
Expand Down
1 change: 1 addition & 0 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ shaka.util.PlayerConfiguration = class {
sequenceMode: shaka.util.Platform.supportsSequenceMode(),
ignoreManifestTimestampsInSegmentsMode: false,
disableCodecGuessing: false,
allowLowLatencyByteRangeOptimization: true,
},
mss: {
manifestPreprocessor: (element) => {
Expand Down
Loading