Experiencing Stuttering and Audio Interruptions in Bluetooth Calls with Pulseaudio

Hello @ferranmc,

I was able to test this on BSP 7 and the call worked without issues.

The build used the Toradex Reference Multimedia Image 7.0.0 as a base, with the following additions to local.conf:

ACCEPT_FSL_EULA = "1"

IMAGE_INSTALL:append = " pulseaudio-server pulseaudio-module-loopback pulseaudio-module-bluez5-discover pulseaudio-module-bluetooth-discover pulseaudio-module-bluetooth-policy pulseaudio-module-bluez5-device pulseaudio-module-cli pulseaudio-module-echo-cancel ofono pulseaudio pulseaudio-misc webrtc-audio-processing"

DISTRO_FEATURES:append = " pulseaudio"

After the image is built and installed to the module, you can run the following script to setup the Bluetooth communication:

#!/bin/bash

# to check if PulseAudio is running
check_pulseaudio() {
    ps aux | grep -i pulseaudio | grep -v grep > /dev/null
    return $?
}

echo "Killing and unblocking bluetooth"
rfkill unblock bluetooth
sleep 1

echo "Powering bluetooth" 
bluetoothctl power on

echo "Turn on agent"
bluetoothctl agent on 
sleep 1

echo "setting default agent"
bluetoothctl default-agent 

# Check for PulseAudio processes
process_id=$(ps aux | grep -i pulseaudio | grep -v grep | awk '{print $2}')
# If a PulseAudio process is found
if [ ! -z "$process_id" ]; then
    echo "PulseAudio process found with PID: $process_id"
    
    # Kill the PulseAudio process
    kill -9 $process_id
    
    # Verify if the process is killed
    if [ $? -eq 0 ]; then
        echo "PulseAudio process killed successfully."
    else
        echo "Failed to kill the PulseAudio process."
    fi
else
    echo "No PulseAudio process found."
fi

echo "starting Pulseaudio"
pulseaudio --start

# Wait for PulseAudio process to start
while ! check_pulseaudio; do
    echo "Waiting for PulseAudio to start..."
    sleep 1
done
echo "PulseAudio is now running."

echo "Loading sink/output device"
pactl load-module module-alsa-sink device=hw:0,0
sleep 1

echo "Setting default sink/output"
pactl set-default-sink alsa_output.hw_0_0

echo "Loading source/input"
pactl load-module module-alsa-source device=hw:0,0 

echo "Setting default source/input"
pactl set-default-source alsa_input.hw_0_0

echo "Enabling SCO "
hcitool -i hci0 cmd 0x3F 0x001D 0x00

echo "Device ready to connect/pair"

Then, using bluetoothctl:

  1. Pair to the phone
  2. Trust the phone
  3. Connect to the phone

At this point, calls from the phone should use the audio from the module as expected.

Can you give this a try and let me know how it goes for you?

Best Regards,
Bruno

1 Like