Check each object key is associated with value. Disallow object or
array valued keys.
Add flag tracking whether the parser is at global top-level or not, as
there we may either be in object context or in a single-value context.
Save depth=0 array flag bit in state, so that spa_json_next preserves
its complete state across calls. The higher-depth flag bits can be in
temporary stack as they are not needed across calls.
Control characters probably are an error. We also are not validating any
utf8 here, so disallow bare utf8 too --- one likely should use strings
for such content anyway as spaces are not allowed otherwise.
Successful return is always >= 2 since it includes {} or [], so use 0 to
indicate error.
Since there's existing code that doesn't check the return value, it's
better to use 0 for errors as it'll likely to just lead to producing an
empty string if the value is not checked.
Disallow = and : as bare items in [] containers, as that likely is
"[ { foo = bar } ]" mistyped as "[ foo = bar ]".
Disallow nesting errors, eg. "[ foo bar" or "[ foo bar }".
Fix handling of ", \ and # in bare strings.
Fix ignoring trailing comments.
Add a fixed-size stack (128 levels) to the tokenizer, so that it can
check these at levels below its depth.
When the tokenizer encounters an error, make it and its parents enter
error state where no further input will be processed. This allows caller
to check for parse errors later as convenient.
The error state can be queried using spa_json_get_error, which also
looks up the error line/column position.
spa_json_parse_float/int receive non nul-terminated string, so calling
string functions assuming nul-termination is invalid.
Fix by copying data to a buffer before doing parsing.
spa_exchange() is used in spa_clear_ptr() and spa_clear_fd() which
already use the _old_value variable. So make it use a slightly different
local variable name to avoid shadow warnings.
Fixes#3915
spa_json_parse_stringn() can be used when the strings source and
destination are overlapping so use memmove instead of strncpy to
avoid corruption of the strings.
Use alsa:acp: as the object prefix to make it different from the
alsa:pcm prefix when we are not using ACP.
Replace the card index in the object.path with the card_name, which
we try to construct from the alsa.id when it is available. This brings
the object.path in line with the alsa-pcm-device naming and adds the
user configurable id in the object.path to make it possible to
differentiate between identical devices.
Place the acp device index after the card_name instead of the unstable
device name (which depends on the alsa card number, which depends on the
kernel probing order).
This should make the object.path stable accross reboots for ACP and user
configurable with udev. With such a stable id, the other fields can be
made stable as well with custom rules.
See #3912
Use snd_ctl_card_info to set some more card properties such as the
alsa.id, alsa.mixer_name and alsa.components.
alsa.id is interesting because it is possible to use udev rules to set a
custom id, which is handy when you have two identical cards in the
system and want to assign unique ids to them.
See #3912
Add pw_conf_section_update_props_rules() that will not only update the
properties of a section but wil also apply rules in section.rules and
match against the context properties.
Use this by default when using pw_context_conf_update_props().
Add a new method to get a string name of the VM type. Place the
cpu.vm.name in the context properties.
This makes it possible to deprecate the vm.overrides with something more
flexible based on rules. Update the conf files and docs to refect this.
This does a couple of things: first, we implement revents demangling,
which seems to be required (although hw: devices work fine without it).
The second is to actually read the ctl events so we can tell when
elements we care about have changed, instead of reading everything and
trying to do a diff.
The latter is also required from a correctness perspective, as otherwise
the ctl might keep triggering wakeups while the fd is ready to be read.
Add a monitor.passthrough option. This will pass all latency information
directly between the port and its monitor ports.
This is interesting when the adapter (and audioconvert) is used with a
null-audio-sink that simply forwards the data to a real sink/souce. In
that case, we want the sink/source latency to be passed unmodified.
Set the monitor.passthrough on the pulseaudio null-sink because
a passthrough virtual sink is the most likely use case for this.
Add some monitor.passthrough default config where it makes sense.
Fixes#3888
When timer is not using monotonic clock, apply clock offset to translate
the time values to the monotonic clock when putting them to spa_io_clock
nsec fields.
Get appropriate clock offset by smoothed filtering. The parameters here
keep the offset jitter < 10ns or so.
As monotonic/boottime/realtime all contain adjtime(), there generally is
no drift in the offset here, so just averaging should be fine.
Also fix using wrong timer clock when freewheeling.
Variable declarations after a label are not allowed,
and clang does not accept them. Fix the build failure
by removing the variable.
Fixes b3fbd0e607 ("alsa-pcm: add_bind_ctl_param: add support for array")
For matching kctl without the numid you need to specify interface,
device, subdevice, name and index. So the current implementation can
only match kctls on IFACE_PCM, device 0, subdevice 0 and index 0.
Instead of adding all these matching parameters this commit fetches all
kctls attached to the audio card and match on the first occurred kctl
with matching name.
This should be sufficient for audio cards with unique kctl names. When
non unique names are needed, more kctl matching parameters needs to be
added.
ALSA controls can only be opened on the card itself and will fail when
trying to open controls on the ALSA device. The device name we get may
or may not include the device suffix. If no suffix is present the
default device is 0 that's why currently it works on most audio cards.
But all other devices above 0 needs the suffix [1].
[1]
Device 0: hw:cardname
Device 0: hw:cardname,0
Device 1: hw:cardname,1
Device 2: hw:cardname,2
Device X: hw:cardname,X
We know in IRQ mode that any valid hi-res timestamp that the
driver privides will be before the wakeup event in pipewire.
This makes it so in IRQ mode we use better timestamping when possible,
which decreases jitter injected into the DLL, which in turn reduces
the amount of oscillations the resampler is exposed to.
Currently the HDMI output paths have jack mixers named "HDMI/DP" and
with append-pcm-to-name=true. However, most of the SOC audio drivers
are just named "HDMI" and don't add the ",pcm=N". Add these alternate
jack names to the HDMI audio path files so that jack detection will work
on these SOCs.
Keep track of the valid ports and don't emit port info for
invalid ports. When a listener is added while the ports are being
created, it is possible that the ports are still NULL or invalid.
Add some option to set manually group IDs of unicast streams
of devices.
Intel controllers don't appear to support more than one group at a time,
but in principle this can be done.
Propagate the error if spa_system_eventfd_create() fails. Also copy
errno before calling spa_log_debug() in spa_system_eventfd_create() to
make sure it is not overwritten.
The rate we get from dlls can have a subsample precision. However,
the check for using process_copy is in sample precision. This means
that an adaptive stream will oscillate rather then lock into the
exact rate.
We would timestamp within an unlikely block, which would introduce
additional jitter to current_time, which would have an impact on
the performance of the timer sensitive code.