mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-20 12:20:04 +01:00
state-routes.lua: Use the returned iterator from enum_params() to update routes info
This does not really fix anything but it saves some CPU cycles as we don't need to get the route params from the cache anymore.
This commit is contained in:
parent
4239055454
commit
e30c2a7cd9
1 changed files with 92 additions and 96 deletions
|
|
@ -159,28 +159,23 @@ store_or_restore_routes_hook = AsyncEventHook {
|
||||||
},
|
},
|
||||||
steps = {
|
steps = {
|
||||||
start = {
|
start = {
|
||||||
next = "evaluate",
|
next = "none",
|
||||||
execute = function (event, transition)
|
execute = function (event, transition)
|
||||||
|
local source = event:get_source ()
|
||||||
|
local device = event:get_subject ()
|
||||||
|
|
||||||
-- Make sure the routes are always updated before evaluating them.
|
-- Make sure the routes are always updated before evaluating them.
|
||||||
-- https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/762
|
-- https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/762
|
||||||
local device = event:get_subject ()
|
device:enum_params ("EnumRoute", function (enum_route_it, e)
|
||||||
device:enum_params ("EnumRoute", function (_, e)
|
local selected_routes = {}
|
||||||
|
local push_select_routes = false
|
||||||
|
|
||||||
|
-- check for error
|
||||||
if e then
|
if e then
|
||||||
transition:return_error ("failed to enum routes: "
|
transition:return_error ("failed to enum routes: "
|
||||||
.. tostring (e));
|
.. tostring (e));
|
||||||
else
|
return
|
||||||
transition:advance ()
|
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
end
|
|
||||||
},
|
|
||||||
evaluate = {
|
|
||||||
next = "none",
|
|
||||||
execute = function (event, transition)
|
|
||||||
local device = event:get_subject ()
|
|
||||||
local source = event:get_source ()
|
|
||||||
local selected_routes = {}
|
|
||||||
local push_select_routes = false
|
|
||||||
|
|
||||||
-- Make sure the device is still valid
|
-- Make sure the device is still valid
|
||||||
if (device:get_active_features() & Feature.Proxy.BOUND) == 0 then
|
if (device:get_active_features() & Feature.Proxy.BOUND) == 0 then
|
||||||
|
|
@ -197,7 +192,7 @@ store_or_restore_routes_hook = AsyncEventHook {
|
||||||
local new_route_infos = {}
|
local new_route_infos = {}
|
||||||
|
|
||||||
-- look at all the routes and update/reset cached information
|
-- look at all the routes and update/reset cached information
|
||||||
for p in device:iterate_params ("EnumRoute") do
|
for p in enum_route_it:iterate() do
|
||||||
-- parse pod
|
-- parse pod
|
||||||
local route = cutils.parseParam (p, "EnumRoute")
|
local route = cutils.parseParam (p, "EnumRoute")
|
||||||
if not route then
|
if not route then
|
||||||
|
|
@ -282,6 +277,7 @@ store_or_restore_routes_hook = AsyncEventHook {
|
||||||
end
|
end
|
||||||
|
|
||||||
transition:advance ()
|
transition:advance ()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue