Commit graph

13046 commits

Author SHA1 Message Date
Pauli Virtanen
e74e7b938e bluez5: don't re-emit nodes on device set events if unchanged
Only re-emit nodes on BAP device set changes, if our configuration
actually needs to be changed.
2024-11-25 21:26:13 +02:00
Pauli Virtanen
656ebcfcbb bluez5: fix handling of multiple transports for same profile
Don't mark a profile disconnected, if it still has active transports.

For BAP, emit device set changed events when transports come and go, so
that the SPA device can reconfigure accordingly.
2024-11-25 21:26:13 +02:00
Pauli Virtanen
e08846dc9c alsa-card-profiles: move HDMI/AC3 profiles to separate profile set
These shouldn't be enabled by default, because they cannot be
autodetected, and if the configuration is not a supported one, they
produce loud BRRRT at 100% volume and ALSA errors.
2024-11-23 14:58:17 +02:00
Pauli Virtanen
c36c028dd2 pw-dump: don't emit remove events when not monitoring
When pw-dump is called without --monitor, it should output exactly one
JSON array, and no remove event indicators.
2024-11-23 12:11:33 +00:00
Pauli Virtanen
603c67628e bluez5: fix BAP route non-deviceset availability
Fix issue where BAP routes are marked unavailable for devices not in a
device set.

Fixes: a154169942
2024-11-23 11:25:46 +02:00
Philip Withnall
88873e295b build: Explicitly disable -Werror=strict-aliasing
Pipewire is designed to be built without strict aliasing enabled (as
evidenced by already hard-coding `-fno-strict-aliasing`). In case people
have strict aliasing warnings enabled by default in their build
environment, explicitly disable errors from those.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-11-22 16:24:51 +00:00
Philip Withnall
89a605b7a2 filter-graph: Remove duplicate install keyword from meson.build
This fixes building with `--fatal-meson-warnings`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-11-22 16:24:51 +00:00
Arun Raghavan
90075b838c spa: alsa: Try to initialise card_index from path if needed
If the PCM is loaded directly using only api.alsa.path,
state->card_index may never be initialised, and then we end up opening
the wrong ctl device. Let's try a fallback for this case.
2024-11-22 10:36:26 -05:00
Wim Taymans
ae37dd7773 doc: fix the SPA POD enum docs
The first argument should be the element count.
Fix the format for float, it should be with captial F.
2024-11-22 14:58:16 +01:00
Wim Taymans
ae465ccbfc stream: fix EARLY_PROCESS again
It got removed with the async improvements. We shouñd simply ask more
buffers whenever we push one to be dequeued.

See #3480
2024-11-22 12:22:14 +01:00
Wim Taymans
e1fc3de595 modules: use pw_stream_set_rate() some more 2024-11-22 09:55:36 +01:00
Wim Taymans
804df3389a modules: use pw_stream_set_rate() when we can 2024-11-22 09:49:27 +01:00
Wim Taymans
433afeaa1e stream: add function to set adaptive resampler rate
Make a function to set the adaptive resampler.
2024-11-22 09:29:53 +01:00
Wim Taymans
188d920733 pass the right types to the methods
This currently works because we accept void* for these functions but it
will fail when we will use the real types.
2024-11-20 10:17:37 +01:00
Pauli Virtanen
e393e57a26 pulse-server: ensure positive stream delay in GET_PLAYBACK/RECORD_LATENCY
Pulseaudio protocol requires stream latency is uint64. Clamp the
Pipewire signed latency to the range, better than wrapping around.
2024-11-19 22:07:09 +02:00
Wim Taymans
a997627906 impl-node: save all previous timestamps on start
When the driver starts, save all previous node timestamps, not just the
previous signal time.

For async nodes, uses the previous timestamps in the profiler messages
so that we get stats with 1 cycle of delay instead of bogus values
because the node is still processing.

Fixes pw-top for async nodes.
2024-11-15 18:06:12 +01:00
Wim Taymans
1084cc24b6 alsa: handle the case where the driver is destroyed
When the driver node is destroyed (like when unplugging the cable) it
will drop/pause all of the follower ALSA nodes. This is something that
happens internally because of how the ALSA nodes work together, on the
PipeWire level, the nodes are still running and they will just be moved to
another driver.

The problem is that nothing will then start the nodes again after moving
it to the new driver. Fix this by keeping track of the desired target
state of the ALSA node and restoring that state when we detect that we are
paused when moved to a new driver.

Fixes #4401
2024-11-15 16:09:36 +01:00
Wim Taymans
3b51dbba1c filter-graph: improve output port number calculations
When no output ports are given, use the number of graph outputs, which
needs to take into account the number of times we duplicated the graph.
2024-11-15 12:21:49 +01:00
Wim Taymans
3b27ff0c71 doc: fix spa_pod_parser_get_object example 2024-11-15 12:09:19 +01:00
Wim Taymans
f261b2f96f filter-chain: update channels from filter-graph
Add a filter-graph info structure with the number of inputs and outputs
in the graph definition.

Use the input/outputs to update the number of channels on the capture and
playback streams when not explicitly given. Also copy over the positions
when they match the other stream and were not explicitly specified.

Fixes #4404
2024-11-15 10:53:45 +01:00
Wim Taymans
8c59fae42d loop: add overflow queues again
Add the overflow queues again. We can easily iterate atomically over the
overflow queues and flush them.

Overflowing a queue is quite common when heavy swapping is done and
should never cause a lockup, so allocate new queues as we need them. We
can share the eventfd with the main queue to avoid wastings fds.

The limit on the number of queues is then only for when concurrent
threads want to invoke things, so 128 is plenty enough.
2024-11-14 17:38:43 +01:00
Michael Olbrich
687075f2bd gst: handle interlace mode
If the peer announces an interlace mode then use it. Otherwise assume
that the video is not interlaced.

This also fixes a problem with caps negotiation:
If downstream reports caps with not fixated interlace mode, e.g.
"interlace-mode=(string){ progressive, interleaved, mixed }"
then without this, the caps handle_format_change() (in the pipewiresrc)
are not fixed and the source waits forever for the negotiation to
finish.
2024-11-14 17:18:28 +01:00
Wim Taymans
6cf320e387 loop: handle queue overflow better
When a queue overflows we place the queue back in the stack and try
again. Because it's at the top of the stack we take exactly the same
queue and keep on looping forever if the other thread is blocked for
some reason.

Instead, mark the queue as overflowed and only place it back in the
stack when we have flushed it.

This avoids a deadlock when the main-thread invokes on the data loop
and blocks and when the data loop invokes on the main-thread and
overflows the queue.
2024-11-14 15:58:09 +01:00
Wim Taymans
bb2d848bf6 impl-node: don't remove from graph when creating
When we were in the CREATING state, don't remove ourselves from the
graph because we were not added yet.
2024-11-14 15:56:57 +01:00
Wim Taymans
d32ab4d8ea alsa: remove unused variable 2024-11-14 12:03:55 +01:00
Wim Taymans
0833b19a75 module-vban: fill some default channel layouts
VBAN does not really transmit any channel layouts so make some
assumptions about the layout when not explicitly specified.
2024-11-14 11:07:05 +01:00
Wim Taymans
2ad8904ac8 spa: update the UNPOSITIONED flag
When we can't parse valid positions, make sure the UNPOSITIONED flag is
set for raw audio info.
2024-11-14 11:06:11 +01:00
Wim Taymans
388f330700 module-vban: add stream.rules support
Make it possible to match the new VBAN streams on ip/port/name and media
properties and create a stream with custom properties.

See #4402
2024-11-14 09:59:12 +01:00
Wim Taymans
1a5514e5cf module-vban: create streams per stream_name
Always listen on the receive socket. Find the stream with the given
stream_name of the packet and create it if it doesn't exist.

Also take the sample-rate, channels and format from the packet
parameters instead of the config.

Fixes #4400
2024-11-13 16:47:34 +01:00
Wim Taymans
567b484386 filter-chain: move the filter-graph to plugins 2024-11-13 11:12:06 +01:00
Wim Taymans
2e157f7248 filter-chain: make filter-graph SPA plugins
Make SPA plugins from all the filter-graph plugins and use the plugin
loader to load them.

Because they are not in the standard plugin path in development, add
the module dir to the plugin path for now.
2024-11-13 10:20:54 +01:00
Wim Taymans
201455eecd filter-chain: don't link plugins to libpipewire
Reorganize some things so that we only link the pipewire module to
libpipewire. We don't need to link the filter-graph plugins to pipewire
anymore.
2024-11-12 16:32:54 +01:00
Wim Taymans
c3e668049b filter-chain: pass quantum-limit to plugins 2024-11-12 16:11:51 +01:00
Wim Taymans
13b8e3a75d filter-graph: Make dsp-ops and interface
Rename dsp-ops to audio-dsp and make it a SPA interface.

Pass the audio-dsp interface around with the support.
2024-11-12 15:54:28 +01:00
Wim Taymans
0a71911796 filter-chain: move the plugin to an audio-plugin
Make an interface of the audio plugins.
2024-11-12 12:51:15 +01:00
Wim Taymans
c8c89f7517 pulse: also set channels in the map
When converting a position to a channel-map, copy the number of channels
as well.

This broke with commit e2991f6398
2024-11-12 11:55:14 +01:00
Wim Taymans
22f7a1de28 filter-chain: move filter-chain to a spa_interface
Move the filter-chain code to a filter-graph SPA interface.

The idea is to make this more useful outside of the filter-chain.
2024-11-12 11:32:58 +01:00
Wim Taymans
d17c3fb72d filter-chain: move some biquad functions around
Make just 1 biquad function in dsp-ops.

Move the implementation prototypes to a separate header.
2024-11-11 17:59:10 +01:00
Wim Taymans
aad3d1eafa filter-chain: improve biquad run a little
We only need to copy source to dest on the first run.
2024-11-11 16:41:17 +01:00
Wim Taymans
02edfba21a filter-chain: don't let plugins depend on pipewire, just spa 2024-11-11 16:36:09 +01:00
Wim Taymans
44340fde05 module-rtp: allocate receive buffer based on MTU
Use the MTU to allocate the receive buffer instead of using a hardcoded
size.

Fixes #4394
2024-11-11 12:03:32 +01:00
Wim Taymans
a53bc035c0 module-rtp: calculate payload_size based on MTU
The actual payload size depends on the MTU but should not include the
IP/UDP and RTP headers.

Fixes #4396
2024-11-11 11:49:20 +01:00
Anders Jonsson
73b5a10021 po: Update Swedish translation 2024-11-11 08:21:02 +00:00
Wim Taymans
bebad7888f gst: take the thread lock before calling pw_stream functions 2024-11-08 12:22:35 +01:00
Wim Taymans
1661f15b9c filter-chain: pass dict in plugin load function
So that we can pass some more properties around and remove the
quantum_limit hardcoded value.
2024-11-07 16:40:38 +01:00
George Kiagiadakis
c7854e1da4 filter-chain: move dsp_ops pointers to dynamically allocated memory
Make a plugin structure that is dynamically allocated for each plugin
and pass it around to the descriptor instance structures, so that they
all have access to dsp_ops without sharing a static pointer.

The problem with the static pointer is that the dsp_ops structure is
actually allocated in module-filter-chain's instance structure,
so it always points to the instance of the last filter-chain that was
loaded in the process. When this is unloaded, the other filter-chains
crash.
2024-11-07 15:15:03 +00:00
Wim Taymans
b2dd733520 v4l2: Add mmap fallback when USERPTR is not supported
When we don't support EXPBUF according to the probe, the host will
allocate memory for us. We will then try to use USERPTR to import the
memory into v4l2.

If this is not supported, try to fall back to MMAP support, mmap the
buffers and memcpy the MMAP buffer to the host allocated buffers.
2024-11-07 15:55:38 +01:00
Wim Taymans
c4df4a0371 v4l2: improve debug a little 2024-11-07 15:55:38 +01:00
Wim Taymans
b9df297e2a v4l2: use a separate flag to skip the first buffer
The buf.sequence value might stay to 0 (v4l2loopback)
2024-11-07 15:55:38 +01:00
Wim Taymans
877c262e78 v4l2: probe number of buffers as well
Instead of just probing with 2 buffers, probe with the MAX_BUFFERS and
remember how many buffers we received.

Some drivers (v4l2loopback) work with less than MAX_BUFFERS (8) and we
need to set the max number of buffers in the Buffers param.
2024-11-07 15:55:33 +01:00