maniacx / Airpod-Battery-Monitor

A Gnome extension for monitoring battery level of AirPods and Beats Bluetooth headset
https://extensions.gnome.org/extension/6778/airpod-battery-monitor/
GNU General Public License v3.0
36 stars 7 forks source link

Sound cuts out frequently, repeatedly Fedora 39, Gnome 45 #13

Open douglasthiel opened 6 months ago

douglasthiel commented 6 months ago

Environment: Macmini7,1 Airpods 3rd Gen Fedora 39 Gnome 45 Firefox 123.0 Bluetooth 4.0 wireless technology

lsusb | grep bluetooth -i Bus 001 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth) Bus 001 Device 007: ID 05ac:8289 Apple, Inc. Bluetooth Host Controller

Repeatable test sequence:

  1. Turn on extension.
  2. Listen to YouTube or Rhythmbox
  3. Observe cracks and silences
  4. Turn off extension
  5. Observe proper play
maniacx commented 6 months ago

Could be the start and stop discovery might be cause issue with streaming data.

Let do some test with bluetoothctl tool in bluetoothctl commands are scan on: to start discovery normal mode scan le: to start discovery using filter for ble only (This seem to get faster response whihc the extension is using) scan off: to stop discovery

Do both test with youtube playback and extension disabled. start discovery and stop discovery after 1 minute. when start discovery is runnng, observe if it affect streaming

Test 1 start discovery with le filter. In terminal type bluetoothctl scan le check if it affect streaming for a minute scan off

Test 2 start discovery. In terminal type bluetoothctl scan on check if it affect streaming for a minute scan off

Let me know if test1 and test2 interfere with streaming, or if one is better then other.

douglasthiel commented 6 months ago

Both Test 1 and Test 2 significantly interfere with YouTube audio

maniacx commented 6 months ago

Oh damn. Ok one more. test With everything closed and extension disabled. Run Youtube. Open Gnome Settings > Bluetooth section and just leave it open. Check if leaving this windows open, you have any interference.

Screenshot from 2024-02-28 16-53-16

Explaination. Opening Gnome setting > Bluetooth also starts discovery. Just want to check if this too interferes with streaming.

douglasthiel commented 6 months ago

Listening to YouTube with the Airpods, Opening Gnome Bluetooth Settings has the same result interfering with playback. Closing the Gnome Bluetooth Settings restores normal playback.

What does it mean "With everything closed" ?? All apps closed? Anyway, I retested after closing all apps except Firefox 123.0 and the Gnome Settings app with the same result.

maniacx commented 6 months ago

What does it mean "With everything closed" ?? All apps closed?

No just the bluetoothctl window or any thing that start discovery.

The extension depends on discovery to get battery info from airpods. For now, I cannot think of anything else.

One thing you can do is experement with different codec configurations if there are multiple configuration available and test with discovery on in bluetoothctl.

Screenshot from 2024-02-28 17-23-38

Let me know if something improves

douglasthiel commented 6 months ago

All tests were performed with the following codec: High Fidelity Playback (A2DP Sink, codec SBC-XQ)

maniacx commented 6 months ago

Do you have only 1 configuration available?

douglasthiel commented 6 months ago

Testing with the other 2 codecs on my system yields the same result. They are: High Fidelity Playback (A2DP Sink, codec AAC) High Fidelity Playback (A2DP Sink, codec SBC)

Toxblh commented 6 months ago

@douglasthiel could you test to change ControllerMode in /etc/bluetooth/main.conf to ControllerMode = bredr and test again?

douglasthiel commented 6 months ago

ControllerMode in /etc/bluetooth/main.conf was originally like this:

ControllerMode

Changed to: ControllerMode = bredr rebooted all Fedora updates applied (yet again)

Retested with the same result.

maniacx commented 6 months ago

Are you able to see Airpods Battery Level with ControllerMode = bredr?

Also could you post result of

cat /etc/bluetooth/main.conf
bluetoothctl --version
pipewire --version
maniacx commented 6 months ago

Are you using asahi linux kernel? Is your CPU intel or M-series?

douglasthiel commented 6 months ago

main.conf.txt

douglasthiel commented 6 months ago

bluetoothctl --version bluetoothctl: 5.72

douglasthiel commented 6 months ago

pipewire --version pipewire Compiled with libpipewire 1.0.3 Linked with libpipewire 1.0.3

douglasthiel commented 6 months ago

Are you using asahi linux kernel? Is your CPU intel or M-series?

The model for Apple Silicon macmini starts at macmini9,1 So, my macmini7,1 2014 is running Intel

douglasthiel commented 6 months ago

Are you able to see Airpods Battery Level with ControllerMode = bredr?

Yes. The Airpods Battery Level is in the process of "scanning", seemingly forever.

  1. I took my Airpods out of my ears and put them back in the case.
  2. I took them out again and Airpods Battery Level is still in the "scanning" state.
maniacx commented 6 months ago

Every look good and updated. I am not sure what could be the issue. But there are few things we could try. But before that switch back to ControllerMode = dual and confirm the extension show battery level and music distorts.

1) Try turning off wifi. and check if music distorts when discovery is started.

2) Buffer size is dynamic. Try setting a fixed or increasing buffer size by running command .

In terminal

pw-metadata -n settings 0 clock.force-quantum 2048

To reset back to dyanamic buffer

pw-metadata -n settings 0 clock.force-quantum 0

3) Also could try these settings

In terminal

PULSE_LATENCY_MSEC=100

Do not try all steps together. Try 1 then 2 and finally 3. Note: that point 2 and 3 are not permanent settings. These settings will be lost on reboot. So it is pretty safe to use.

If none make any difference, let raise an issue with bluez. Let me know how it goes.

Toxblh commented 6 months ago

I think here problem with broardcom bt. I'll test with my macbook pro 2013 later. With intel bt all good in regular PC

Toxblh commented 6 months ago

Confirmed. On MacbookPro 11,1 get the same super annooying problem with sound under listen advertisments. I use close source Broadcom drivers for wifi/bt combo.

Will see.

douglasthiel commented 6 months ago

Every look good and updated. I am not sure what could be the issue. But there are few things we could try. But before that switch back to ControllerMode = dual and confirm the extension show battery level and music distorts.

check, same issue as always

Try turning off wifi. and check if music distorts when discovery is started.

macmini is hardwired to my router.

I tried buffer sizes of 2048, 4096, 8192 with no joy.

pw-metadata -n settings 0 clock.force-quantum 0

no joy

PULSE_LATENCY_MSEC=100

also no joy

Note: I am not rebooting btwn the different tries in this comment.