Why are retryAttempts and retryIntervals modified in low latency mode?
Created by: jmar777
While testing error recovery, I noticed that the retryAttempts
and retryIntervals
seemed to be getting ignored. Upon further inspection of the source, I learned that, while these settings aren't outright disregarded, they do become modified when running in low latency mode.
Source for getRetryAttemptsForType(type)
:
const LOW_LATENCY_MULTIPLY_FACTOR = 5; // line 44
function getRetryAttemptsForType(type) {
return settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.retryAttempts[type] * LOW_LATENCY_MULTIPLY_FACTOR : settings.get().streaming.retryAttempts[type];
}
Source for getRetryIntervalsForType(type)
:
const LOW_LATENCY_REDUCTION_FACTOR = 10; // line 43
function getRetryIntervalsForType(type) {
return settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.retryIntervals[type] / LOW_LATENCY_REDUCTION_FACTOR : settings.get().streaming.retryIntervals[type];
}
I appreciate why low latency mode benefits from different defaults here, but it strikes me as unexpected to modify explicitly provided settings. This also seems to have the potential of unintentionally flooding a backend media server with a far higher frequency and volume of requests than expected. A developer who wants the player to make 5 attempts over a 5 second window would presumably enter 5
for retryAttempts
and 1000
for retryIntervals
, whereas the code cited above will turn this into 25 attempts over 2.5 second window.
I tried searching, and I couldn't find this behavior documented anywhere, much less the rationale for it. IMO, it seems best to remove this behavior, but at a bare minimum, this looks like it deserves some documentation. I haven't yet contributed back, but I'm happy to submit a pull request for either; I just need some feedback on which solution would be considered better. :)