thewierdnut / asha_pipewire_sink

Asha audio protocol implementation for linux.
The Unlicense
28 stars 3 forks source link

Test results Oticon More #7

Closed MadSpindel closed 4 months ago

MadSpindel commented 4 months ago

Thank you for this project! I've tried the code with my Oticon Mores. It works, but it's not stable and latency is sometimes quite high. And range seems limited if I stream to both ears at the same time. If I move maybe 1-2 meters away from the my Intel AX200 Bluetooth adapter it will disconnect one of them. When I'm streaming only with one ear, it's more stable and range seems to be pretty OK.

Some data:

./asha_connection_test 
(process:5873): GLib-GIO-DEBUG: 19:19:52.979: Using cross-namespace EXTERNAL authentication (this will deadlock if server is GDBus < 2.73.3)
** INFO: 19:19:52.985: Adding bluetooth device Fredrik
** INFO: 19:19:53.054: Fredrik (Left)
** INFO: 19:19:53.054:     Name:      Fredrik
** INFO: 19:19:53.054:     Mac:       00:19:8E:67:60:19
** INFO: 19:19:53.054:     HiSyncId:  3980162077088088327
** INFO: 19:19:53.054:     Side:      left (binaural)
** INFO: 19:19:53.054:     Delay:     89 ms
** INFO: 19:19:53.054:     Streaming: supported
** INFO: 19:19:53.054:     Codecs:    G.722@16kHz
** INFO: 19:19:53.214:     Connected: true
** INFO: 19:19:53.214:     L2CAP_CONNINFO:
** INFO: 19:19:53.214:        handle: 3586
** INFO: 19:19:53.214:        class:  [0, 0, 0]
** INFO: 19:19:53.214:     MTU:       SND 248 RCV 672
** INFO: 19:19:53.214:     PHY:    6144 LE_2M_TX LE_2M_RX
** INFO: 19:19:53.214:     MODE: LE_FLOWCTL
** INFO: 19:19:53.214:     Hci Connection Info:
** INFO: 19:19:53.214:        type:   128 LE
** INFO: 19:19:53.214:        out:    1 true
** INFO: 19:19:53.214:        state:  1 CONNECTED
** INFO: 19:19:53.214:        mode:   7 MASTER AUTH ENCRYPT
** INFO: 19:19:53.216: Adding bluetooth device Fredrik
** INFO: 19:19:53.251: Fredrik (Right)
** INFO: 19:19:53.251:     Name:      Fredrik
** INFO: 19:19:53.251:     Mac:       00:19:8E:67:5F:F0
** INFO: 19:19:53.251:     HiSyncId:  3980162077088088327
** INFO: 19:19:53.251:     Side:      right (binaural)
** INFO: 19:19:53.251:     Delay:     89 ms
** INFO: 19:19:53.251:     Streaming: supported
** INFO: 19:19:53.251:     Codecs:    G.722@16kHz
** INFO: 19:19:53.410:     Connected: true
** INFO: 19:19:53.410:     L2CAP_CONNINFO:
** INFO: 19:19:53.410:        handle: 3585
** INFO: 19:19:53.410:        class:  [0, 0, 0]
** INFO: 19:19:53.410:     MTU:       SND 248 RCV 672
** INFO: 19:19:53.410:     PHY:    6144 LE_2M_TX LE_2M_RX
** INFO: 19:19:53.410:     MODE: LE_FLOWCTL
** INFO: 19:19:53.410:     Hci Connection Info:
** INFO: 19:19:53.410:        type:   128 LE
** INFO: 19:19:53.410:        out:    1 true
** INFO: 19:19:53.410:        state:  1 CONNECTED
** INFO: 19:19:53.410:        mode:   7 MASTER AUTH ENCRYPT

and:

./asha_pipewire_sink 
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 0
on_change_state old: UNCONNECTED  new: CONNECTING 
on_change_state old: CONNECTING  new: PAUSED 
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 3 Total: 3
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 3 Total: 6
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
Ring Occupancy: 0 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
Ring Occupancy: 0 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 6

** (process:6006): WARNING **: 19:24:16.279: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:16.320: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:24:16.540: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:16.555: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:24:16.556: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:16.576: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:16.596: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:16.796: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:24:16.816: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:24:16.877: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:24:16.918: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:16.939: Dropping frame for Fredrik (Right)
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 1 Total: 7

** (process:6006): WARNING **: 19:24:28.018: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:24:28.136: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:28.176: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:24:28.299: Dropping frame for Fredrik (Left)
Ring Occupancy: 3 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7

** (process:6006): WARNING **: 19:24:32.698: Disconnected from Fredrik (Right): (Connection reset by peer)
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7

** (process:6006): WARNING **: 19:25:12.757: Dropping frame for Fredrik (Left)
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 1 Total: 8
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 2 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 3 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Ring Occupancy: 1 High: 3 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 8
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Ring Occupancy: 3 High: 4 Ring Dropped: 0 Total: 0 Adapter Dropped: 3 Total: 11

** (process:6006): WARNING **: 19:26:59.122: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:26:59.158: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:26:59.198: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:27:00.659: Dropping frame for Fredrik (Left)
Ring Occupancy: 3 High: 4 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 11

** (process:6006): WARNING **: 19:27:04.138: Disconnected from Fredrik (Left): (Connection reset by peer)
Ring Occupancy: 4 High: 4 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 11
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?

** (process:6006): WARNING **: 19:27:13.876: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:27:14.776: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:27:15.180: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:27:15.537: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:27:16.037: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:27:16.717: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:27:16.937: Dropping frame for Fredrik (Right)

** (process:6006): WARNING **: 19:27:18.878: Dropping frame for Fredrik (Left)

** (process:6006): WARNING **: 19:27:18.898: Disconnected from Fredrik (Left): (Connection reset by peer)

** (process:6006): WARNING **: 19:27:18.979: Disconnected from Fredrik (Right): (Connection reset by peer)
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 18446744073709551605 Total: 0
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 0
on_change_state old: UNCONNECTED  new: CONNECTING 
on_change_state old: CONNECTING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 7 Total: 7
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
on_change_state old: STREAMING  new: PAUSED 
Ring Occupancy: 0 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 0 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
thewierdnut commented 4 months ago

Can you post the output of lsusb -t?

MadSpindel commented 4 months ago

Sure:

lsusb -t
/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/10p, 480M
    |__ Port 001: Dev 002, If 0, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 001: Dev 002, If 1, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 001: Dev 002, If 2, Class=Audio, Driver=snd-usb-audio, 12M
    |__ Port 001: Dev 002, If 3, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 001: Dev 002, If 4, Class=Vendor Specific Class, Driver=[none], 12M
    |__ Port 007: Dev 006, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 008: Dev 007, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 008: Dev 007, If 1, Class=Wireless, Driver=btusb, 12M
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 003.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 001: Dev 002, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 001: Dev 002, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 001: Dev 002, If 2, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 003: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 003: Dev 003, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 004: Dev 004, If 0, Class=Vendor Specific Class, Driver=[none], 12M
/:  Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    |__ Port 002: Dev 004, If 0, Class=Human Interface Device, Driver=usbhid, 5000M
    |__ Port 002: Dev 004, If 1, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 002: Dev 004, If 2, Class=Video, Driver=uvcvideo, 5000M
MadSpindel commented 4 months ago

Btw, it works better now after I rebooted. Still stable but I will test some more.

MadSpindel commented 4 months ago

It got unstable after some interference from my iPhone. And now it's unstable even if I turned Bluetooth off on my phone. Maybe reboot will fix it again? Restarting asha_pipewire_sink didn't help.

MadSpindel commented 4 months ago
./asha_pipewire_sink 
on_change_state old: UNCONNECTED  new: CONNECTING 
on_change_state old: CONNECTING  new: PAUSED 
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 5 Total: 5

** (process:4143): WARNING **: 22:04:23.589: Disconnected from Fredrik (Right): (Connection reset by peer)

** (process:4143): WARNING **: 22:04:26.250: Disconnected from Fredrik (Left): (Connection reset by peer)
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 3 Total: 8
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 18446744073709551608 Total: 0
on_change_state old: UNCONNECTED  new: CONNECTING 
on_change_state old: CONNECTING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
Why was process called with no buffers?
Ring Occupancy: 5 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 4 Total: 4

** (process:4143): WARNING **: 22:04:47.082: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:04:47.103: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:04:47.327: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:04:47.382: Dropping frame for Fredrik (Right)
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 
on_change_state old: STREAMING  new: PAUSED 
on_change_state old: PAUSED  new: STREAMING 

** (process:4143): WARNING **: 22:04:55.269: Dropping frame for Fredrik (Right)
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 8 Total: 12
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 12
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 12
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 12

** (process:4143): WARNING **: 22:05:34.466: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:34.625: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:34.646: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:34.666: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:34.708: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:34.728: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.126: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:35.266: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.328: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:35.406: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.468: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:35.489: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:35.530: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.546: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:35.546: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.566: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.587: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:35.706: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.806: Dropping frame for Fredrik (Left)

** (process:4143): WARNING **: 22:05:35.888: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:36.049: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:05:36.106: Dropping frame for Fredrik (Left)
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 1 Total: 13

** (process:4143): WARNING **: 22:05:39.267: Disconnected from Fredrik (Left): (Connection reset by peer)
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 13

** (process:4143): WARNING **: 22:05:46.387: Dropping frame for Fredrik (Right)
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 1 Total: 14
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 14
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 3 Total: 17

** (process:4143): WARNING **: 22:06:22.532: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:06:22.548: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:06:23.412: Dropping frame for Fredrik (Right)
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 17

** (process:4143): WARNING **: 22:06:26.809: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:06:27.828: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:06:28.032: Dropping frame for Fredrik (Right)

** (process:4143): WARNING **: 22:06:28.610: Disconnected from Fredrik (Left): (Connection reset by peer)
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 17
Ring Occupancy: 4 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 17
thewierdnut commented 4 months ago

can you run with the G_MESSAGES_DEBUG=all environment variable?

MadSpindel commented 4 months ago

Sure, just some more info. Disabled Bluetooth on my iPhone. Rebooted computer, connected to hearing aids in the Bluetooth settings -> Streamed for like 10 min without any issues at all (when it works like that it feels like magic). Enabled iPhone again, started a Youtube video -> Hearing aids got disconnected from computer. Disabled Bluetooth again on iPhone, connected hearing aids to computer but now asha_pipewire_sink refuses to start again.

./asha_pipewire_sink 
** INFO: 22:44:25.589: Starting...
(process:4885): GLib-GIO-DEBUG: 22:44:25.589: Using cross-namespace EXTERNAL authentication (this will deadlock if server is GDBus < 2.73.3)
** INFO: 22:44:25.601: Adding bluetooth device Fredrik
** INFO: 22:44:25.635: Name:      Fredrik
** INFO: 22:44:25.635:     HiSyncId 3980162077088088327
** INFO: 22:44:25.635:     Side:      left (binaural)
** INFO: 22:44:25.635:     Delay:     89 ms
** INFO: 22:44:25.635:     Streaming: supported
** INFO: 22:44:25.635:     Codecs:    G.722
on_change_state old: UNCONNECTED  new: CONNECTING 
** INFO: 22:44:25.638: Adding Sink 3980162077088088327 Fredrik
on_change_state old: CONNECTING  new: PAUSED 
** INFO: 22:44:25.640: Adding bluetooth device Fredrik
on_change_state old: PAUSED  new: STREAMING 
** INFO: 22:44:25.679: Name:      Fredrik
** INFO: 22:44:25.679:     HiSyncId 3980162077088088327
** INFO: 22:44:25.679:     Side:      right (binaural)
** INFO: 22:44:25.679:     Delay:     89 ms
** INFO: 22:44:25.679:     Streaming: supported
** INFO: 22:44:25.679:     Codecs:    G.722
** INFO: 22:44:25.689: Adding left device to Fredrik

** (process:4885): WARNING **: 22:44:25.775: Failed to connect l2cap channel: Connection refused

** (process:4885): ERROR **: 22:44:25.815: Failed to connect to Fredrik (Left)
Trace/breakpoint trap (core dumped)

I will reboot and try again...

MadSpindel commented 4 months ago

I had to reboot the hearing aids...

Is it possible to have asha_pipewire_sink to connect to the hearing aids when it starts? And that it tries to reconnect if disconnected?

Anyway:

export G_MESSAGES_DEBUG=all
./asha_pipewire_sink 
** INFO: 22:57:53.594: Starting...
(process:4930): GLib-GIO-DEBUG: 22:57:53.594: Using cross-namespace EXTERNAL authentication (this will deadlock if server is GDBus < 2.73.3)
** INFO: 22:57:53.605: Adding bluetooth device Fredrik
** INFO: 22:57:53.633: Name:      Fredrik
** INFO: 22:57:53.633:     HiSyncId 3980162077088088327
** INFO: 22:57:53.633:     Side:      left (binaural)
** INFO: 22:57:53.633:     Delay:     89 ms
** INFO: 22:57:53.633:     Streaming: supported
** INFO: 22:57:53.633:     Codecs:    G.722
on_change_state old: UNCONNECTED  new: CONNECTING 
** INFO: 22:57:53.636: Adding Sink 3980162077088088327 Fredrik
on_change_state old: CONNECTING  new: PAUSED 
** INFO: 22:57:53.638: Adding bluetooth device Fredrik
on_change_state old: PAUSED  new: STREAMING 
** INFO: 22:57:53.689: Name:      Fredrik
** INFO: 22:57:53.689:     HiSyncId 3980162077088088327
** INFO: 22:57:53.689:     Side:      right (binaural)
** INFO: 22:57:53.689:     Delay:     89 ms
** INFO: 22:57:53.689:     Streaming: supported
** INFO: 22:57:53.689:     Codecs:    G.722
** INFO: 22:57:53.691: Adding left device to Fredrik
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
** INFO: 22:57:53.933: Adding right device to Fredrik
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Why was process called with no buffers?
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 7 Total: 7
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7

** (process:4930): WARNING **: 22:58:28.230: Dropping frame for Fredrik (Right)
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 4 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 2 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7

** (process:4930): WARNING **: 22:59:05.972: Dropping frame for Fredrik (Left)

** (process:4930): WARNING **: 22:59:12.251: Dropping frame for Fredrik (Right)

** (process:4930): WARNING **: 22:59:12.271: Dropping frame for Fredrik (Right)
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
Ring Occupancy: 3 High: 5 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 7
** INFO: 22:59:39.370: Removing bluetooth device Fredrik

** (process:4930): WARNING **: 22:59:39.371: Disconnected from Fredrik (Right): (Connection reset by peer)
** INFO: 22:59:39.433: Removing bluetooth device Fredrik

** (process:4930): WARNING **: 22:59:39.452: Disconnected from Fredrik (Left): (Connection reset by peer)
** INFO: 22:59:39.521: Removing Sink 3980162077088088327 Fredrik
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 18446744073709551609 Total: 0
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 0
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 0
Ring Occupancy: 0 High: 0 Ring Dropped: 0 Total: 0 Adapter Dropped: 0 Total: 0
thewierdnut commented 4 months ago

Are your hearing devices paired with your iphone? Is it trying to take control of them?

When I switch my hearing aids from my laptop to my phone to my desktop, I usually have to delete any existing pairings, restart my hearing aids, and re-pair them from scratch.

thewierdnut commented 4 months ago

Trace/breakpoint trap (core dumped)

Do you know how to load that core in gdb and produce a backtrace? If not, can you rerun cmake with cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=1 so that next time it dumps the backtrace to the console?

MadSpindel commented 4 months ago

Are your hearing devices paired with your iphone? Is it trying to take control of them?

When I switch my hearing aids from my laptop to my phone to my desktop, I usually have to delete any existing pairings, restart my hearing aids, and re-pair them from scratch.

Yes, my hearing aids are connected to my iPhone, one Oticon ConnectClip and an Oticon TV Adapter. They connect automatically to my phone as MFI hearing aids. If I start my Oticon ConnectClip, it will connect to my hearing aids as well. As long as I don't use any audio (listening on Spotify, Youtube, calls etc.) on my iPhone, it will stream from my ConnectClip as long it's on and receiving audio from my computer. But as soon as I receive any audio from my iPhone, it will take over the connection. (It's only when audio btw, I can use the Oticon Companion app and stream audio from asha_pipewire_sink at the same time with no issues.) And when the audio from my iPhone stops, the ConnectClip will try to reconnect again (often it takes a couple of seconds - which could be a little bit annoying when I'm on a Teams call on my computer).

Something similar should be possible with ASHA, I guess. If possible, it would be great if asha_pipewire_sink could try to reconnect when the hearing aids are Disconnected. It looks like asha_pipewire_sink works really well if it doesn't get interfered by my iPhone. In fact, it works much better than the Oticon ConnectClip. With the Oticon ConnectClip the latency is higher, the sound quality is lower/harsher - it's not even close!

To use the Oticon TV Adapter, I need to switch to it from the Oticon Companion app or use the buttons on the hearing aids (hold the volume up button for some seconds).

Trace/breakpoint trap (core dumped)

Do you know how to load that core in gdb and produce a backtrace? If not, can you rerun cmake with cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=1 so that next time it dumps the backtrace to the console?

No, but I will try, thanks.

thewierdnut commented 4 months ago

Those are probably responding to service advertisements. I don't have that implemented, but I'll see what I can do.

thewierdnut commented 4 months ago

I've added a reconnect issue (#15) and added your device to the wiki. Please continue testing and let me know if you run across any other issues.