Commit graph

12894 commits

Author SHA1 Message Date
Wim Taymans
27961630a6 jack: actually clear the mix io
When we are asked to clear the mix io areas, actually do it, otherwise
the process thread might still be accessing the old memory and crash.

Also check that we have set io on the port before we decrement the
counter with active io or else we have a negative value and cause
problems later. This can happen when we susupend and set io to NULL but
there was never any io set on the port.

Fixes #4337
2024-10-06 12:36:18 +02:00
Wim Taymans
0db2171cd9 alsa: dynamically adjust the DLL bandwidth
Keep a running average and variance of the error. Use this to
periodically update the DLL bandwidth. When the variance gets smaller,
we update the DLL more slowly to stay closer to the ideal rate.

This seems to improve the rate stability.
2024-10-04 10:47:47 +02:00
Wim Taymans
d1efc9c2c6 tools: improve profiler -J output
Put the newline and comma right after printing the line so that it gets
flushed immediately. Otherwise we only see the last line in the next
cycle. We then need to end the JSON output with an empty object.

Pretty print the node status instead of the value.
2024-10-04 10:42:38 +02:00
Arun Raghavan
e6bcc415fc acp: Trim trailing whitespace in monitor name from HDMI ELD
The ELD ends with a \n and spaces to pad the length, but most drivers
except NVidia trim that out while presenting to userspace. While this is
being tracked upstream [1], let's deal with this locally.

[1] https://github.com/NVIDIA/open-gpu-kernel-modules/pull/715

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4332
2024-10-02 17:02:11 +00:00
Wim Taymans
3efa3483db impl-node: pass the RequestProcess command around as is
Convert the RequestProcess event to a command and send this to the
driver node. This ensures that any future properties on the Event will be
passed to the Command as well, such as timestamps etc.

Save the complete RequestProcess command when we need to send it later
when the node is RUNNING so that we preserver the properties.
2024-10-02 16:18:44 +02:00
Wim Taymans
242e530aeb stream: add pw_stream_emit_event()
Make a function to emit an event from a stream. Use this function
internally to emit the RequestProcess.

Make the RequestProcess event construction a little more efficient.
2024-10-02 16:17:17 +02:00
Wim Taymans
5db02df08c spa: fix event pod type 2024-10-02 16:11:02 +02:00
Wim Taymans
c05f03c7da keys: improve comments and indentation 2024-10-02 12:46:39 +02:00
Wim Taymans
81a2a7087b filter-chain: improve sofa plugin debug 2024-10-02 09:52:13 +02:00
Wim Taymans
dca11e6c41 loop: remove extra allocation
We don't actually need the extra allocation for the tss. We can just
mark the queue as being in the tss. When a queue is destroyed, mark it
as destroyed but when it is still in the tss, don't free the structure
yet. We free the structure when we destroy the tss.

We can also free the overflow queues of a queue when it is destroyed
immediately.
2024-10-02 09:40:54 +02:00
Wim Taymans
5d3aac313d loop: free tss from the thread calling impl::clear
The thread that calls the impl_clear method might be the main thread and
is certainly not going to call the invoke function anymore so free the
tss if there is any.

Fixes a leak in the unit test.
2024-10-02 09:21:00 +02:00
Torkel Niklasson
75566a238f modules: fix flag setup in combine-stream
When combine-stream initiation code was moved around in b46673b4, a
bitwise or of flags was accidentally dropped, and thus flags were
overwritten instead of added to.
2024-10-02 05:31:58 +00:00
Barnabás Pőcze
1a549c02a5 acp: do not overwrite properties of PCM with that of the card
The properties of the card might overwrite those of the PCM.
For example, the cards's `alsa.id` will be set on the PCM too
since 37a51533e0 ("acp: add more properties for the card").

To avoid that, call `pa_alsa_init_proplist_card()` first
in `pa_alsa_init_proplist_pcm_info()` instead of last.

See #4135
2024-10-01 22:50:12 +02:00
Wim Taymans
2a4840b991 filter-chain: accumulate node param changes
Don't just look at the last set parameter to decide if the node
parameters changed but or all results together.

Fixes #4331
2024-10-01 19:04:02 +02:00
Wim Taymans
82585b7475 loop: improve tss cleanup
Store a pointer to a pointer to a queue in the tss and point to it from
the queue.

When we destroy the queue when we _clear the support, we can clear the
pointer in the tss as well. This way, when the thread is later
destroyed, it will see the NULL pointer and not try to free the queue
again.
2024-10-01 13:25:15 +02:00
Wim Taymans
9b80855821 impl-node: make exported nodes complete state change sync
Don't queue an async state change completion for exported nodes. The
server sends a ping to check for completion and we want this ping reply
to happen after the state completion.

Consider the case where we have a follower and a driver, the follower is
sent the Start/Ping commands and replies to the ping but is still
processing the state change async. The server can then Start the driver,
which will then try to schedule the (still starting) follower and fail.

We could add the ping to the work queue as well but that creates
complications because modules (clients) and server share the same work
queues right now and block each other completions.

We could also make a method to process the work queue immediately but
that would be dangerous as well because it could contain a BUSY item
from some module that would block things.
2024-10-01 10:44:12 +02:00
Wim Taymans
273a2b65a2 examples: improve the ring2 example
Make a function to make a block of samples that we then push into the
ringbuffer. This should match more with what audio backends need to
handle.
2024-09-30 16:14:37 +02:00
Wim Taymans
63747e2e40 examples: add another ringbuffer example
This one use a thread-loop and uses a blocking push into a ringbuffer.
2024-09-30 15:37:38 +02:00
Wim Taymans
9e932ec671 pulse-server: set pulse.corked on streams
Set the corked state on streams so that we can use this in sink-input
and source-output info without guessing.

The problem is that when a stream starts un-corked, the state is less
than RUNNING and so before this patch, pulse-server reports a corked
stream, which is not what pulseaudio reports.
2024-09-30 15:02:08 +02:00
Wim Taymans
404817592b module-rtp: don't confuse time and samples
Round down the target_buffer size to a psamples multiple. Don't try to
mix time and sample units for this.

Fixes #4327
2024-09-30 10:44:51 +02:00
Wim Taymans
0ca64277b3 spa: initialize all fields explicitly
Patch by Petar Popovic

Fixes #4325
2024-09-30 10:06:30 +02:00
sunyuechi
245adda985 fmt-ops: add RVV optimizations for s32_to_f32d 2024-09-29 11:17:42 +08:00
Wim Taymans
0e5d8fdc3b po: fix translation 2024-09-27 12:55:09 +02:00
Jonas Holmberg
648badb427 properties: Fix memory leak
Do not initialize changes in update_string() if
spa_json_begin_object_relax() fails to avoid having to clear changes
before returning.
2024-09-27 11:59:54 +02:00
Wim Taymans
d8f0cc7817 jack: take the right locks when modifying globals. 2024-09-26 16:42:20 +02:00
Wim Taymans
f759bb68f5 jack: free ports and cached objects
Free the client ports when closing.

Move the per client cached objects to the global cache.

Free the per-client cached mix and ports.

Add a destructor that frees the cached global objects.
2024-09-26 16:24:00 +02:00
Wim Taymans
18e1da54bd module-rt: first join and then free memory
First join the thread and then free the memory or else we might free the
memory while the thread is starting up and we crash.
2024-09-26 16:21:32 +02:00
Wim Taymans
fe3dc58c89 connection: fix fd leaks and confusion
When we receive a message with fds and we are at the end of the
buffer, we will call clear_buffer, which moves the next fds over the
fds of this message before we copy the fds into the message. This
results in the fd being leaked and the message using the fd of the next
message instead.

Avoid this by first copying the fds into the message and then move the
new ones over the old ones.

This fixes some wrong fds being used by clients.
2024-09-26 13:10:15 +02:00
sunyuechi
79d41e183e fmt-ops: add RVV optimizations for f32d_to_s32 2024-09-26 00:55:49 +08:00
Wim Taymans
c7c5b61dac jack: use the CPU max_alignment
Instead of aligning the buffers to 16 bytes, use the CPU max_align
value (32 on intel).

Move the mix function from a static global variable to a per client
member because this could change per client.
2024-09-25 15:16:25 +02:00
George Kiagiadakis
fbbe983a05 rtp-sap: make the receive socket listen only to the configured sap.ip
In line also with da8e207de9,
make sure that the rtp-sap receive socket listens only to the configured
sap.ip in unicast mode, instead of accepting all packets on the port.

This additionally fixes breakage that was inadvertently introduced in
f2f204d604. Because the
`struct sockaddr_storage *sa` argument in `make_recv_socket` points
to `impl->sap_addr`, changing the address to INADDR_ANY in the unicast
code path would also silently cause the sender socket to try to
connect to INADDR_ANY and fail.
2024-09-25 10:55:28 +00:00
George Kiagiadakis
88dff1c021 rtp-sap: announce the source IP as the "connection" address in unicast
The "connection" address ("c=") is meant to be the address that the
RTP receiver will use to filter for incoming packets. In multicast,
it must be the multicast address, which is also the "destination"
address in this context. In unicast, however, it must be the sender's
address, i.e. the "source" in this context. The RTP receiver will
then call connect() on this address, effectively filtering the incoming
packets to the ones coming from that particular source.
2024-09-25 10:55:28 +00:00
Arun Raghavan
daec898251 profiler: Add an option to reduce sampling interval
Allows us to get error counts and occasional samples, which can be handy
if we are CPU-bound. There is room to improve this by having
module-profiler create aggregates, which might be more useful that
periodic instaneous samples. However, this would need more logic to
store node data in between emissions, so we'll punt that to later.
2024-09-25 10:52:36 +00:00
sunyuechi
74832445ba fmt-ops: add RVV optimizations for s16_to_f32d 2024-09-25 10:50:05 +00:00
sunyuechi
588f2bcb69 RISCV: Improve scalar computation of f32d_to_s16 2024-09-25 10:50:05 +00:00
Wim Taymans
4513aceaad spa: avoid C23 empty initializers in the headers
Patch by Petar Popovic to avoid using empty initializers in headers.

Fixes #4317
2024-09-25 10:58:11 +02:00
Alper Nebi Yasak
d42bfa56b7 acp: sync the mixer after selecting the port
Otherwise we might sync the wrong port and end up muted.

Fixes #4084
2024-09-25 10:02:46 +02:00
Wim Taymans
ed0556e34c jack: Improve transport BBT handling
The bar can start from 0 in JACK.

Add bar_start_tick and ticks_per_beat to the io_segment_bar so that we
can losslesly store the complete jack BBT values.

See #4314
2024-09-24 18:43:33 +02:00
Wim Taymans
99c23d5b0e acp: add api.alsa.disable-mixer-path
Don't use the api.alsa.soft-mixer option to disable the path selection
but make a new api.alsa.disable-mixer-path.

Disabling the path selection might leave cards unusable after suspend,
so a separate option is a better idea.

See #4311
2024-09-24 13:14:17 +02:00
Wim Taymans
e9c5ca5978 video-src: simplify the tag param construction 2024-09-24 11:11:22 +02:00
Wim Taymans
2ab773ce14 stream: emit the Pause command early
Don't wait for the completion of the Pause command of the node but send
it to the stream immediately. Delaying it might make it come after the
set_param calls are done and confuse the stream.
2024-09-24 10:50:14 +02:00
Wim Taymans
7e436ad499 impl-link: also handle unprepared active links
An ACTIVE link going to < PAUSED is unprepared.
2024-09-24 10:46:21 +02:00
Wim Taymans
63b4728d80 docs: update pw-cli docs for do_link
Fixes #4272
2024-09-23 15:55:13 +02:00
Wim Taymans
b5f9409c12 pw-cli: implement unload_module
Fixes #4276
2024-09-23 15:46:33 +02:00
Wim Taymans
322829cb2e acp: disable path_select when using soft-mixer
When using the soft mixer we should not use path_select because that one
will also touch the mixer and try to mute some switches.

Fixes #4311
2024-09-23 15:34:08 +02:00
Wim Taymans
e095a1c4ac examples: improve the ringbuffer example a little
Write the remaining samples in the ringbuffer and fill up the rest with
silence.

Add some more comments.
2024-09-23 11:28:16 +02:00
Wim Taymans
ca488a5dcc pulse-server: add quirk to block record and playback streams
Add aquirk to block any record or playback stream.
2024-09-23 10:56:40 +02:00
Wim Taymans
4b9db9492e json-pod: add error checking version of json to pod
Add an error checking version of the json to pod converter and use that
in pw-cli to report about json parsing errors.
2024-09-23 10:12:56 +02:00
sunyuechi
8a8843ba20 fmt-ops: add RVV optimizations for f32d_s16 2024-09-23 08:10:43 +00:00
sunyuechi
852de6c35c fmt-ops: add RVV optimizations for f32d_s16d 2024-09-23 08:10:43 +00:00