Skip to content

The platform supplies the media composition, and the app publishes it once - #1489

Open
GLinnik21 wants to merge 2 commits into
mainfrom
platform/w6b-media-composition
Open

GLinnik21 wants to merge 2 commits into
mainfrom
platform/w6b-media-composition

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Step W6b of the platform plan (discussion #1460): the platform supplies the playback composition, in two boot phases. The app publishes what it gets once, on every boot. Before, app/boot.rs called acb_init and compose_backends directly, and playback.rs and run.rs chose code paths with feature = "play-uri" gates. Now Platform carries a MediaBoot: webOS fills it with today's bodies, the desktop with the Feed host sink alone, and Platform::HOST_TEST with nothing. webOS boots the same way at the same points, with one new log line.

What changes

  • app/platform.rs
    • Platform gains media: MediaBoot { early_init: fn(&MainThread), compose: fn(&mut PlayerAdapter, controlled: bool) -> Composition }. Platform::new takes it as a fourth argument.
    • Composition { resolver: Option<ResolvePort> } derives Default, which means no resolver.
    • publish_composition(session, adapter, Composition) publishes the resolver first, then install_backends(adapter.composed_backends()).
      • It runs on every boot, for every platform, so a platform with no drivers publishes BackendSet::NONE and no resolver. The session's set and its resolver can no longer disagree.
      • It logs one new line, compose: backends=<uri+feed|uri|feed|none> resolver=<yes|no>. Every existing log line is unchanged.
    • HOST_TEST composes nothing, and the pin test covers the new field.
  • app/boot.rs: two hunks.
    • The acb_init call becomes (platform.media.early_init)(&mt). It stays on the same line, inside the same if !controlled, before ffi::boot().
    • The compose_backends block becomes (platform.media.compose)(…), then publish_composition(…), at the same site.
  • Who fills what
    • src/port.rs (webOS): MediaBoot { early_init: backends::acb_init, compose: backends::compose_native }.
    • src/platform_desktop.rs: a no-op early_init. Its compose calls compose_feed and returns Composition::default().
  • app/adapters/backends.rs
    • compose_backends is split into compose_feed (shared), compose_native, and compose_with(adapter, controlled, install_uri), which the tests use.
    • install_uri_product and install_uri_product_with_ports no longer take the session. They return Option<ResolvePort>, built only after the physical URI install succeeds.
    • The uri: product driver installation refused line moved into install_uri_product, with its text unchanged.
  • media/src/route/decision.rs
    • install_uri_preflight_port takes impl Into<Option<ResolvePort>>, so an absent resolver clears the slot, and the 14 existing callers compile unchanged.
    • A reader, uri_preflight_port(), is added for the tests.
  • playback.rs and run.rs: the ten feature = "play-uri" lines that chose a path at build time are deleted, six in playback.rs and four in run.rs. Those paths now read the published set at run time. Nothing else in either file changes.
  • Docs: Target shape 6a in docs/platform-ports.md gains an "As landed" note, and docs/module-layers.md follows.

Deviations from the plan

  • Composition is a seam, not a move. port.rs points at functions in app/adapters/backends.rs instead of owning their bodies, because those bodies name ACB, and the app crate's own ACB names leave it only in W11a. The 6a text and the W6b paragraph say so.
  • compose takes no &PlaybackSession. The only use of the session was the old resolver publication, which now happens in publish_composition. 6a records that W10 adds a read-only session parameter if a Tizen driver needs one.
  • 46 play-uri lines remain: 40 in backends.rs, 1 in a run.rs test fixture, 3 in dev.rs, 1 in lib.rs and 1 in the rig. None remain in boot.rs, production run.rs, playback.rs or platform.rs. This commit adds five gated lines to backends.rs, so the docs give the grep instead of a count.
  • Composition::NONE became Default: the constant was read only by the desktop platform, and make check-nodef failed on it as dead code.

What the simulator does differently

  • No URI driver is composed. play-uri is a default feature, so before this change the simulator composed the product URI driver over null ports. Its session set is now Feed alone, with no resolver.
  • Its log no longer has the vplane: exported window … or vplane: this device has NEITHER libAcbAPI … line, nor the uri: product binding=… and uri: display path=… lines.
  • PlaneOwner::boot(ABSENT) is no longer called. The default plane facts are the same absent facts.
  • dev::uriprobe::install no longer runs in a simulator devtriggers build.

Tests

New tests drive the real composition, not a stand-in. In each case, the published set and resolver must agree:

  • a successful URI install;
  • a refused URI install;
  • a controlled boot;
  • the desktop's compose_feed shape;
  • a zero-driver publish;
  • reading back the published resolver.

The URI boot rig's 18 calls, and install_exported_uri, now publish through publish_composition. A rig adapter is Feed plus URI, so its session set is now BOTH (it was FEED). That is the set a production boot publishes with both drivers.

Results on b951d2a, all on the committed tree:

  • make test-hostsim T=uri_boot: test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 1725 filtered out
  • make test-crate C=plx_media: test result: ok. 2159 passed; 0 failed; 104 ignored; 0 measured; 0 filtered out
  • Full make test-hostsim, without two tests that kill the test binary (SIGSEGV) on the lane's Mac at base 8f55751 as well: 1750 passed, 2 failed. The two failures were in deeplink_route_tests, which passed on rerun: test result: ok. 9 passed; 0 failed.
  • make check-nodef PLAYBACK_BACKENDS=both|uri|feed|none: all four compile.
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0
  • ci/check-deps.sh, ci/check-module-layers.py, ci/check-ledger-ratchet.py and ci/check-statics.sh are green.
  • ci/test_readonly_generated.py (22 tests) and ci/test_readonly_dependencies.py (64 tests) pass.
  • No Cargo, .cargo or certificate-pinned file changes. Both spellings of every touched path were checked against ci/proofs/*.json.

Not covered

  • check-nodef only compiles. The single-backend shapes (uri, feed, none) are not built as tests or run anywhere in CI.
  • The television check is still to come: one --guest --mock lease, base then head, with no setting change. It shows that Feed plays a mock title, the URI case binds and displays as before, vplane:/ptype= sit at the same point relative to the identity line, and the compose: line appears on head only.

🤖 Generated with Claude Code

GLinnik21 and others added 2 commits November 20, 2026 15:59
… once

Platform gains a MediaBoot: early_init runs at the old acb_init line, before the first adapter,
and compose installs the platform's drivers on the adapter and returns a Composition, the
resolver and nothing else. Compose takes no session and publishes nothing. The boot then calls one
function, publish_composition, which gives the route session the resolver and then the set the
adapter's installed drivers form, every boot, a zero-driver platform included, and logs one
"compose: backends=<set> resolver=<yes|no>" line. The set and the resolver can no longer
disagree: a refused URI install returns no resolver, and the adapter holds no URI driver.

The webOS port fills the table with backends::acb_init and backends::compose_native; the
desktop installs the Feed over the host sink and no URI driver, with a no-op early_init; the
host-test platform composes nothing. The bodies stay in adapters/backends.rs until W11a: dev and
the tests name UriProduct and its siblings, and the layer fence forbids them naming port.
compose_backends is gone, split into compose_feed (shared), compose_native and the
compose_with core the host rig drives over its own ports. install_uri_product(_with_ports) now
return the resolver instead of writing it into a session.

The ten play-uri gates in playback.rs and run.rs that only read what the installed drivers do
at run time are removed; the 41 that name ACB or the URI product stay. install_uri_preflight_port
takes a bare port or an Option, and the session has a reader for it.

The 18 URI boot rig tests now publish through the same function as the boot instead of
installing the resolver by hand; none changed its outcome. New tests cover a composed URI
driver, a refused install, a controlled boot and a platform that composed nothing, each
asserting the session's set and resolver agree.

Co-Authored-By: Claude <noreply@anthropic.com>
…ollows the desktop change

A platform that composed no URI driver returns Composition::default(). The NONE constant was
read only by the simulator's platform, so a television build that does not compile the simulator
saw it as dead code and refused to build. Three sentences that the desktop change made false are
corrected: the module-layers note that every play-uri build resolves the URI media pipe at boot,
the desktop DISPLAY constant's note about a plane boot the simulator no longer runs, and the
per-file counts of the play-uri sites that remain.

Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
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