Skip to content

Comments

tests: add tests for stop-on-event cases#1763

Open
peaBerberian wants to merge 2 commits intodevfrom
misc/more-tests
Open

tests: add tests for stop-on-event cases#1763
peaBerberian wants to merge 2 commits intodevfrom
misc/more-tests

Conversation

@peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Nov 3, 2025

STATUS: Still adding some tests over time in this branch


This just adds tests for cases that are easy to break: an application performing an action with large side-effects (e.g. stop(), loadVideo(, reload(), setAudioTrack() etc.) right when receiving an event.

For now I just added tests checking that when stop() is called on any event, the RxPlayer does stop synchronously after that and cancel all that it was doing, including potential future events it would have sent.

@peaBerberian peaBerberian force-pushed the misc/more-tests branch 3 times, most recently from e668c92 to 40e6c45 Compare November 3, 2025 13:36
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

✅ Automated performance checks have passed on commit c8e9ad140941a68ecc31458023fbac121cc9e966 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 21.53ms -> 21.77ms (-0.238ms, z: 0.22771) 30.45ms -> 30.45ms
seeking 15.68ms -> 14.34ms (1.340ms, z: 0.56836) 12.45ms -> 12.45ms
audio-track-reload 29.27ms -> 29.13ms (0.139ms, z: 0.67392) 42.90ms -> 42.90ms
cold loading multithread 49.16ms -> 48.36ms (0.800ms, z: 12.41891) 72.45ms -> 71.10ms
seeking multithread 68.20ms -> 68.27ms (-0.065ms, z: 1.04232) 11.10ms -> 11.25ms
audio-track-reload multithread 28.29ms -> 28.24ms (0.051ms, z: 0.60052) 41.85ms -> 41.85ms
hot loading multithread 16.57ms -> 16.37ms (0.194ms, z: 4.78738) 24.45ms -> 24.15ms

@peaBerberian peaBerberian force-pushed the misc/more-tests branch 2 times, most recently from 1231f7e to 28a358a Compare November 3, 2025 15:29
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

✅ Automated performance checks have passed on commit 6a3fc13b155264141bc9b8e39c51fb2b3678785d with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 21.19ms -> 21.32ms (-0.125ms, z: 0.93139) 30.15ms -> 30.15ms
seeking 12.23ms -> 16.23ms (-4.003ms, z: 0.82269) 12.30ms -> 12.30ms
audio-track-reload 28.70ms -> 29.59ms (-0.886ms, z: 0.01360) 42.15ms -> 42.15ms
cold loading multithread 48.33ms -> 48.39ms (-0.058ms, z: 9.98272) 71.40ms -> 70.35ms
seeking multithread 69.51ms -> 75.47ms (-5.958ms, z: 1.94443) 11.10ms -> 10.95ms
audio-track-reload multithread 27.84ms -> 27.67ms (0.174ms, z: 1.76801) 41.25ms -> 40.95ms
hot loading multithread 16.16ms -> 16.01ms (0.157ms, z: 3.14312) 23.70ms -> 23.55ms

New integration tests I've added recently led to a curious behavior: for
multithreaded contents, we had two initial `textTrackChange` (with the
payload `null`) in a row instead of just one.

This exact behavior does not break the API, but it was nonetheless not
normal, so I looked at it.

---

Turns out it is linked to a bad ordering in core between the first
"PeriodChange" Core message (indicating a Period is currently
playing, thus implies that we already chose the audio+video+text
tracks) and the last "AdaptationChange" (for audio or video or text type)
for that first period.

What happened:

1. The content begins to be loaded, the RxPlayer setup everything, and
   start choosing the initial Adaptations (tracks) and Representations.
2. Once all Adaptation are setup, Core send a `PeriodChange` message
3. Then Core sent an `AdaptationChange` message for the last Adaptation
   set-up (the text one here)
4. Main thread receives the `PeriodChange` message and bubble it to the
   public API module.
5. The public API on this event looks at the current audio / video / text
   tracks for that new Period and send the right `...TrackChange` events,
   then send a `periodChange` event, as expected
6. Main thread then receives the `AdaptationChange` message and also
   bubble it.
7. The Public API reacts on this event by sending again `textTrackChange`
   for the same text track, because it thinks from the `AdaptationChange`
   message that the track just changed, after the PeriodChange

---

Reversing the ordering (the last `AdaptationChange`, then `PeriodChange`)
in Core makes more sense (messages are the Core's API, and advertising
for a Period change should be done after advertising for all tracks
initially choosen for that Period) fixes the issue.

It's very unclear to me if this led to actual bugs later in the
RxPlayer. For now the only seen impact was a failing integration tests
which was voluntarily less "tolerant" than our advertised API.
@github-actions
Copy link

✅ Automated performance checks have passed on commit 8761c172f3c58e3394daa0005ad4eee58ed502c8 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 20.55ms -> 21.47ms (-0.923ms, z: 0.21236) 29.10ms -> 29.10ms
seeking 13.37ms -> 11.31ms (2.062ms, z: 0.62131) 12.05ms -> 12.15ms
audio-track-reload 28.06ms -> 28.01ms (0.051ms, z: 1.77370) 41.25ms -> 41.10ms
cold loading multithread 47.12ms -> 46.94ms (0.174ms, z: 15.99424) 69.30ms -> 67.95ms
seeking multithread 49.94ms -> 44.66ms (5.280ms, z: 0.77229) 10.95ms -> 10.95ms
audio-track-reload multithread 27.25ms -> 27.22ms (0.024ms, z: 0.18157) 40.05ms -> 40.20ms
hot loading multithread 15.44ms -> 15.39ms (0.054ms, z: 2.85993) 22.65ms -> 22.50ms

@canalplus canalplus deleted a comment from github-actions bot Dec 19, 2025
@canalplus canalplus deleted a comment from github-actions bot Dec 19, 2025
@canalplus canalplus deleted a comment from github-actions bot Dec 19, 2025
@peaBerberian peaBerberian force-pushed the dev branch 2 times, most recently from d4be192 to 9ad6758 Compare December 19, 2025 19:49
@peaBerberian peaBerberian added this to the 4.5.0 milestone Jan 19, 2026
@peaBerberian peaBerberian force-pushed the dev branch 7 times, most recently from 270a289 to 6bb7e85 Compare January 26, 2026 18:58
@peaBerberian peaBerberian force-pushed the dev branch 2 times, most recently from 0142e34 to 1fd9df3 Compare January 27, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

work-in-progress This Pull Request or issue is not finished yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant