[MULTI_THREAD] Fix potential leak when cleaning now inexistant Period #1644
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for a small-scale leak happening in cases where we would be unlucky with timings on a live content in a "multithreading" mode.
It was seen while investigating all possibilities for the issue reported by #1643, though it has an extremely low chance to actually be linked to that issue.
This fix is about the handling of
Init's"periodStreamCleaning"event handling.That event allows to clean-up resources that have previously been allocated for a specific Period in a content: track handling, boundaries checking etc.
Previously, only in "multithreading" mode, we checked that the Period of a
"PeriodStreamCleaning"event was found in the Manifest before bubbling the event up to theAPI(the RxPlayer module).That step was unnecessary (only the
idproperty of aPeriodis needed when cleaning up) and more importantly the check could fail in a situation where thePeriodhas since been removed from a dynamic Manifest (e.g. after playing an oldPeriodwhich has been loaded locally but which now does not exist anymore in the Manifest).The only issue I can think of with that for now are relatively-low memory leaks (which will be collected once stopping/switching content). Still.