Skip to content

Conversation

@peaBerberian
Copy link
Collaborator

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 the API (the RxPlayer module).

That step was unnecessary (only the id property of a Period is needed when cleaning up) and more importantly the check could fail in a situation where the Period has since been removed from a dynamic Manifest (e.g. after playing an old Period which 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.

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 the `API` (the RxPlayer module).

That step was unnecessary (only the `id` property of a `Period` is
needed when cleaning up) and more importantly the check could fail in
a situation where the `Period` has since been removed from a dynamic
Manifest (e.g. after playing an old `Period` which 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.
@github-actions
Copy link

github-actions bot commented Feb 7, 2025

Automated performance checks have been performed on commit a8e0f35e4a66e8cf4e5842ea4332e8ab3e877c59 with the base branch dev.

Tests results

✅ Tests have passed.

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.42ms -> 19.63ms (-0.209ms, z: 1.59628) 26.70ms -> 26.85ms
seeking 15.34ms -> 16.04ms (-0.701ms, z: 0.15383) 11.25ms -> 11.25ms
audio-track-reload 26.11ms -> 25.83ms (0.275ms, z: 0.81588) 37.95ms -> 37.80ms
cold loading multithread 48.13ms -> 47.00ms (1.133ms, z: 9.67019) 70.35ms -> 69.15ms
seeking multithread 25.28ms -> 16.60ms (8.684ms, z: 0.88578) 10.35ms -> 10.35ms
audio-track-reload multithread 25.82ms -> 25.82ms (0.002ms, z: 1.17128) 37.95ms -> 37.80ms
hot loading multithread 15.53ms -> 15.36ms (0.166ms, z: 3.01047) 22.40ms -> 22.05ms

If you want to skip performance checks for latter commits, add the skip-performance-checks label to this Pull Request.

@peaBerberian peaBerberian merged commit 6a3ed0c into dev Feb 13, 2025
9 checks passed
@peaBerberian peaBerberian added bug This is an RxPlayer issue (unexpected result when comparing to the API) MultiThread Concerns specifically the multithreaded mode of the RxPlayer labels Mar 4, 2025
@peaBerberian peaBerberian added this to the 4.3.0 milestone Mar 4, 2025
@peaBerberian peaBerberian mentioned this pull request Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This is an RxPlayer issue (unexpected result when comparing to the API) MultiThread Concerns specifically the multithreaded mode of the RxPlayer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants