Commit graph

13374 commits

Author SHA1 Message Date
Sam James
edcecd8975
meson.build: drop -Wno-error=strict-aliasing
This was added in error (88873e295b) but
we discussed it in !2180 and it turned out CFLAGS="... -fstrict-aliasing"
was set in the environment, overriding the earlier -fno-strict-aliasing
already set in meson.build (which we're keeping here).

That is, when -fno-strict-aliasing is in-effect, there's already no
need for -Wno-error=strict-aliasing (as the warnings aren't emitted), but
if there *is* a need for a -Wno-error=strict-aliasing for a user, it
means they're (likely unintentionally) enabling strict-aliasing and we
certainly want to make them aware of that.
2025-01-24 06:15:05 +00:00
Arun Raghavan
d186297745 meson: Bump webrtc-audio-processing to v2.1
No major changes, but should make some usage as a subproject work more
reliably.
2025-01-23 11:57:11 -05:00
Arun Raghavan
800cd53c56 gst: sink: Whitespace fixups 2025-01-23 10:17:19 -05:00
Arun Raghavan
9ece286c90 gst: Fix up some debug logs
Copy-pasto in the pause code, plus let's use GST_DEBUG_OBJECT() so
we can track which pool is affected.
2025-01-23 10:17:19 -05:00
Wim Taymans
9e2a494d05 jack: add a UMP source example 2025-01-23 15:53:17 +01:00
Wim Taymans
ae758885dd 1.3.81 2025-01-23 09:52:29 +01:00
Wim Taymans
a2824b6773 po: Update Slovenian (sl) translation
Fixes #4522
2025-01-23 09:51:39 +01:00
Sanchayan Maity
6e67b3a2d7 bluez5: media-sink: Use correct profile name for ASHA 2025-01-23 10:13:48 +05:30
Wim Taymans
de7016f155 filter: mark RT safe methods 2025-01-22 15:21:40 +01:00
Wim Taymans
122170ad62 stream: mark functions with RT safe
Add some docs about the process function being a realtime thread and
mark the functions you can call in realtime threads.

Fixes #4521
2025-01-22 13:04:59 +01:00
George Kiagiadakis
d0b3c00d29 bluez: enable delay reporting for a2dp-source
This allows our a2dp-source (sink endpoint) to report delay to the
remote source endpoint. Setting the "Delay" property is already
implemented, but by failing to configure DelayReporting, bluez rejects
the property change.
2025-01-21 16:11:08 +00:00
Wim Taymans
96d593cc34 rtp: idle the source when in timeout
Idle the source when no packets are received and resume when new packets
arrive.

Add a stream.may-pause property to pause the stream when no packets are
received during the timeout window.

Make sure the rtp.streaming property is updated correctly and as soon as
we get the first packet.

Fixes #4456
2025-01-21 16:51:31 +01:00
Arun Raghavan
980d37fb80 audioadapter: Trivial whitespace fix
Makes an annoying clang warning about mismatched indents.
2025-01-21 10:47:14 -05:00
Wim Taymans
a44afd84ff sap: only send bye + new SAP when SDP changed
Reorganize some code to separate the creation and sending of the SAP
message.

Check if when the node changed, we have an actual change in the SDP
before we send BYE and the new SAP message. It's possible that nothing
changed, for example when the node simply changed state or an unrelated
property.
2025-01-21 15:43:10 +01:00
Arun Raghavan
e57a01594e audioconvert: Only use rate_scale when working at DSP rate
In convert mode, we will be resampling directly to the output rate, so
don't try to scale to driver rate.
2025-01-21 08:50:43 -05:00
Andrew Sayers
db972b5bc1 Downgrade snd_pcm_mmap_commit error to warning 2025-01-21 11:20:23 +00:00
Wim Taymans
d2c2276088 adapter: pass follower direction to converter
Partially revert 86af9de739

The PortParam does not give enough information to derive the direction
of the converter. If the converter is configured in convert/convert
there is just no way to know when to output a quantum or not.

Fix this by doing a quick probe of the follower and then pass the
direction to the converter.

See !2227
2025-01-21 11:43:11 +01:00
Wim Taymans
4b24619160 rtp-source: avoid bitfield races
The different bits are written to from different threads.
2025-01-20 14:00:21 +01:00
Wim Taymans
7da9c2b25d examples: surround loop_iterate() with enter() and leave()
See #4476
2025-01-20 12:00:02 +01:00
Wim Taymans
b97dd00f26 loop: add some more docs about loop_control
Add a gmainloop integration example.

See #4467
2025-01-20 11:48:07 +01:00
Wim Taymans
78649b12f6 thread-loop: clarify some docs about locking 2025-01-20 10:04:09 +01:00
Wim Taymans
b4c9135799 filter-graph: also support float fequency
Parse the frequency as string and then try to convert it to float so
that it also supports float frequencies.

See #4418
2025-01-20 09:55:42 +01:00
Pauli Virtanen
29a6552cc9 bluez5: take fractional resampler delay into account for reference time
Improve sample reference time accuracy by including the fractional part
of the resampler delay.
2025-01-19 17:11:13 +02:00
Pauli Virtanen
5f21ee8669 audioconvert: add delay_frac to spa_io_rate_match
Report the "fractional" part of the resampler delay in
spa_io_rate_match::delay_frac, in nanosamples (1/1e9 sample) at node
rate.

The delay values are best reported in units where it is clear what the
clock domain is, so report the value in fractional samples instead of
nanoseconds. Conversion to ns is also just dividision by the appropriate
rate.
2025-01-19 17:11:13 +02:00
Pauli Virtanen
f3a9ebd569 audioconvert: resampler: change resample_phase() unit to input samples
Report fractional delay in input samples instead of nsec at the nominal
input rate, as that is closer to what the value actually means.
2025-01-19 17:11:13 +02:00
Wim Taymans
9889d1ce0a alsa: close the sequence on error. 2025-01-19 15:56:01 +01:00
Wim Taymans
e4fc8d43bb alsa: handle error from _set_client_midi_version()
See #4507
2025-01-19 15:52:48 +01:00
Pauli Virtanen
eb91f097d9 audioconvert: resampler: fix off-by-one issues
Resampler without prefill was sometime outputting with different delay
than with prefill. Adjust initial history by 1 which seems to bring it
more in line.

The resampler phase also appears to depend on how many samples remain in
history which leads to possibly unexpected +-1 variation. Take this into
account in reported phase.

These changes make the resampler delay tests pass.

Both changes are sort of empirical --- I don't fully understand why
these would fix things but they seem to be needed to make the delay
calculations agree with what the resampler outputs.
2025-01-17 19:10:43 +02:00
Pauli Virtanen
79384530b5 audioconvert: resampler: add more resampler delay tests
Test also conversions between different rates, and with and without
prefill.
2025-01-17 19:10:43 +02:00
Pauli Virtanen
07f6dde3dd audioconvert: add function to get phase to resampler API
Support getting any fractional phase part of the resampler delay in its
API.
2025-01-17 19:10:43 +02:00
Wim Taymans
d36a867788 gst: only return the custom flag when in _render()
Make a custom ACQUIRE flag and if it's set, return the custom error
when the pool is empty.
2025-01-17 17:08:07 +01:00
Wim Taymans
c7ccc5abca gst: handle blocking in the _render() function
When we do any other blocking in the render function, we should unblock
and call _wait_preroll() when we go to PAUSED.

We can have this situation when all the buffers are queued in the
pw_stream and we get a new _render() call. We can't get more buffers
from the pool and so we must block and wait.  When we go to PAUSED we
need to unlock and go to _wait_preroll(). Implement this by setting a
pool paused flag that is set when the sink goes to paused, we can then
return a special value that does the wait_preroll().

See !2248
2025-01-17 16:33:15 +01:00
Wim Taymans
85c5d65c97 audioconvert: only consume from input what the resampler used
Keep track of the consumed samples from the input and use that to update
the in_offset. The resampler can tell us how much samples were used.
2025-01-17 12:20:06 +01:00
Wim Taymans
c81910a51c gst: use gst_buffer_get_size() to get the buffer size
_get_sizes() contains the padding and we don't want to copy that.
2025-01-17 12:19:07 +01:00
Taruntej Kanakamalla
86e7429039 gst: pipewiresink: don't flush bufferpool in PLAYING_TO_PAUSED
Setting bufferpool to flushing state in PAUSED state is preventing the
buffer flow if there is a seek/flush event.
Instead, set the bufferpool to flushing during the `flush-start` event
and clear it during the `flush-stop`

Deactivate/activate the stream during flush event only if the sink is
in the PLAYING state. In the PAUSED or READY state, the stream would be
inactive and we do not want to alter that
2025-01-17 13:03:34 +05:30
Wim Taymans
c62905d911 pulse-server: clear old data when jumping forwards
When we write samples, check if we make a jump in the ringbuffer and
clear the samples we jumped over.

If we don't do this, the reader side might pick up old samples that we
didn't write or clear but that are now available for reading after we
made a jump in the ringbuffer.

This migh not be exactly what pulseaudio does but it is good for now.

Fixes #4464
2025-01-16 16:21:22 +01:00
Wim Taymans
cf7e917024 pulse-server: make a function to silence a buffer 2025-01-16 16:16:39 +01:00
Taruntej Kanakamalla
c0a6a7ea32 gst: handle flush event in pipewiresink
flush the pw buffers to the stream's queue during a FLUSH_START event
and return the unqueued pw buffers, if they are dropped/released without
being rendered, so they can be available to be dequeued for the subsequent
`acquire` calls
2025-01-15 17:03:21 +00:00
Taruntej Kanakamalla
b70e99c41a stream: new api to return unused buffer
Push the buffer back to `dequeued` in case of playback and capture.
This will help avoid starvation during events like seek/flush
2025-01-15 17:03:21 +00:00
Wim Taymans
f914cf9327 audioconvert: the delay of the resampler is in input rate
The resampler needs ntaps/2-1 (delay) input samples to produce 1 output
sample so the delay is measured in input rate.
2025-01-15 17:02:39 +01:00
Wim Taymans
0913b3ef7b audioconvert: report delay in input rate
The delay is always expressed in samples at the output rate of the
resampler. For input streams we need to convert this to the expected
input rate.

Make the delay reporting in playback streams more accurate.
2025-01-15 15:25:49 +01:00
Wim Taymans
24bcacc619 conf: remove client-rt.conf
We now automatically move non-rt clients into non-rt threads so the
client-rt.conf is obsolete.

Move the module-rt in client.conf and add conditions to disable modules.

Transparently load client.conf in case applications still specify
client-rt.conf.

Custon configuration in the client-rt.conf.d/ should be moved to
client.conf.d/
2025-01-14 12:40:05 +01:00
Pauli Virtanen
b952cfbe38 bluez5: remove resampler delay fudge factor
The resampler delay was off by one sample, so remove the corresponding
fudge factor here.  This matters for BAP output synchronization.

The resampler has also some fractional delay, so there can still be
sub-sample offset between the original and resampled timelines.  This is
not currently taken into account.
2025-01-13 19:05:58 +02:00
Pauli Virtanen
2c2bed2aeb audioconvert: fix resampler delay value and add test
Resampler delay for N taps is N/2-1 input samples.

Add test that checks this.

When input rate is varying, the resampler also accumulates additional
sub-sample delay. The resampler does not currently have API to report
the instantaneous sub-sample delay.  Add knownfail test for it.
2025-01-13 19:05:58 +02:00
Wim Taymans
049ab37a6d audioconvert: only deactive old filter when new filter loaded
When we fail to load the new filter, keep the old filter active or else
we will cause a crash when we clean up the old graph.
2025-01-13 16:58:28 +01:00
Wim Taymans
0868ff1ada math: improve denormal check
Use isnormal() when we can
2025-01-13 16:10:34 +01:00
Wim Taymans
73e11eea46 audioconvert: add wav stage only when needed 2025-01-13 15:39:32 +01:00
Pauli Virtanen
08700a9eb5 pipewire: use local real time timestamps in logging
Wireplumber and other system services use local real time timestamps in
logging, so it's more convenient if also PW uses them.

Add env var for selecting the timestamp type, default to "local".
2025-01-13 13:48:22 +00:00
Pauli Virtanen
1ec814977c logger: support logging local timestamps and other timestamp logs
In timestamps, support different clocks and local time as formats.

Local real time timestamps are useful when trying to correlate logs from
different sources.
2025-01-13 13:48:22 +00:00
Philippe Normand
13c869801c gst: core: Fixup connection error handling
Commit b57b5703d6 made use of `spa_strerror()`
which is incorrect here because pw_connect sets `errno`, so we should use
`strerror()`.
2025-01-12 11:42:29 +00:00