Draft: bluez5: rate match whole ISO group as one
Now that all nodes in the ISO group set node.group and are scheduled together with same clock, do rate matching to ISO rate in a better way.
-
Pick one node as 'leader' that rate matches as usual
-
Other nodes resync playback position with that node (drop samples / insert silence to align), and use the same rate correction.
-
When the driver is one of the nodes of the group, turn off rate matching in all nodes, as it's not needed.
Playback position resync only occurs when some node fails to be scheduled, but then we have a playback glitch in any case. Resync occurs also at playback start.
This avoids TWS left/right playback sync oscillating for a brief time at playback start or when there are scheduling glitches, as the nodes previously rate matched independently. (This does not address the HW issue that causes persistent desync, though.)
I guess they can be one sample off if the resamplers are not in same phase.
To fight Pipewire design less, one could instead have one big ISO group node with channels for all connected devices, and then have front-end nodes that split it to the individual logical device nodes. Different devices in group can have different samplerates, so it has to be separate nodes like now.
-
figure out if common rate matching can work with different samplerates in same group