This adds an api.alsa.bind-ctls property to alsa-pcm sink and source
nodes, to bind a property to an ALSA PCM ctl. The property is an array
of ctl names that should be bound.
This can be handy, for example, to bind the Playback/Capture Rate
controls on a USB gadget, in order to track the PCM's state via a node
param.
This is currently wired to be read-only, but it should be easy enough to
make it writable.
Because we now always _drop/_prepare_/_start, the snd_pcm_recover()
before that is no longer useful.
Retry snd_pcm_resume() after suspend when -EAGAIN and fall back to
_drop/_prepare/_start when that fails.
We need to disable the resampler when there is a pitch element. This was
correctly done in setup_matching but not in check_position_config().
See #3628
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
./pipewire-0.3.84/spa/plugins/bluez5/codec-loader.c:176:14: warning: allocation of insufficient size ‘1’ for type ‘struct impl’ with size ‘1032’ [-Walloc-size]
```
The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```
So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct impl)`. GCC then sees we're not
doing anything wrong.
Signed-off-by: Sam James <sam@gentoo.org>
When the device has not configured a format, remove the properties that
depend on the format so that they don't limit what we can configure the
device with next.
See #3613
In pw_context_recalc_graph, PipeWire takes the currently configured
clock target duration from the position as target rate. The position is
not set for the videotestsrc since the set_io function is not
implemented. This leads to a segfault when the videotestsrc is
configured and loaded.
Add the same dummy implementation of set_io as in the v4l2-source and
the libcamera-source to prevent the segfault.
BlueZ now requires endpoints to set Locations/Context, so set them to
some sensible default values. These could in principle be made
configurable later.
We calculate the available frames in read_sync but add another
check in read_frames so that we don't attempt to read more frames
than we have available to avoid xruns.
Make a function to recalculate the headroom and call it whenever the
resample state of the node can change.
When we are IRQ based scheduling but need to resample, we are actually
not driving the graph whit IRQ and need to adjust our period size and
headroom as if we are using timers.
Don't blindly clear the format when EnumFormat changes. This will
just stop the node without renegotiating.
We should probably find a new best format, check if it changed and
then Stop/configure/Resume the follower with the new format.
This fixes a stall when a node is running and you change the allowed
codecs.
vulkan_headers was a workaround for distributions providing pkg-config information
without the headers. Replacing it with a more conventional have_vulkan
and assert header availability if the option vulkan is enabled.
Use bigger fallback maximum MTU, when kernel fails to tell us, which
shouldn't happen but apparently can. We choose the packet size based on
incoming data, so these values aren't usually needed so we can just bump
them.
Also report errors as necessary.
When checking that a card has all of its PCM devices available, ignore
any specific device with the ACP_IGNORE udev environment variable. This
mirrors how we ignore whole cards, but specifically allows non-PipeWire
software to own specific PCM devices.
Note that this does not actually stop PipeWire from using those
subdevices right now, we assume UCM configs take care of that. This
should probably be implemented later to ensure PipeWire always stays
away from them, but for now this fixes the issue where it refuses to
probe the entire card.
Fixes: #3570
Signed-off-by: Hector Martin <marcan@marcan.st>
Don't try to allocate each time port buffers are set but only once
before we start procesing.
Also allocate enough temp buffers are there are ports. This saves us
quite a bit of memory in the normal case.
All linked PCMs prepare together. If we prepare the secondaries, that
action clobbers the write pointer of every PCM every time, which then
causes playback to fail to start due to lack of data.
Signed-off-by: Hector Martin <marcan@marcan.st>
The user may not know which is the active PHC index of a bonded
interface. We can now specify the interface name instead of a device
as the clock.interface property and query the interface about the
active PHC index.
When the PCM is stopped, don't check for early wakeup because if we
are early, we will never be on time in the next iteration either because the
PCM is stopped and doesn't advance.
Also don't try to align when stopped.
See #3565