Recording voice from BT headset is not stable
Summary
Using the "parecord" program to record from the microphone of the Bluetooth headset, the sound is unstable in the first 6 seconds, and the sound will be stable after 6 seconds. After various experiments, a rule is found, and the playback or recording ends. After the second, the hci layer will print the message:
Bluetooth: hci0 SCO packet for unknown connection handle 12
Start the recording program before the prompt message appears, and the recorded sound will be stable. So I guess whether it is related to the establishment of the sco link? My pulseaudio version is 11.2 and the bluetooth device RSSI value is well.
environment
Unless you are sure its not relevant please attach files for each command.
uname -a
aplay -l
arecord -l
pactl info
pactl list
pulseaudio --version
`zynq> uname -a`
`Linux Sat-IR 4.6.0-xilinx #148 SMP PREEMPT Tue Apr 9 08:44:12 CST 2019 armv7l GNU/Linux`
`zynq> ./pactl info
Server String: /tmp/pulse-cJATYUq3ULJO/native
Library Protocol Version: 32
Server Protocol Version: 32
Is Local: yes
Client Index: 48
Tile Size: 65496
User Name: root
Host Name: Sat-IR
Server Name: pulseaudio
Server Version: 11.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: bluez_sink.00_11_67_11_11_67.headset_head_unit
Default Source: bluez_source.00_11_67_11_11_67.headset_head_unit
Cookie: 2fa4:74bb`
`zynq> ./pactl list
Sink #1
State: SUSPENDED
Name: bluez_sink.00_11_67_11_11_67.headset_head_unit
Description: M18
Driver: module-bluez5-device.c
Sample Specification: s16le 1ch 8000Hz
Channel Map: mono
Owner Module: 22
Mute: no
Volume: mono: 65536 / 100%
balance 0.00
Base Volume: 65536 / 100%
Monitor Source: bluez_sink.00_11_67_11_11_67.headset_head_unit.monitor
Latency: 0 usec, configured 0 usec
Flags: HARDWARE HW_VOLUME_CTRL LATENCY
Properties:
bluetooth.protocol = "headset_head_unit"
device.intended_roles = "phone"
device.description = "M18"
device.string = "00:11:67:11:11:67"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
bluez.path = "/org/bluez/hci0/dev_00_11_67_11_11_67"
bluez.class = "0x240400"
bluez.alias = "M18"
device.icon_name = "audio-card-bluetooth"
Ports:
unknown-output: Bluetooth Output (priority: 0)
Active Port: unknown-output
Formats:
pcm
Source #1
State: SUSPENDED
Name: bluez_sink.00_11_67_11_11_67.headset_head_unit.monitor
Description: Monitor of M18
Driver: module-bluez5-device.c
Sample Specification: s16le 1ch 8000Hz
Channel Map: mono
Owner Module: 22
Mute: no
Volume: mono: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor of Sink: bluez_sink.00_11_67_11_11_67.headset_head_unit
Latency: 0 usec, configured 0 usec
Flags: DECIBEL_VOLUME LATENCY
Properties:
device.description = "Monitor of M18"
device.class = "monitor"
device.string = "00:11:67:11:11:67"
device.api = "bluez"
device.bus = "bluetooth"
bluez.path = "/org/bluez/hci0/dev_00_11_67_11_11_67"
bluez.class = "0x240400"
bluez.alias = "M18"
device.icon_name = "audio-card-bluetooth"
Formats:
pcm
Source #2
State: SUSPENDED
Name: bluez_source.00_11_67_11_11_67.headset_head_unit
Description: M18
Driver: module-bluez5-device.c
Sample Specification: s16le 1ch 8000Hz
Channel Map: mono
Owner Module: 22
Mute: no
Volume: mono: 56798 / 87%
balance 0.00
Base Volume: 65536 / 100%
Monitor of Sink: n/a
Latency: 0 usec, configured 0 usec
Flags: HARDWARE HW_VOLUME_CTRL LATENCY
Properties:
bluetooth.protocol = "headset_head_unit"
device.intended_roles = "phone"
device.description = "M18"
device.string = "00:11:67:11:11:67"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
bluez.path = "/org/bluez/hci0/dev_00_11_67_11_11_67"
bluez.class = "0x240400"
bluez.alias = "M18"
device.icon_name = "audio-card-bluetooth"
Ports:
unknown-input: Bluetooth Input (priority: 0)
Active Port: unknown-input
Formats:
pcm
Card #0
Name: bluez_card.00_11_67_11_11_67
Driver: module-bluez5-device.c
Owner Module: 22
Properties:
device.description = "M18"
device.string = "00:11:67:11:11:67"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
bluez.path = "/org/bluez/hci0/dev_00_11_67_11_11_67"
bluez.class = "0x240400"
bluez.alias = "M18"
device.icon_name = "audio-card-bluetooth"
Profiles:
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: headset_head_unit
Ports:
unknown-output: Bluetooth Output (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit, a2dp_sink
unknown-input: Bluetooth Input (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit
`
zynq> ./pulseaudio --version
pulseaudio 11.1
Steps to reproduce
./parecord -v -r voice.wav --channels=1 --rate=8000
The first recording, the voice will not stable in the first 6 seconds, then it will stable.
Ctrl + C
to stop record, after 6 seconds, kernel will print:
Bluetooth: hci0 SCO packet for unknown connection handle 1
But if record voice again in the 6 seconds, the voice will stable.
What is the current bug behavior?
(What actually happens)
What is the expected correct behavior?
The recording voice should be stable always.