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

Open
#4,453 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
frontend, web-dev

Research direction

Start by locating the targetLatency getter and the levelDetails fields shown in the issue, then trace how low-latency playlists calculate their playback start point. Confirm the RFC behavior and check the relevant low-latency tests; the work is done when the fallback calculation uses partTarget when available and retains targetduration otherwise.

Written by the indexing model from the issue text.

Description

Feature proposal Low-Latency
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

Dominant language
TypeScript
Stars
16.9k
Forks
2.8k
Avg merge
1d 12h
Merged PRs (30d)
27

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from video-dev/hls.js

All issues in video-dev/hls.js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.