Commit graph

13633 commits

Author SHA1 Message Date
Sanchayan Maity
69b5fe8395 bluez5: g722: Do not set sequence number in start_encode
In ASHA, we might need to sync sequence numbers between
left and right side media sink. If the sequence number
is added in start encode, it becomes difficult to set
the sequence number again when a call to reset_buffer
in media sink might have happened already.

This effectively reverts commit ab5f81b9a.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
db47c3e442 bluez5-device: Expose HiSyncId and Side information on ASHA node 2025-05-05 07:43:34 +00:00
Sanchayan Maity
74fe7728d2 bluez5: media-sink: Set up node group for ASHA
ASHA devices with the same HiSyncId should use the same
node group/driver.
2025-05-05 07:43:34 +00:00
Sanchayan Maity
8120493edb bluez5-dbus: Track ASHA HiSyncId & Side information in transport
ASHA devices with the same HiSyncId are a pair and this
will be used later on to set them up together with a
combine sink like device set for BAP. Side information
is required for channel information when setting up the
combine sink.
2025-05-05 07:43:34 +00:00
Frédéric Danis
612cbf5176 bluez5: hfp-hf: Fix HFP HF states
hfp_hf_slc1 is not used so remove it, and rename hfp_hf_slc2 to
hfp_hf_clcc to be consistent with other states.
2025-05-05 07:41:06 +00:00
Frédéric Danis
533c67710e bluez5: backend-native: Fix rfcomm_send_volume_cmd()
This function always returns true. Change to not returning anything.
2025-05-05 07:41:06 +00:00
George Kiagiadakis
8e62b08e58 bluez5: hfp-hf: don't change hf_state after sending AT+BCS
The +BCS event may interrupt any of the initialization commands after
SLC is established and by changing the state here we may lose track
of the initialization sequence.

There is no reason to have the hfp_hf_bcs state anyway. If the
initialization sequence is over, we can remain in the hfp_hf_vgm state.
2025-05-05 07:41:06 +00:00
Stefan Binding
7f07448a80 spa: acp: Allow Volume control which supports mute to be used as a hardware mute
Some devices have a hardware volume control, but not a dedicated
hardware mute control. In some of these cases, the volume control is
described as having a hardware mute when volume is 0. This is described
in the TLV information of the volume control, when the
SNDRV_CTL_TLVD_DB_SCALE_MUTE flag is set in the TLV structure.
If set, alsa-lib will set the minimum dB value to -99999.99dB, which
can be detected inside PipeWire.

PipeWire can then use this hardware volume control to apply hardware
mute, when set.

In order to be able to set volumes and mutes separately, changing the
volume whilst muted will save the value, but not write it to the
hardware. When the device is unmuted, the saved value will be restored.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
2025-05-05 07:40:29 +00:00
Arun Raghavan
21a468a9cd gst: Add H.265 support
Same as H.264 for now, we might eventually want to add more stream
formats etc.
2025-05-05 07:38:25 +00:00
Arun Raghavan
39e079d8ac spa: video: Add H.265 as a format
Quite similar to H.264.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4674
2025-05-05 07:38:25 +00:00
George Kiagiadakis
92643f77f9 bluez5: backend-native: fix sco HUP|ERR debug message
Print the error in td->err (the SO_ERROR) or else let the user know
this is a regular hangup. The previous printout was always reporting
EAGAIN (remainder in errno from the event loop code, I suppose)
as an error, without any real data.
2025-05-02 16:12:23 +03:00
Wim Taymans
2ea8d3430c tools: add c key to reset ERR counters
Reset the ERR counters when pressing the c key. This only makes the
current pw-top start counting from 0 again, it does not change anything
globally on the server. It's still usefull because you can use it to
let it count the number of new errors since the keypress.
2025-04-30 15:10:15 +02:00
Wim Taymans
8d3cb2cd84 filter-graph: clean control_port array on unload
Because we created it when we loaded the graph.
2025-04-30 13:18:34 +02:00
Wim Taymans
aa67998e26 filter-graph: process controls after loading the graph
Do some of the counting of the nodes and controls when we add a node
to make things easier later.

Do the setup of the graph controls after loading the graph because we
know exactly how many controls we will have.

Fixes controls being unavailable until the filter-graph is activated.
2025-04-30 12:21:39 +02:00
Wim Taymans
237c0197c6 filter-chain: add props only once
Only add the properties offset in the builder after we actually got a
property or else we end up with the same property twice.
2025-04-30 12:20:31 +02:00
Wim Taymans
664359a020 netjack2: use strncpy to copy the header
It pads the remaining bytes in the header with 0 bytes so that the
memory doesn't contain uninitialized data.
2025-04-30 11:02:58 +02:00
Wim Taymans
a9083c7519 netjack2: improve shutdown
Destroy the sources from the io handler immediately when there is an
error so that we don't end up in endless error wakeups.

Schedule the free from the main loop and make sure only one can ever
run.
2025-04-30 11:00:42 +02:00
Wim Taymans
743d86500c netjack2: fix trace_fp compilation 2025-04-29 18:36:54 +02:00
Wim Taymans
6e8db1cd4a netjack2: handle connection errors in more cases 2025-04-29 18:09:02 +02:00
Wim Taymans
c7b318523d netjack2: set timeout to sane value again 2025-04-29 17:35:40 +02:00
Wim Taymans
3856d29646 netjack2: implement driver and manager roles correctly
The manager is actually not supposed to decide much about the number of
audio and midi ports. It should just suggest a default when connecting
driver doesn't know.

Add a audio.ports parameters to manager and driver to suggest/ask for
the amount of audio ports. Let the audio.position/audio.channels be a
specification of the channel mask in case it matches the requested
channels, otherwise use AUX channels for the ports.

This means that we must derive the mode (sink/source/audio/midi) from
the ports that are negotiated in the manager and the driver, so delay
this until after negotiation.

Make sure all the possible modes work. For midi only streams, we can't
wait for the session manager to perform a PortConfig so do that
ourselves. Make sure we only use a source trigger when we have a sink.

Fixes #4666
2025-04-29 17:17:14 +02:00
Wim Taymans
18a5f884be netjack2: make function to clear events
Make a separate function to clear events instead of passing NULL as the
midi buffer and segfaulting.
2025-04-29 16:26:30 +02:00
Wim Taymans
78fe234bfe netjack2: copy the node.group to streams
Just in case we want them to be scheduled in the same group.
2025-04-29 09:17:35 +02:00
Wim Taymans
40dbc5f00f netjack2: keep per stream io_position
And handle the trigger failure with a warning and fallback.
2025-04-29 09:16:54 +02:00
Wim Taymans
3d6e77e96d netjack2: warn when the trigger fails 2025-04-29 09:16:01 +02:00
Wim Taymans
07f033c8da netjack2: keep position io per stream
Keep a position info for the stream it was set and then use the position
info for the stream that is driving the graph. Otherwise we might use a
destroyed position info.
2025-04-28 12:23:15 +02:00
Wim Taymans
b6cb76bf8d netjack2: implement ifname in the driver
See #4666
2025-04-28 11:13:33 +02:00
Wim Taymans
93ee66dcab netjack2: Improve docs
Remove unused option.
Clarify that channels and midi port are chosen by the server.

See #4666
2025-04-28 11:12:48 +02:00
Wim Taymans
84c18df626 ebur128: fix port name
Fixes #4667
2025-04-28 09:51:20 +02:00
Wim Taymans
14f48c7a1c acp: probe max 192 channels
Thr 256 channel probe can cause overflows because we use uint8_t for the
channel count in some places.

Fixes #4669
2025-04-28 09:47:43 +02:00
Wim Taymans
7e4dd9524f alsa-seq: add the source only on success
Otherwise if we have an error with the timerfd, we have the source fd
added and we close the device.
2025-04-28 09:47:22 +02:00
Wim Taymans
41665e6bb8 examples: handle I420 and IYUV formats
They are represented in PipeWire with 3 planes now.
2025-04-24 11:18:12 +02:00
Wim Taymans
7d6e2a6417 impl-link: refactor format negotiation
Make a new port_info structure that holds the link port information for
input and output. We can use this in some places and remove some
redundant code.

We can also pass a reference to this port_info as the work-queue
object, which makes it more natural to find the associated port info in
the various work queue callbacks.

Move the private pw_context_find_format to the link implementation,
where is it actually used.

Rework the format negotiation code to use an array of 2 port_info
structures with the two ports to negotiate. The negiotiation will
always use the first port_info as higher priority.

Make sure a driver port has a lower priority than the other port. We want
to negotiate the source/sink to something close that what is
provided/requested by the client. The client can always adapt to the
driver port format fields by giving a "don't care" value for the format
property (either unspecified or with an out of range default value).
2025-04-24 11:17:49 +02:00
Wim Taymans
abfad78fb3 pod: swap inputs for filter when invalid default
We usualy want to prefer the filter default value. When this value is
not within the valid range/alternatives, swap the logic and prefer the
defaults of the other pod.

This way we can have a filter with an invalid default that will then use
the preference of the other pod but still enforce some bounds.
2025-04-24 11:14:51 +02:00
Wim Taymans
8b01fce2bc filter: remove unused function 2025-04-24 11:09:40 +02:00
Wim Taymans
19f6d83fa2 pod: move some filter functions to compare 2025-04-24 11:09:09 +02:00
Wim Taymans
1cca24c585 videoconvert: consume input buffer in all cases
Return the input buffer when we get some error so that the other side
can send new data.
2025-04-24 10:58:04 +02:00
Wim Taymans
bcf0c0cf89 v4l2: only skip buffer for raw formats
We don't want to skip the first buffer for encoded formats because it
can contain the encoding parameters, in the h264 case, for example.
2025-04-24 10:57:49 +02:00
Wim Taymans
d1d580cafa pod: move common check outside of the loop 2025-04-24 10:44:20 +02:00
Wim Taymans
4774178c68 pod: struct has spa_pod as the body 2025-04-24 10:42:20 +02:00
Wim Taymans
2f21b27397 filter: build result in separate builder and copy
Build the filtered result into a new separate builder and copy it into
the result builder afterwards. This ensures the memory of the old
builder does not suddenly change when it gets reallocated.
2025-04-24 10:41:05 +02:00
Wim Taymans
205ee5b6b0 dynamic: add _continue
The continue functions takes a builder as the argument and makes a new
builder that starts from the old builder memory. If the old builder was
dynamic, the new one will also be dynamic. Because it's a separate
builder, the memory of the old builder will not be reallocated when
extended.

This makes it possible to freely read the memory from the old builder
while we construct the result in a new builder without having to worry
about reallocating the memory of the old builder. When the new object is
completed, it can then be copied into the old builder.
2025-04-24 10:40:59 +02:00
Wim Taymans
336a5d1ded ump: fix program change 2.0 to 1.0 conversion
The program change byte should not be shifted an extra bit, unlike all
the other messages.

Fixes #4664
2025-04-24 10:25:39 +02:00
Anders Jonsson
14f55663bf po: Update Swedish translation 2025-04-23 00:03:23 +00:00
Philippe Normand
2e409c0237 gst: src: Attach video meta when receiving DMABufs from PipeWire
Fixes getDisplayMedia() in WebKitGTK after regression introduced by:
https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/2330
2025-04-22 10:48:00 +01:00
Pauli Virtanen
46c4261998 bluez5: fix cmsg align in spa_bt_recmsg & smaller buffer 2025-04-21 14:46:58 +03:00
Pauli Virtanen
0d61cc1b1d bluez5: use kernel-provided RX timestamps
Use kernel-provided packet reception timestamps to get less jitter in
packet timings. Mostly matters for ISO/SCO which have regular schedule.

A2DP (L2CAP) doesn't currently do RX timestamps in kernel, but we can as
well use the same mechanism for it.
2025-04-21 10:22:50 +00:00
Pauli Virtanen
081116906d bluez5: bap: allow configuring server locations/context
Add configuration options for the BAP/PACS sink and source endpoint
location (= channel positions) and context settings.

Although BlueZ associates these with individual endpoints, in the PACS
spec they are actually device-global, so configure directly in monitor
settings.
2025-04-20 20:34:35 +03:00
Arun Raghavan
a4148c80b4 Makefile: Fix up shell/run rules 2025-04-18 14:05:12 -04:00
Arun Raghavan
31069b2626 Don't log to systemd during development
Can get a bit spammy if we're doing verbose logging.
2025-04-18 12:28:23 -04:00