for playback streams we want to include the hw_avail, which is the amount of
data that the hardware can read or the amount of data the application has
written.
This is in contrast to using _avail for the capture stream, which is
what the application can read. hw_avail for a capture stream is how many
samples the hardware can write or the amount of free space.
See #1697
When a global is removed, also remove the proxies. We can have multiple
proxies to a global otherwise when a client has a sequence of events
queued from the server like this:
Global 1 added
Global 1 removed
Global 1 added
The proxy we added in the firt event would not be destroyed because the
server did not know about it when global 1 was removed and then a
second one would be made.
gstreamer alsasink can change sample while stream is already created.
In that case, gstreamer calls snd_pcm_ioplug_callback_t::stop,
snd_pcm_ioplug_callback_t::hw_params and snd_pcm_ioplug_callback_t::prepare
Add new flag to the snd_pcm_pipewire_t that is set every time
snd_pcm_pipewire_hw_params is called to prevent using stream with old
sample rate
Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
pw->time.delay is delay in number of frames in pw->time.rate domain,
however snd_pcm_pipewire_delay function is suppose to return number of
frames in io->rate domain. Convert pw->time.delay to io->rate domain to
increase precision when the io->rate is not equal to the pw->time.rate
snd_pcm_pipewire_delay should return how many frames are queued in
pipewire, pw_stream_get_time returns numbers of the queued frames before
snd_pcm_pipewire_process is called, however this function inserts (or
removes) some frames from pipewire. Therefore newly inserted (removed)
frames should be added to pw->time.delay to increase precision.
Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
Ignore -ENOENT errors, they are likely because some device was
removed.
Make sure we clear the poll descriptor when nothing is pollable, even
in the error case.
Clear the error after we reported it instead of reporting it forever.
Fixes#1627
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.
All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.
Patch generated with concinelle with a few manual fixes.
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
priority.session is meant to be used to set routing priorities.
priority.driver is meant to be used by the scheduler to select what
nodes is best for driving the graph. This usually depends on the
hardware quality and the use case (Pro Audio devices are likely
to be used as driving the graph).
See #1028
Don't just store the id in the metadata but a JSON object with
the node name. This makes it possible to easily introspect the
metadata and also extend the metadata with more fields later.
Instead of matching the metadata id to the global ids we now
have to match it against the name.
In there we can evaluate the poll fd and make sure it blocks or not
in the following poll based on the buffer filled levels. Some API
is very sensitive about this, it seems.
Fixes#433
We need to use the default channel layout that alsa clients expect.
Remove query chmap, nobody uses that, we need to use the alsa default
channel map.
Implement set_chmap in case anybody wants to set a custom map.