-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Feature description
As far as I understand, starting bluealsad
with the "keep-alive" option like this ...
bluealsad -S --keep-alive=-1 -p a2dp-sink
... only keeps the Bluetooth transport active. If there's no audio playing from the external device, the PCM is closed and not even silent frames are written. This is a bit like an analog capture card which only starts working when you plug in an audio cable.
Most of the time this is totally fine and maybe it is even the desired behavior (e.g. efficiency, power consumption in embedded devices)?
However, there are scenarios where it is desired to have silent frames output. Currently, it's not possible to import bluealsa
into Jack with zita-a2j
reliably.
Additional context
When there is no audio playing and you import bluealsa
into Jack with zita-a2j
, then once you start playing something, the audio is muffled and distorted.
Steps to reproduce:
- Run bluealsa as a2dp-sink on the host device:
/usr/bin/bluealsa -S --keep-alive=5 -p a2dp-sink
- Make the host device discoverable:
$ bluetoothctl --agent=NoInputNoOutput
system-alias TestDevice
discoverable on
pairable on
default-agent
-
Connect phone to host device called "TestDevice".
-
Start Jack server (the order for this doesn't matter, you can start Jack server before as well):
jackd -d alsa -P hw:1 -C hw:2 -i 2 -o 2 -r 44100 -p 64 -n 3 -D -S
- Assuming no audio is playing from the phone, start
zita-a2j
and connect outputs:
zita-a2j -v -j bluealsa -d bluealsa -c 2 -r 44100 -p 4096 -n 3
jack_connect bluealsa:capture_1 system:playback_1 && jack_connect bluealsa:capture_2 system:playback_2
- Start playing some music from the phone. The audio is muffled, distorted and you can barely hear anything.
However, if you start to play music before you start zita-a2j
, then it is fine. BUT, if you pause the audio and resume after a few seconds, then you have the same problem.
You could argue that zita-a2j
should also be aware of the PCM state, but I still think it's counterintuitive (at least for me), to not have silent frames when a device is connected but no audio is playing.
Anyone willing to provide ideas and insights on how this could be patched in bluez-alsa?