mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-03-21 07:40:36 +01:00
state-stream: fix crash in case the Format has a Choice for the number of channels
Fixes: #903
This commit is contained in:
parent
27337ed268
commit
de0bca5902
1 changed files with 12 additions and 2 deletions
|
|
@ -348,8 +348,18 @@ function buildDefaultChannelVolumes (node)
|
|||
for pod in node:iterate_params("Format") do
|
||||
local pod_parsed = pod:parse()
|
||||
if pod_parsed ~= nil then
|
||||
channels = pod_parsed.properties.channels
|
||||
break
|
||||
local t = type(pod_parsed.properties.channels)
|
||||
if t == "number" then
|
||||
channels = pod_parsed.properties.channels
|
||||
break
|
||||
else if t == "table" and #pod_parsed.properties.channels > 0 then
|
||||
-- in some misbehaving clients a non-fixed Format may appear here, which means the number of
|
||||
-- channels will be some kind of choice. If this is the case, pick the first number in the
|
||||
-- choice (which is either the default in an enum or range, or may just happen to be the
|
||||
-- right number in other cases)
|
||||
channels = pod_parsed.properties.channels[1]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue