shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.14k stars 1.34k forks source link

Offline storage : .dash segments not downloaded in parallel despite `numberOfParallelDownloads` set to 5 (default value) #5755

Closed loicraux closed 1 year ago

loicraux commented 1 year ago

Have you read the FAQ and checked for duplicate open issues? Yes

If the problem is related to FairPlay, have you read the tutorial? N / A

What version of Shaka Player are you using? Latest version

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Yes

Are you using the demo app or your own custom app? Own custom app

If custom app, can you reproduce the issue using our demo app? Correct me if I'm wrong, but I think I cannot download assets using the Shaka Player demo app (which kind of makes sense)

What browser and OS are you using? Chrome 117.0.5938.132 (Official Build) (64-bit)

For embedded devices (smart TVs, etc.), what model and firmware version are you using? N/A

What are the manifest and license server URIs?

What configuration are you using? What is the output of player.getConfiguration()? Player configuration right before the call to storage.store :

{
  "drm": {
    "retryParameters": {
      "maxAttempts": 2,
      "baseDelay": 1000,
      "backoffFactor": 2,
      "fuzzFactor": 0.5,
      "timeout": 30000,
      "stallTimeout": 5000,
      "connectionTimeout": 10000
    },
    "servers": {
      "com.widevine.alpha": "https://widevine-dash.ezdrm.com/proxy?username=eduthequepreprod_openbar&contentId=HDS_128679_0-VO&pX=BA5EDC"
    },
    "clearKeys": {},
    "advanced": {},
    "delayLicenseRequestUntilPlayed": false,
    "persistentSessionOnlinePlayback": false,
    "persistentSessionsMetadata": [],
    "logLicenseExchange": true,
    "updateExpirationTime": 1,
    "preferredKeySystems": [
      "com.widevine.alpha"
    ],
    "keySystemsMapping": {},
    "parseInbandPsshEnabled": false,
    "minHdcpVersion": ""
  },
  "manifest": {
    "retryParameters": {
      "maxAttempts": 2,
      "baseDelay": 1000,
      "backoffFactor": 2,
      "fuzzFactor": 0.5,
      "timeout": 30000,
      "stallTimeout": 5000,
      "connectionTimeout": 10000
    },
    "availabilityWindowOverride": null,
    "disableAudio": false,
    "disableVideo": false,
    "disableText": false,
    "disableThumbnails": false,
    "defaultPresentationDelay": 0,
    "segmentRelativeVttTiming": false,
    "raiseFatalErrorOnManifestUpdateRequestFailure": false,
    "dash": {
      "clockSyncUri": "",
      "ignoreDrmInfo": false,
      "disableXlinkProcessing": false,
      "xlinkFailGracefully": false,
      "ignoreMinBufferTime": false,
      "autoCorrectDrift": true,
      "initialSegmentLimit": 1000,
      "ignoreSuggestedPresentationDelay": false,
      "ignoreEmptyAdaptationSet": false,
      "ignoreMaxSegmentDuration": false,
      "keySystemsByURI": {
        "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
        "urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e": "org.w3.clearkey",
        "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
        "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
        "urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95": "com.microsoft.playready",
        "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
      },
      "sequenceMode": false
    },
    "hls": {
      "ignoreTextStreamFailures": false,
      "ignoreImageStreamFailures": false,
      "defaultAudioCodec": "mp4a.40.2",
      "defaultVideoCodec": "avc1.42E01E",
      "ignoreManifestProgramDateTime": false,
      "mediaPlaylistFullMimeType": "video/mp2t; codecs=\"avc1.42E01E, mp4a.40.2\"",
      "useSafariBehaviorForLive": true,
      "liveSegmentsDelay": 3,
      "sequenceMode": true,
      "ignoreManifestTimestampsInSegmentsMode": false
    },
    "mss": {
      "sequenceMode": false,
      "keySystemsBySystemId": {
        "9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
        "79f0049a-4098-8642-ab92-e65be0885f95": "com.microsoft.playready"
      }
    }
  },
  "streaming": {
    "retryParameters": {
      "maxAttempts": 2,
      "baseDelay": 1000,
      "backoffFactor": 2,
      "fuzzFactor": 0.5,
      "timeout": 30000,
      "stallTimeout": 5000,
      "connectionTimeout": 10000
    },
    "rebufferingGoal": 2,
    "bufferingGoal": 10,
    "bufferBehind": 30,
    "ignoreTextStreamFailures": false,
    "alwaysStreamText": false,
    "startAtSegmentBoundary": false,
    "gapDetectionThreshold": 0.5,
    "gapJumpTimerTime": 0.25,
    "durationBackoff": 1,
    "safeSeekOffset": 5,
    "stallEnabled": true,
    "stallThreshold": 1,
    "stallSkip": 0.1,
    "useNativeHlsOnSafari": true,
    "inaccurateManifestTolerance": 2,
    "lowLatencyMode": false,
    "autoLowLatencyMode": false,
    "forceHTTPS": false,
    "preferNativeHls": false,
    "updateIntervalSeconds": 1,
    "dispatchAllEmsgBoxes": false,
    "observeQualityChanges": false,
    "maxDisabledTime": 30,
    "parsePrftBox": false,
    "segmentPrefetchLimit": 0,
    "liveSync": false,
    "liveSyncMaxLatency": 1,
    "liveSyncPlaybackRate": 1.1
  },
  "mediaSource": {
    "sourceBufferExtraFeatures": "",
    "forceTransmux": false,
    "insertFakeEncryptionInInit": true
  },
  "offline": {
    "usePersistentLicense": false,
    "numberOfParallelDownloads": 5
  },
  "abr": {
    "enabled": true,
    "useNetworkInformation": true,
    "defaultBandwidthEstimate": 1000000,
    "switchInterval": 8,
    "bandwidthUpgradeTarget": 0.85,
    "bandwidthDowngradeTarget": 0.95,
    "restrictions": {
      "minWidth": 0,
      "maxWidth": null,
      "minHeight": 0,
      "maxHeight": null,
      "minPixels": 0,
      "maxPixels": null,
      "minFrameRate": 0,
      "maxFrameRate": null,
      "minBandwidth": 0,
      "maxBandwidth": null
    },
    "advanced": {
      "minTotalBytes": 128000,
      "minBytes": 16000,
      "fastHalfLife": 2,
      "slowHalfLife": 5
    },
    "restrictToElementSize": false,
    "restrictToScreenSize": false,
    "ignoreDevicePixelRatio": false,
    "clearBufferSwitch": false,
    "safeMarginSwitch": 0
  },
  "autoShowText": 3,
  "preferredAudioLanguage": "",
  "preferredAudioLabel": "",
  "preferredTextLanguage": "",
  "preferredVariantRole": "",
  "preferredTextRole": "",
  "preferredAudioChannelCount": 2,
  "preferredVideoHdrLevel": "AUTO",
  "preferredVideoCodecs": [],
  "preferredAudioCodecs": [],
  "preferForcedSubs": false,
  "preferredDecodingAttributes": [],
  "restrictions": {
    "minWidth": 0,
    "maxWidth": null,
    "minHeight": 0,
    "maxHeight": null,
    "minPixels": 0,
    "maxPixels": null,
    "minFrameRate": 0,
    "maxFrameRate": null,
    "minBandwidth": 0,
    "maxBandwidth": null
  },
  "playRangeStart": 0,
  "playRangeEnd": null,
  "cmcd": {
    "enabled": false,
    "sessionId": "",
    "contentId": "",
    "useHeaders": false
  },
  "lcevc": {
    "enabled": false,
    "dynamicPerformanceScaling": true,
    "logLevel": 0,
    "drawLogo": false
  },
  "ads": {
    "customPlayheadTracker": false
  }
}

Note that offline.numberOfParallelDownloads is set to 5 (default value)

What did you do?

Download a .mpd asset for offline playback using shaka player's storage.store API and the above configuration

What did you expect to happen?

offline.numberOfParallelDownloads setting being set to 5, I would expect to have 5 chunks downloaded in parallel.

With some other .mpd manifests (e.g. https://bitmovin-a.akamaihd.net/content/playhouse-vr/mpds/105560.mpd), .m4s chunks (also DASH segments) for example are downloaded in parallel (5 downloads in parallel in this case, which corresponds to the default value of numberOfParallelDownloads) and the download is therefore much faster...

image

What actually happened?

.dash chunks are downloaded, but they are downloaded one after the other, in other words there is no parallelisation of chunk downloads, despite offline.numberOfParallelDownloads setting being set to 5 (default value) and the download is consequently slow :

image

avelad commented 1 year ago

I'm reviewing and the player works correctly and there are 5 downloads in parallel. Captura de pantalla 2023-10-09 a las 11 20 46

The difference with the bitmovin stream is that your stream uses HTTP2 and the bitmovin stream uses HTTP 1.1

The graph you see in the devtools indicates the number of open TCP connections. In HTTP2, mutiplexing is used and the same channel is used, which is why in the graph you do not see several in parallel even though they are done in parallel.

shaka-bot commented 1 year ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.