下载可调整线程数

This commit is contained in:
mtvpls
2026-02-26 10:24:51 +08:00
parent 9906bb7ea9
commit 0745e25ed7
2 changed files with 111 additions and 5 deletions
+7 -2
View File
@@ -347,8 +347,13 @@ export class M3U8Downloader {
}
};
// 并发下载 6 个片段
const concurrency = Math.min(6, task.rangeDownload.targetSegment - task.finishNum);
// 从localStorage读取单任务线程数设置,默认6个
const threadsPerTask = typeof window !== 'undefined'
? Number(localStorage.getItem('downloadThreadsPerTask') || 6)
: 6;
// 并发下载片段
const concurrency = Math.min(threadsPerTask, task.rangeDownload.targetSegment - task.finishNum);
for (let i = 0; i < concurrency; i++) {
download();
}