Skip to content

Use part duration instead of fragment duration to set start point in lowlatency mode. #4453

@raxxarr

Description

@raxxarr

Is your feature request related to a problem? Please describe.

In Low-Latency mode, when there is no HOLD-BACK or PART-HOLD-BACK in playlist, hls.js will use liveSyncDurationCount * targetduration to set the start point of playback. Will it be better to use part tartget duration to compute this value, so that we can get a lower latency? And this seems to be the same way described in rfc PART-HOLD-BACK part.

Describe the solution you'd like

change:

  get targetLatency(): number | null {
    // ...
    const { holdBack, partHoldBack, targetduration } = levelDetails;
    // ....
    if (
      userConfig.liveSyncDuration ||
      userConfig.liveSyncDurationCount ||
      targetLatency === 0
    ) {
      targetLatency =
        liveSyncDuration !== undefined
          ? liveSyncDuration
          : liveSyncDurationCount * targetduration;
    }
    // ...
    );
  }

to:

  get targetLatency(): number | null {
    // ...
    const { holdBack, partHoldBack, partTarget, targetduration } = levelDetails;
    // ....
    if (
      userConfig.liveSyncDuration ||
      userConfig.liveSyncDurationCount ||
      targetLatency === 0
    ) {
      targetLatency =
        liveSyncDuration !== undefined
          ? liveSyncDuration
          : liveSyncDurationCount * (partTarget || targetduration);
    }
    // ...
    );
  }

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Status

    Nice to have

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions