Skip to content

No singletons, Ariadne part 2b: media players, play policy and streams per app [4.0, breaking] - #1163

Closed
transfix wants to merge 2 commits into
p0a/no-singletons-ariadne-2from
p0a/no-singletons-ariadne-3
Closed

transfix wants to merge 2 commits into
p0a/no-singletons-ariadne-2from
p0a/no-singletons-ariadne-3

Conversation

@transfix

@transfix transfix commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

No singletons, Ariadne part 2b: the media player factory, play policy and stream registry are each app's own. Stacked on #1161 (then #1155, #1152). Breaking (4.0).

What moved onto the app

  • Media players. These now take the app:

    • register_player_factory(app, factory), have_player_factory(app) and make_player(app, src);
    • register_browser_player(app), and cvcMedia's register_ariadne_player(app).

    One app's player no longer plays another app's videos.

  • The play policy. set_play_policy(app, policy), play_policy(app) and may_play_here(app). Each app starts at Auto. ari and arigl apply --media-play and the player to each app they make (setup_media), not once for the process.

  • The stream registry (stream_registry::for_app(app)) is the app's slot. It was a process-wide map keyed by app* that was never freed, so a later app at a reused address got the dead app's tokens and channel pointers.

  • Runtime::app() returns the app a runtime's document runs on. gather_host_info uses it.

Allowlist: -7 lines (cvc 290 -> 283)

media_player.cpp's factory_cell, policy_cell, registry_mutex and the guard, and stream_registry.cpp's registries, registries_mutex and the guard.

Tests

  • ariadne_media_test:
    • FakeFactory registers on its test's app, made first.
    • New APlayerFactoryIsItsAppsOwn: two apps' factories make only their own players, and removing one leaves the other.
    • ThePolicyAndTheTimeLine checks that another app's policy stays at Auto.
  • stream_test: new AnAppsRegistryGoesWithIt. Apps made one after another, which may land at the same address, start with no tokens.
  • cvcmedia_player: another app has no player.
  • multi_app_integration_test: the workload adds media and streams. Even apps play always and odd ones never, and only app 0 has a player. Every app opens a stream named shared: with the old process-wide registry, only one app's open would have succeeded.

Locally (Windows, MSVC 2022): the whole tree builds, and these pass:

  • multi_app_integration_test 2, ariadne_registries_test 10, ariadne_media_test 56, stream_test 36;
  • ariadne_runtime_test 262, ariadne_loader_test 228, ariadne_host_test 46;
  • the other Ariadne and room suites;
  • the cvcGL media, stream and Ariadne tests, and cvcMedia's (15).

CI

The full run is the push to ci/full/no-singletons-ariadne-3: https://github.com/transfix/libcvc/actions/runs/43158749915.

Update: 57460d6 fixes arisrvx (a server host now registers its Python engine on its app before it reads its server document). Full run: https://github.com/transfix/libcvc/actions/runs/43172073735.

…s per app

- The media player factory and the play policy are the app's:
  register_player_factory / have_player_factory / make_player /
  set_play_policy / play_policy / may_play_here and
  register_browser_player take the app, as does cvcMedia's
  register_ariadne_player. ari and arigl set up media for each app they
  make (setup_media) instead of once for the process.
- The stream registry is the app's slot. It was a process-wide map
  keyed by app* that was never freed, so a new app at a reused address
  got the dead app's tokens and channel pointers.
- Runtime::app() returns the app a runtime's document runs on.

Allowlist -7 lines (cvc 290 -> 283).

Tests: ariadne_media_test's FakeFactory registers on its test's app
(made first); new APlayerFactoryIsItsAppsOwn, and ThePolicyAndTheTimeLine
checks another app's policy; stream_test's AnAppsRegistryGoesWithIt;
cvcmedia_player checks another app has no player;
multi_app_integration_test's workload adds media and streams (every
app opens a stream of the same name).
@transfix

Copy link
Copy Markdown
Owner Author

Replaced by #1203, which lands the whole no-singletons stack as one PR. This branch's head is an ancestor of #1203's branch, so its commits are all there; the branch is kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant