bluez5: Prevent acquisition timeout when source node is not connected
- PipeWire version (
pipewire --version
): 0.3.83 - Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
): My self-compiled Buildroot - Desktop Environment: None
- Kernel version (
uname -r
): 6.4.2 - BlueZ version (
bluetoothctl --version
): 5.68 -
lsusb
:
# paste the output of "lsusb" here
Bus 001 Device 002: ID 8087:0032 Intel Corp. AX210 Bluetooth
- Bluetooth devices:
# paste the output of "bluetoothctl devices" here
Device F8:87:F1:XX:XX:XX XXX-iPhone
Description of Problem:
I'm writing a simplistic "session manager" to control my device. My devices acts as an BT audio receiver and speaker, receiving audio from Bluetooth A2DP and line-in, and plays received audio with built-in speaker. A simplified model of the device is that, there's a button on device with which the user can switch between the sources, achieved by creating and deleting links on pipewire graph. The device should also be able to know if there're any connected Bluetooth devices that's sourcing audio (to light an LED), even if the source is not switched to Bluetooth. I plan to implement this without media-session and wireplumber.
The built-in "bluez-session" example is used to add Bluetooth nodes to Pipewire. When the paired Bluetooth device starts playing, it will create an audio source node on the graph. But after 5 seconds, if the new node is not connected to any sink node, it will disappear. My guess is that, as the node is not connected to any sink node, it remains in "suspended" state. Therefore, A2DP transport state will stuck in "TRANSPORT_STATE_PENDING" without transition to "TRANSPORT_STATE_ACTIVE", and bluez will decide timeout after 5 secs.
I would like to ask for a way that the node can "stay" there, even when not connected to any sinks. In my use case, I will only connect the node to the sink when the user pressed that button. As the node disappears after 5 sec, it's impossible to switch to Bluetooth audio source. Or, alternatively, if there's a way to implement my desired feature that can workaround this issue.
How Reproducible:
Always
Steps to Reproduce:
- Run baremetal Pipewire (without any session manager) and the built-in "bluez-session" example (must have !1745 (merged) applied)
- Pair a phone (either iPhone or Android) to the device
- Run
pw-cli
to monitor object state change - Start playing on the phone
Actual Results:
A new node is created after playing. After 5 seconds, the node is removed.
Expected Results:
A new node is created after playing. The node stays there, unless the phone stops playing.
Additional Info (as attachments):
Note that the audio started to play at 72474.9 sec, and it unexpectedly stopped at 72479.9 sec.