Commit graph

14239 commits

Author SHA1 Message Date
Pauli Virtanen
02d5d9bc1f bluez5: sco-io: remove unnecessary variable 2025-07-12 19:59:33 +00:00
Pauli Virtanen
87843366ce bluez5: add PLC for MSBC using spandsp
Use spandsp as optional dependency for MSBC codec, for providing PLC.
2025-07-12 19:59:33 +00:00
Pauli Virtanen
90a1b35017 bluez5: media-source: support codec-provided packet loss concealment
If packet sequence number jumps ahead, or we would underflow, use
codec-provided packet loss concealment to produce some audio data.

When we produce it during underflow, skip the corresponding number of
sequence numbers of future packets.

If codec doesn't have PLC, keep the previous behavior (pad with zeros,
buffering pauses to wait for data).
2025-07-12 19:59:33 +00:00
Pauli Virtanen
d0680a2b3d bluez5: support packet loss concealment in codecs
LC3 and Opus have built-in support for packet loss concealment.

Add codec interface for that, and implement for LC3.

Extend media_codec interface so that packets not aligned with socket
reads can be handled, as in HFP. This is required for correct sequence
number counting, and for being able to run codec PLC *before* decoding
the next correctly received packet.
2025-07-12 19:59:33 +00:00
Pauli Virtanen
a2ede93479 bluez5: report ISO latency correctly and refresh when transport starts 2025-07-12 19:57:22 +00:00
Pauli Virtanen
5e79d0fb01 bluez5: fix compilation and warnings 2025-07-12 19:57:22 +00:00
Pauli Virtanen
d10249d0ce bluez5: allow faster rate matching
Bump up DLL maximum rate difference and reduce averaging time.
2025-07-12 19:57:22 +00:00
Pauli Virtanen
2c70c13cc3 bluez5: rate match ISO only from process()
Update rate matching only once per process(). This ensures all nodes in
the group update their rate matching in the same way.

Also account for audio data in ISO output buffer in the reference time.
2025-07-12 19:57:22 +00:00
Pauli Virtanen
ad90a2d0ac bluez5: take clock rate difference into account in get_reference_time()
The calculations is in system clock domain, so when converting from
samples/duration to time rate difference should be accounted.

This does not have much effect in practice.
2025-07-12 19:57:22 +00:00
Pauli Virtanen
30047f232b bluez5: account for driver clock rate difference in rate matching
The rate matching calculations are done in the system clock domain.  If
the driver ticks at a different rate, the correction factor needs to be
adjusted by the rate_diff.

This fixes ISO streams getting out of sync with each other when target
delay changes. This happens because typically one of them is the driver
and the other follower. Driver adjust clock rate, and follower does its
own adjustment *on top of that* so it rate matches more or less at
double speed.  (The DLL of the follower to some degree corrects for
this, but can't do that when hitting RATE_CTL_DIFF_MAX and moreover it
acts with a delay.)
2025-07-12 19:57:22 +00:00
Pauli Virtanen
ddc023b883 bluez5: media-sink: make ISO target latency scale with quantum
The ISO target latency should scale with graph quantum, as jitter in the
graph processing time probably is proportional to the quantum.
2025-07-12 19:57:22 +00:00
Barnabás Pőcze
90c0d8c225 pipewire: module-rt: use pw_thread_utils_join()
`pw_thread_utils_create()` is used to create the thread, so use
the corresponding `pw_thread_utils_join()` instead of just
`pthread_join()`.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
a55561dcba pipewire: module-rt: destroy mutex and condition variable 2025-07-12 19:55:34 +00:00
Barnabás Pőcze
0923e12fa3 pipewire: module-rt: have just one impl_thread_utils
There are two definitions depending on `#ifdef HAVE_DBUS`,
however, the two definitions are indentical, so remove one.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
b124385fac pipewire: module-rt: remove sched_set_nice()
It has only a single caller, so inline it because
there is not much point in keeping it separate.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
b71d0224db pipewire: module-rt: remove check for impossible condition
Neither `sched_set_nice()` nor `pw_rtkit_make_high_priority()`
(should) ever return a positive number, so that case is not
possible; remove it.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
7a336645fb pipewire: module-rt: get_rtkit_priority_range(): return void
This function cannot fail, so make it return `void`.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
801ac5ced8 pipewire: module-rt: simplify check_rtkit()
The return value is always 0, and the `impl` parameter
is not used, so ues the return value to return the boolean
result instead of an out parameter, and get rid of the
unused argument.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
10161407ff pipewire: module-rt: move RLIMIT_RTTIME compat definition
Move it next to the other macros.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
f0579b9b67 pipewire: module-rt: deduplicate log message 2025-07-12 19:55:34 +00:00
Barnabás Pőcze
c4984e33b2 pipewire: module-rt: use spa_autoptr for properties 2025-07-12 19:55:34 +00:00
Barnabás Pőcze
3b4f37ac92 pipewire: module-rt: fix function brace style 2025-07-12 19:55:34 +00:00
Barnabás Pőcze
7eb98a31bb pipewire: module-rt: define SCHED_RESET_ON_FORK if not available
Instead of using a new macro with the `PW_` prefix, simply define
`SCHED_RESET_ON_FORK` to be `0` when it is not defined; as the
prefixed variant can be a bit confusing.
2025-07-12 19:55:34 +00:00
Barnabás Pőcze
279b7ee698 pipewire: module-rt: use "tid" instead of "pid" for thread ids 2025-07-12 19:55:34 +00:00
Barnabás Pőcze
13fe4a5a57 pipewire: module-rt: use sizeof(variable) instead of sizeof(type) 2025-07-12 19:55:34 +00:00
Barnabás Pőcze
ca47d0ef15 spa: vulkan: map VK_INCOMPLETE to ENOSPC
`VK_INCOMPLETE` means "A return array was too small for the result",
so map it to `ENOSPC` since that describes it better than `EBUSY`.
2025-07-12 19:54:14 +00:00
Barnabás Pőcze
72f1719c95 pipewire: thread: check sched_get_priority_*() return value
The function can report errors, so let's propagate them.
2025-07-12 19:53:45 +00:00
Barnabás Pőcze
d17f68c047 pipewire: thread: impl_join(): return negative error code
`pthread_*` functions return a positive error code, but
a negative one is expected, so negate the return value.
2025-07-12 19:53:45 +00:00
Barnabás Pőcze
331bb2f1ed spa: debug: SPA_TYPE_Id is unsigned
The underlying type of `SPA_TYPE_Id` is `uint32_t`, so access
and print it as such.
2025-07-12 19:52:43 +00:00
Barnabás Pőcze
49d9d5e618 spa: param: video: add missing type info for color params
Add the missing type info for:

  * SPA_FORMAT_VIDEO_colorRange
  * SPA_FORMAT_VIDEO_colorMatrix
  * SPA_FORMAT_VIDEO_transferFunction
  * SPA_FORMAT_VIDEO_colorPrimaries
2025-07-12 21:18:23 +02:00
Arun Raghavan
51d4d5ec3c gst: pipewiresrc: Expose cursor position as a ROI meta 2025-07-11 11:57:59 -04:00
Frédéric Danis
067e29543a bluez5: backend-native: Fix call held hangup
Currently it's not possible to hangup a call place on hold, and
request user to swap calls before been able to hangup.
2025-07-11 10:42:03 +02:00
Wim Taymans
74e576c31a filter-graph: don't pass NULL label around
lv2 does not have a label, make sure we pass "" around like befor
because code does not expect this to be NULL.
2025-07-10 18:10:51 +02:00
Wim Taymans
a188f1d29f pod: remove alignment checks
We currently often create pods in a uint8_t buffer, which is not aligned
to 8 and might cause deref and other problems.

We should either align the buffer we write into or maybe make the
builder add some padding before the buffer to align it. We have to be
careful with that when we assume the buffer start is the beginning of
the pod..

Fixes #4794
2025-07-10 16:56:26 +02:00
Wim Taymans
20a4aa8cf9 modules: remove v0 protocol support 2025-07-10 16:26:01 +02:00
Pauli Virtanen
ae7a893ce9 bluez5: aac: fix for A2DP v1.4 using rfa bits for more channels
A2DP v1.4 uses the rfa bits for adding 5.1 and 7.1 configurations.
Clear those bits properly when sending configuration, in case remote
device sets them.
2025-07-10 14:12:15 +00:00
Robert Mader
7e202a3844 spa: libcamera: add colorimetry support
Libcamera equivalent to 41b831d0f ("spa: v4l2: add colorimetry support")
2025-07-10 14:11:41 +00:00
Demi Marie Obenour
c54fdb76f8 protocol-native: check for NULL strings
SPA_POD_String allows NULL strings, so check for them.
2025-07-10 14:08:56 +00:00
Demi Marie Obenour
adb3a55703 protocl-native: v0: Fix integer overflow to buffer overflow
Too many dict items could cause an integer overflow leading to a
stack-based buffer overflow.
2025-07-10 14:08:15 +00:00
Demi Marie Obenour
9a66938283 pulse: don't ignore return value
If a function can fail don't pretend it succeeded.
2025-07-10 14:06:05 +00:00
Demi Marie Obenour
3c3ead2784 gst: whitespace fix
No functional change.
2025-07-10 14:05:23 +00:00
Demi Marie Obenour
32b8e5f500 src: use correct format string for uint32_t
<inttypes.h> provides the correct and portable format string to be used.
2025-07-10 14:03:44 +00:00
Demi Marie Obenour
b3bf5be1f6 *: Avoid macros that use casts where possible
Use direct field access when the type is known, instead of a macro that
includes a cast.

These were missed in e4fcbef89a.
2025-07-10 14:02:55 +00:00
Barnabás Pőcze
5cf84fa3fe spa: debug: pod: print custom properties with more detail
Previously, custom object properties were printed as "unknown",
and the offset (wrt. `SPA_PROP_START_CUSTOM`) was not displayed.
A custom property is distinct from an "unknown" one. Being able
to quickly differentiate the two is useful. Furthermore, knowing
the custom property id (i.e. the actual numeric id minus
`SPA_PROP_START_CUSTOM`) is also very helpful.

To address the above, print a custom property (i.e. anything with
an id at least `SPA_PROP_START_CUSTOM`) as follows:

  Spa:Pod:Object:Param:Props:Custom:123

where the last component is the custom property id.
2025-07-10 14:01:50 +00:00
Barnabás Pőcze
4a92ec35a6 spa: debug: pod: use the appropriate format specifiers
Use the appropriate format specifiers wrt. the signedness of the type,
as well as use the `PRI*N` macros for the `[u]intN_t` types.
2025-07-10 14:01:50 +00:00
Wim Taymans
b4f97c62c6 filter-graph: support more complicated labels
If we see a container as the label, copy the whole container and use
that as the label.

The label is used to construct a plugin description.
2025-07-10 13:47:29 +02:00
Wim Taymans
5ca74996f0 filter-graph: allow setting a fixed rate
It's possible to make the filter streams resample to a specific rate
before running the graph.
2025-07-10 13:47:23 +02:00
Arun Raghavan
eec1ac20b7 spa: aec: webrtc: Expose echo canceller mobile_mode
Significantly better CPU performance in lieu of canceller quality. Not
implemented for 0.x series, as there's a lot more to enable there (such
as routing modes), and I am hoping to drop support for those versions
before too long.
2025-07-09 13:02:18 -04:00
Arun Raghavan
477674740e spa: aec: webrtc: Drop outdated comment
The Intelligibility enhancer was removed, so the FIXMEs are irrelevant.
2025-07-09 12:48:24 -04:00
Arun Raghavan
a328e0ae28 spa: audioconvert: Avoid reading past filter-graph param name end
Ensure we have at least a `.` after `audioconvert.filter-graph`, so we
don't try to read past the end if it does not exist.

Also document in the param name that an index is expected.
2025-07-09 15:20:09 +00:00