Skip to content

Commit

Permalink
feat(HLS): Fix update time when using LL-HLS and byterange optimizati…
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored and Rodolphe Breton committed Nov 30, 2023
1 parent f796c8d commit 4911539
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2706,8 +2706,17 @@ shaka.hls.HlsParser = class {
if (this.lowLatencyMode_ && this.partialTargetDuration_) {
// For low latency streaming, use the partial segment target duration.
if (this.lowLatencyByterangeOptimization_) {
this.lastTargetDuration_ = Math.min(
lastTargetDuration, this.lastTargetDuration_);
// We always have at least 1 partial segment part, and most servers
// allow you to make a request with _HLS_msn=X&_HLS_part=0 with a
// distance of 4 partial segments. With this we ensure that we
// obtain the minimum latency in this type of case.
if (this.partialTargetDuration_ * 5 <= lastTargetDuration) {
this.lastTargetDuration_ = Math.min(
this.partialTargetDuration_, this.lastTargetDuration_);
} else {
this.lastTargetDuration_ = Math.min(
lastTargetDuration, this.lastTargetDuration_);
}
} else {
this.lastTargetDuration_ = Math.min(
this.partialTargetDuration_, this.lastTargetDuration_);
Expand Down

0 comments on commit 4911539

Please sign in to comment.