Skip to content

Download init segments in parallel#7867

Merged
robwalch merged 16 commits into
video-dev:masterfrom
krseager:feature/enable-parallel-segment-downloads
May 26, 2026
Merged

Download init segments in parallel#7867
robwalch merged 16 commits into
video-dev:masterfrom
krseager:feature/enable-parallel-segment-downloads

Conversation

@krseager
Copy link
Copy Markdown
Collaborator

@krseager krseager commented May 22, 2026

This PR will enable parallel downloads for init & media segments, which will decrease the time it takes to start video.

Why is this Pull Request needed?

Currently init & media segments are downloaded sequentially. Given latency is incurred by network as well as at CDN, oftentimes it is best to fetch these in parallel, which can reduce the time it takes to prepare video.

Are there any points in the code the reviewer needs to double check?

Resolves issues:

#7675

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

Copy link
Copy Markdown
Collaborator

@robwalch robwalch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Progress gate is difficult for me to understand at this hour without stepping through it in the debugger. I'll have another look in the morning ☕.

Comment thread src/controller/base-stream-controller.ts Outdated
@krseager
Copy link
Copy Markdown
Collaborator Author

krseager commented May 22, 2026

Amazing! Progress gate is difficult for me to understand at this hour without stepping through it in the debugger. I'll have another look in the morning ☕.

The idea is to ensure that if we're loading media with progressive: true, then we need to make sure that progress callbacks don't start streaming the data to the transmuxer before the init segment loading has completed. Once done, any progress events that were deferred by the gate, can then be flushed and provided to the transmuxer.

I just added a comment int the code to help with code clarity with the function gateProgress.

@robwalch robwalch linked an issue May 22, 2026 that may be closed by this pull request
5 tasks
Comment thread src/controller/base-stream-controller.ts Outdated
Comment thread src/controller/base-stream-controller.ts Outdated
Comment thread src/controller/base-stream-controller.ts Outdated
Comment thread src/controller/base-stream-controller.ts Outdated
Comment thread src/controller/base-stream-controller.ts
@robwalch robwalch changed the title Feature/enable parallel segment downloads Download init segments in parallel May 26, 2026
@robwalch robwalch merged commit f69a9f1 into video-dev:master May 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

First media segments in fMP4 loaded sequentially

2 participants