Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix off by 1 issue in when relying on
keySystems[].maxSessionCacheSize
`keySystems[].maxSessionCacheSize', which allows to limit the number of created `MediaKeySession`, was relied on before creating a new `MediaKeySession` (this is good I guess). However it considered if we were over the limit at that instant, were in reality the logic should probably also account for the `MediaKeySession` that will be created just after. The current behavior leads to having a supplementary `MediaKeySession` than what `keySystems[].maxSessionCacheSize` authorizes. To fix it, I simply remove `1` from the limit we want to enforce in that call, unless removing `1` would lead to a negative number as this has a special semantic (which is to have no limit). This still works for `0` like it worked before (which is strangely equivalent to setting it to `1` in our logic, but setting it to `0` is just asking for bugs anyway I guess :p). NOTE: We could have a plausible justification for our precedent behavior that it was only setting the "cache size" and thus excluding the last "actually relied on" one, but this is not how it is documented in the API documentation, so to me this is a bug.
- Loading branch information