Commit graph

11845 commits

Author SHA1 Message Date
Pauli Virtanen
d487dc0fc6 bluez5: bap: support ChannelAllocation parameter from BlueZ
For multi-ASE configurations, BlueZ does the channel allocation itself,
and passes us the result in the ChannelAllocation parameter.

If it is present, don't do the allocation ourselves but use that value
instead.
2024-01-08 10:09:13 +00:00
Pauli Virtanen
caebeaa9b3 bluez5: lc3: workaround bad Supported_Max_Codec_Frames_Per_SDU
If Supported_Max_Codec_Frames_Per_SDU is less than what is required by
Supported_Audio_Channel_Counts, override its value assuming the device
actually supports at least that. Needed for Creative Zen Hybrid Pro.

Fix default value for channel count bitmask.
2024-01-08 10:09:13 +00:00
Pauli Virtanen
b533b06b51 bluez5: backend-native: handle multiple commands in RFCOMM input
Do relaxed parsing of RFCOMM commands for AG & HF roles, allowing
multiple commands in same buffer.

Use same parser code for all HFP/HSP AG/HF. Parse input in relaxed way,
as some devices emit spurious \n
2024-01-06 15:42:20 +02:00
Wim Taymans
3da66734bd modules: add reconnect support to module-pulse-tunnel
When the pulse connection is broken, reconnect with the given interval.

Add the reconnect_interval_ms property to the pulse modules.
2024-01-05 13:34:19 +01:00
Wim Taymans
b4be094be8 doc: clarify rlimits conf file
Fixes #3760
2024-01-05 10:22:28 +01:00
Wim Taymans
a05a8eb8c6 spa: remove some references to unimplemented items
Fixes #3763
2024-01-05 10:07:58 +01:00
Barnabás Pőcze
e6c2e8465e meson_options: pass proper boolean values to boolean options
Passing strings has been deprecated:
https://mesonbuild.com/Release-notes-for-1-1-0.html#coercing-values-in-the-option-function-is-deprecated
2024-01-05 03:43:46 +01:00
Wim Taymans
370bf7206b pulse-server: add pipewire-pulse:log-level message
Add a /core message to set the log level of the pulse-server.

An alternative would be to watch the settings metadata and follow the
server settings. This is however less flexible so the custom message
was chosen.
2024-01-04 17:43:53 +01:00
Wim Taymans
a3c6b3acae log: add pw_log_topic_custom_enabled()
Add a function to check if a specfic custom log level has been defined
for a topic.

We can use this to dynamically check if we need to do the connection debug
messages.

We can also get rid of the conn.* pattern hack to disable connection
messages by default.
2024-01-04 17:40:57 +01:00
Wim Taymans
5152c98789 log: store log level in topics
When there is no specific level for a topic we store the global log level
in the topic level. Make sure this invariant is preserved when the
the global log level is updated.

We can then simply update the log level after we processed the log level
string to update all topics.

This should also make it possible to just use the level from the topic
in all cases and remove a check.
2024-01-04 17:30:21 +01:00
Wim Taymans
e088dd2d2f journal: copy log level to chained logger
Make sure the log level on the chained logger is the same as ours.

Makes PIPEWIRE_DEBUG=3 make run print debug again.

This used to work because the log level was parsed and set before the
loggers were created and chained, and so they all got the same level.

Now that the level can be changed with metadata at runtime, we can't
really update all past loggers so let the journal logger copy the
level itself.
2024-01-04 13:57:26 +01:00
Demi Marie Obenour
76de766cd8 Draft: Allow calling trigger_done from the RT thread
This allows streams to know when the graph is finished and they can
safely drive it again.

Fixes: #3759
2024-01-04 10:21:16 +00:00
Pauli Virtanen
961d0cfdc1 log: make pw_log_topic_register/unregister threadsafe
Make the topic registration/unregistration threadsafe, as they can be
called from constructors of static objects which don't necessarily run
in the main loop thread.
2024-01-04 10:02:55 +00:00
Pauli Virtanen
fb2d05aa61 log: make pw_log_set_level_string public API 2024-01-04 10:02:55 +00:00
Pauli Virtanen
53ba3d0e4c spa: support: remove log pattern support
The log patterns are now handled by plugin host.
2024-01-04 10:02:55 +00:00
Pauli Virtanen
dd8d5e1bed log: make PW_LOG_TOPIC / PW_LOG_TOPIC_STATIC magical
Have PW_LOG_TOPIC / PW_LOG_TOPIC_STATIC emit GCC constructor/destructor
functions that register/unregister the log topic as needed.
2024-01-04 10:02:55 +00:00
Pauli Virtanen
d2acad8f0e test: fix test error message check 2024-01-04 10:02:55 +00:00
Pauli Virtanen
3d974d3256 pipewire: register/unregister log topics from SPA plugins
Register enumerated log topics from SPA plugins on plugin load, and
unregister them on plugin unload.
2024-01-04 10:02:55 +00:00
Pauli Virtanen
3cff30c651 log: support dynamic log levels for registered log topics
Handle log level patterns in libpipewire instead of the SPA logger.

This allows dynamically changing the log levels also for log topics,
which we do when log.level metadata changes.

The syntax for PIPEWIRE_DEBUG and log.level in config files and metadata
is now the same.
2024-01-04 10:02:55 +00:00
Pauli Virtanen
1197b581d9 spa: use only static log topics 2024-01-04 10:02:55 +00:00
Pauli Virtanen
eaea03c26c spa: export log topic enumerations 2024-01-04 10:02:55 +00:00
Pauli Virtanen
fc4dbcd033 spa: define symbols for log topic enumeration
Log topics are enumerated in an array of `struct spa_log_topic *`,
accessible via symbol `spa_log_topic_enum` pointing to a struct
spa_log_topic_enum in SPA shared libraries.

Add macros that use GCC section attribute to construct it with elf
magic.
2024-01-04 10:02:55 +00:00
Pauli Virtanen
d099ceaff1 spa: spa_strbuf_init should null-terminate 2024-01-04 10:02:55 +00:00
Wim Taymans
8f66df2f78 pulse-server: call update_object_info in manager_added
get_device_info() requires us to call update_object_info() in the added
and updated events.

Fixes a bug where the properties were invalid in the avahi txt record.
2024-01-04 10:43:03 +01:00
Wim Taymans
0fd0582514 protocol: don't allow NULL event or command
If causes crashes when the handlers try to get the ID.
2024-01-03 14:05:39 +01:00
Nicolas Boichat
4ef891b047 INSTALL.md: Add WIREPLUMBER_DEBUG env variable
Without this, new developers, unfamiliar with pipewire/wireplumber
architecture, can easily be confused about why their debug messages
are not showing up.
2024-01-01 18:30:19 +00:00
Barnabás Pőcze
8aaba4fec3 pipewire: module-loopback: fix delay buffer memory leak 2023-12-28 16:47:23 +01:00
Demi Marie Obenour
0227a30bcf spa: Bounds-check pointers before dereferencing them
Add a new overflow-safe function to check if region p2 of size s2 fits
completely in p1 of size s1 and, if it does, return the amount of bytes
in p1 that come after the end of p2.  Use this to bounds check the pod
iterators while ensuring that the pointer is bounds checked before being
dereferenced.

The spa_pod*_next() functions can still create an out-of-bounds pointer,
but this will not be dereferenced.  Fixing this requires either
additional complexity in these functions or forbidding POD structs,
objects, and sequences that have a length that is not a multiple of 8
bytes.

Fixes: 92ac9a355f ("spa: add spa_ptrinside")
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-12-26 16:05:24 +00:00
Barnabás Pőcze
c130ec9de9 pipewire: log: fix concatenation in log topic macros
`__LINE__` was not expanded previously. Fix that.
2023-12-26 16:03:29 +00:00
Barnabás Pőcze
da7cf84f95 spa: utils: add SPA_CONCAT() macro 2023-12-26 16:03:29 +00:00
Mauro Carvalho Chehab
d26916828d bluez5: update bluez-hardware.conf to ignore sbc-mq on Primark earbud
Primark True Wireless earbud doesn't support sbc-xq. Having it
enabled causes bluez to enter into a loop enabling/disabling
the device dozens of times per minute, making it unusable.
2023-12-26 16:02:22 +00:00
George Kiagiadakis
5a130ddd73 gstpipewiresrc: break out of wait_started() also on STATE_UNCONNECTED
When the session manager sends an error to the client, it typically
also destroys the node after the error, which causes the stream to go
to STATE_UNCONNECTED via proxy_removed(). In that case, make sure
we exit the loop early, otherwise it will take 30 seconds to unblock
gst_element_set_state()

This is a revised version of the fix that was commited via !1763
and then reverted, as it was problematic. Now the code ensures
that it breaks out only if the state was previously CONNECTING
or higher.
2023-12-26 16:01:44 +00:00
Michael Tretter
03173530da gst/pipewiresink: fix dts_offset
GStreamer uses a time stamp for the decoding time, but PipeWire uses an
offset to the presentation time. Thus, the pipewiresink must not use the
DTS as dts_offset, but has to calculate the offset.

If the buffer's DTS is invalid, assume that dts is pts.
2023-12-21 15:11:56 +01:00
Wim Taymans
10d3c547d1 spa: add spa_ptrinside
Add a new overflow safe function to check if region p2 of size s2 fits
completely in p1 of size s1. Use this to bounds check the pod iterators.

Fixes #3727
2023-12-20 20:18:33 +01:00
Wim Taymans
92ac9a355f impl-node: handle priority.driver changes
When the driver priority changes, remove and add the node into the
driver list to keep the list sorted. Also trigger a graph recalc.
2023-12-20 12:39:19 +01:00
Dmitry Sharshakov
a7410fe1bf module-rtp-sap: refactor channelmap generation 2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
aca4d93b31 module-rtp-sap: properly serialize custom channelmaps 2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
2e14f3d97a module-rtp-sap: only override NTP value in the timing line
That is indeed 0 for nearly any device. However the NTP value in the session identification part plays a crucial role for distinguishing between streams in some implementations, e.g. Dante.
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
420ab8ed89 module-rtp-sap: add session number to the NTP value
Dante Controller does not recognize next stream having the same NTP value. Work around that by adding current number of sessions to the time and the magic value.

Co-authored-by: Dewi Seignard <dewiweb@gmail.com>
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
57985e5aea module-rtp-sap: set source-filter up
Might enhance support for some devices or otherwise useful.

Co-authored-by: Dewi Seignard <dewiweb@gmail.com>
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
caabc074c8 module-rtp-session: remove outdated FIXME
rtp-sink already handles DSCP and uses profile 41 by default
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
76addb3eaa pipewire-aes67: default to NTP 0
Follow other devices to ensure best compatibility
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
eab90d6029 module-rtp-sap: allow overriding NTP value
It seems like most devices use value 0 there, so for further enhanced compatibility it's preferred to do so as well
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
065e819f18 TODO: module-rtp: buffering for sender
This should be done to match packet size requirements (e.g. 1 ms) while allowing user's software to run at higher buffer size to not stutter.

This will require scheduling multiple rtp_audio_flush_packets calls per one rtp_audio_process_capture call
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
066e8e1c63 module-rtp-sap: add a way to add extra attributes to SDP
Useful for new device bringup without rebuilding PW
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
1fe6feac56 module-rtp: improve logging priorities
Previous state was useless for real debug at the current implementation level
2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
c75f6219dc module-rtp-sap: add notices about different channelmap formats used by different hw 2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
873e6119b8 module-rtp: handle framecount attribute 2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
2525a99b97 module-rtp-sap: parse ptime from incoming streams 2023-12-20 09:35:22 +00:00
Dmitry Sharshakov
6a64ec8b8f module-rtp-sap: send out a default channelmap if none specified
RAVENNA devices (at least Lawo) seem to error out on streams without this property

Co-authored-by: Dewi Seignard <dewiweb@gmail.com>
2023-12-20 09:35:22 +00:00