mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-01-16 23:30:25 +01:00
41 lines
1.1 KiB
Lua
41 lines
1.1 KiB
Lua
-- Tests linking of streams and non default devices. These devices nodes are
|
|
-- neither defined nor default.
|
|
|
|
local pu = require ("policy-utils")
|
|
local tu = require ("test-utils")
|
|
|
|
Script.async_activation = true
|
|
|
|
tu.createDeviceNode ("nondefault-device-node", "Audio/Sink")
|
|
|
|
tu.createStreamNode ("stream-node")
|
|
|
|
SimpleEventHook {
|
|
name = "linking/test-linking",
|
|
after = "linking/link-target",
|
|
interests = {
|
|
EventInterest {
|
|
Constraint { "event.type", "=", "select-target" },
|
|
},
|
|
},
|
|
execute = function (event)
|
|
local source, om, si, si_props, si_flags, target =
|
|
pu:unwrap_find_target_event (event)
|
|
|
|
if not target then
|
|
return
|
|
end
|
|
|
|
Log.info (si, string.format ("handling item: %s (%s) si id(%s)",
|
|
tostring (si_props ["node.name"]),
|
|
tostring (si_props ["node.id"]), si.id))
|
|
|
|
local link = pu.lookupLink (si.id, si_flags.peer_id)
|
|
assert (link ~= nil)
|
|
assert (si_props ["node.name"] == "stream-node")
|
|
assert (target.properties ["node.name"] == "nondefault-device-node")
|
|
assert ((link:get_active_features () & Feature.SessionItem.ACTIVE) ~= 0)
|
|
|
|
Script:finish_activation ()
|
|
end
|
|
}:register ()
|