Performance issue with mediaInfoArr arrays
Created by: recon08
Environment
-
The MPD passes the DASH-IF Conformance Tool on https://conformance.dashif.org/ -
The stream has correct Access-Control-Allow-Origin headers (CORS) -
There are no network errors such as 404s in the browser console when trying to play the stream -
The issue observed is not mentioned on https://github.com/Dash-Industry-Forum/dash.js/wiki/FAQ -
The issue occurs in the latest reference client on http://reference.dashif.org/dash.js/ and not just on my page
- Link to playable MPD file: not required
- Dash.js version: 3.1.3
- Browser name/version, OS name/version: Tizen
Steps to reproduce
- Play any livestream with short manifest update (2s is perfect)
- Keep the stream running for multiple hours
- After 8 hours, the stream will stall on slower devices
Observed behaviour
When playing the stream for a longer time, the performance of the player gets worse. This is because DashJS maintains 2 separate arrays with infromation that is not necessary and is later passed in navigator.requestMediaKeySystemAccess which causes serious performance issues
Description of the behaviour
- src/streaming/protection/controllers/ProtectionController.js:106 runs at every stream update
- mediaInfoArr.push(mediaInfo); pushes a chunk of mediaInfo into the array
- In src/streaming/ StreamProcessor.js:367 mediaInfoArr is also maintained parelly
- src/streaming/protection/models/ProtectionModel_21Jan2015.js:315 navigator.requestMediaKeySystemAccess(systemString, configs) gets called with a configs object which originates from the mediaInfo array where video and audioCapabilites length is the times that MPD update since playback start
- this is why we saw an increasing time of the navigator.requestMediaKeySystemAccess over time
- On Samsung Tizen 2020 -- Starts around 25-50ms, -- After 2hours 250-500ms -- After 8 hours, 1-2seconds in theory To confirm the performance overhead, I sliced the mediaInfoArr to the last 10 elements and the questioned call's timing settled to where it started from.