hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

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

Open raxxarr opened this issue 3 years ago • 0 comments

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

raxxarr avatar Dec 03 '21 18:12 raxxarr