AbrController.getPlaybackQuality() or SwitchRequestHistory.push() does not handle SwitchRequest.NO_CHANGE correctly in
Created by: twdkeule
Environment
-
The MPD passes the DASH-IF Conformance Tool on http://dashif.org/conformance.html -
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://dashif.org/reference/players/javascript/ and not just on my page
- Link to playable MPD file: use the reference player
- Dash.js version: development (april 2017)
- Browser name/version: Chrome 58
- OS name/version: Ubuntu 17.04
Steps to reproduce
Play a stream.
Observed behaviour
When starting the video, no ABR rules have valid values so they all return SwitchRequest.NO_CHANGE
in rule.getMaxIndex() (in ABRRulesCollection.getMaxQuality()
).
Then ABRRulesCollection.getActiveRules(srArray)
will (correctly) filter out these results resulting in an empty array after which maxQuality is undefined (see log output).
The return value of getMaxQuality() then becomes a SwitchRequest(context).create()
with a value of -1 (NO_CHANGE).
This SwitchRequest is pushed to SwitchRequestHistory where it is interpreted as a (large) drop in quality as the new level (-1) is per definition lower than any current quality level.
Once these false drops are in the switch history they are used by the SwitchHistoryRule but the effects are only visible after SwitchHistoryRule.SAMPLE_SIZE
(=6) segments have been downloaded.
Either AbrController.getPlaybackQuality()
should check if the new SwitchRequest has positive values (as it does a few lines lower)
Or (the better option in my opinion) SwitchRequestHistory.push()
should check its input and ignore the negative values.
Console output
[10123:10123:0425/140225.682324:INFO:CONSOLE(3572)] "[0] ABRRulesCollection.js:118: maxQuality=undefined; all requests=[{"value":-1,"reason":null},{"value":-1,"reason":null},{"value":-1,"reason":null},{"value":-1,"reason":{"droppedFrames":0}}] ", source: dash.all.debug.js (3572)
[10123:10123:0425/140225.682402:INFO:CONSOLE(3572)] "[221] AbrController.js:312: top qual=4; new qual=-1 ", source: dash.all.debug.js (3572)
[10123:10123:0425/140225.682798:INFO:CONSOLE(3572)] "[0] SwitchRequestHistory.js: pushed switchRequest: {"oldValue":0,"newValue":-1} ", source: dash.all.debug.js (3572)\
...
[13171:13171:0425/143429.790042:INFO:CONSOLE(3572)] "[425] Switch history rule index: 3 samples: 6 drops: 3 ", source: dash.all.debug.js (3572)