Skip to content
Snippets Groups Projects
Commit a64ee224 authored by Kelvin's avatar Kelvin
Browse files

Max download parallelism setting

parent e9ff5e6f
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,7 @@ class SourcePluginConfig( ...@@ -50,6 +50,7 @@ class SourcePluginConfig(
var primaryClaimFieldType: Int? = null, var primaryClaimFieldType: Int? = null,
var developerSubmitUrl: String? = null, var developerSubmitUrl: String? = null,
var allowAllHttpHeaderAccess: Boolean = false, var allowAllHttpHeaderAccess: Boolean = false,
var maxDownloadParallelism: Int = 0
) : IV8PluginConfig { ) : IV8PluginConfig {
val absoluteIconUrl: String? get() = resolveAbsoluteUrl(iconUrl, sourceUrl); val absoluteIconUrl: String? get() = resolveAbsoluteUrl(iconUrl, sourceUrl);
......
...@@ -27,6 +27,8 @@ import com.futo.platformplayer.api.media.models.video.IPlatformVideo ...@@ -27,6 +27,8 @@ import com.futo.platformplayer.api.media.models.video.IPlatformVideo
import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
import com.futo.platformplayer.api.media.models.video.SerializedPlatformVideo import com.futo.platformplayer.api.media.models.video.SerializedPlatformVideo
import com.futo.platformplayer.api.media.models.video.SerializedPlatformVideoDetails import com.futo.platformplayer.api.media.models.video.SerializedPlatformVideoDetails
import com.futo.platformplayer.api.media.platforms.js.JSClient
import com.futo.platformplayer.api.media.platforms.js.SourcePluginConfig
import com.futo.platformplayer.api.media.platforms.js.models.JSRequestExecutor import com.futo.platformplayer.api.media.platforms.js.models.JSRequestExecutor
import com.futo.platformplayer.api.media.platforms.js.models.JSVideo import com.futo.platformplayer.api.media.platforms.js.models.JSVideo
import com.futo.platformplayer.api.media.platforms.js.models.sources.IJSDashManifestRawSource import com.futo.platformplayer.api.media.platforms.js.models.sources.IJSDashManifestRawSource
...@@ -42,6 +44,7 @@ import com.futo.platformplayer.parsers.HLS ...@@ -42,6 +44,7 @@ import com.futo.platformplayer.parsers.HLS
import com.futo.platformplayer.serializers.OffsetDateTimeNullableSerializer import com.futo.platformplayer.serializers.OffsetDateTimeNullableSerializer
import com.futo.platformplayer.states.StateDownloads import com.futo.platformplayer.states.StateDownloads
import com.futo.platformplayer.states.StatePlatform import com.futo.platformplayer.states.StatePlatform
import com.futo.platformplayer.states.StatePlugins
import com.futo.platformplayer.toHumanBitrate import com.futo.platformplayer.toHumanBitrate
import com.futo.platformplayer.toHumanBytesSpeed import com.futo.platformplayer.toHumanBytesSpeed
import hasAnySource import hasAnySource
...@@ -703,9 +706,12 @@ class VideoDownload { ...@@ -703,9 +706,12 @@ class VideoDownload {
try{ try{
val head = client.tryHead(videoUrl); val head = client.tryHead(videoUrl);
val relatedPlugin = (video?.url ?: videoDetails?.url)?.let { StatePlatform.instance.getContentClient(it) }?.let { if(it is JSClient) it else null };
if(Settings.instance.downloads.byteRangeDownload && head?.containsKey("accept-ranges") == true && head.containsKey("content-length")) if(Settings.instance.downloads.byteRangeDownload && head?.containsKey("accept-ranges") == true && head.containsKey("content-length"))
{ {
val concurrency = Settings.instance.downloads.getByteRangeThreadCount(); val maxParallel = if(relatedPlugin != null && relatedPlugin.config.maxDownloadParallelism > 0)
relatedPlugin.config.maxDownloadParallelism else 99;
val concurrency = Math.min(maxParallel, Settings.instance.downloads.getByteRangeThreadCount());
Logger.i(TAG, "Download $name ByteRange Parallel (${concurrency}): " + videoUrl); Logger.i(TAG, "Download $name ByteRange Parallel (${concurrency}): " + videoUrl);
sourceLength = head["content-length"]!!.toLong(); sourceLength = head["content-length"]!!.toLong();
onProgress(sourceLength, 0, 0); onProgress(sourceLength, 0, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment