Skip to content

Conversation

@borine
Copy link
Collaborator

@borine borine commented May 8, 2025

Permit more than one client to open each PCM. For playback clients, the streams from each client are mixed together before encoding. For capture clients each client receives a copy of the decoded stream.

Stream mixing is done in C code, there is no explicit SIMD code. However, compiling with -O3 does appear to allow gcc to optimize the mix loop very well on x86_64. I have not tested optimization with aarch64 (my old RPi machines are all 32-bit with no SIMD); but even without optimization I can run 3 playback clients simultaneously on a RPi zero W.

There was some interest in this feature three years ago, but there have been only a few enquiries more recently. I think this is pushing the scope boundary a little, as for most systems requiring multiple simultaneous audio applications there are also other requirements which mean that pipewire is probably a better fit. However I do have one genuine use case which is a "kiosk" system running only chromium which requires each chromium tab to independently open the PCM; and for this system BlueALSA with multi-client support is ideal.

@codecov
Copy link

codecov bot commented May 8, 2025

Codecov Report

❌ Patch coverage is 63.78803% with 369 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.21%. Comparing base (29cfde6) to head (b41a35b).

Files with missing lines Patch % Lines
src/ba-pcm-client.c 53.46% 141 Missing ⚠️
src/ba-pcm-multi.c 71.83% 98 Missing ⚠️
src/ba-pcm-mix-buffer.c 59.57% 76 Missing ⚠️
src/main.c 0.00% 19 Missing ⚠️
src/asound/bluealsa-pcm.c 42.85% 16 Missing ⚠️
test/test-io.c 84.44% 8 Missing and 6 partials ⚠️
src/ba-transport-pcm.c 81.25% 3 Missing ⚠️
src/bluealsa-dbus.c 88.23% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #762      +/-   ##
==========================================
- Coverage   69.47%   69.21%   -0.26%     
==========================================
  Files         118      121       +3     
  Lines       17303    18291     +988     
  Branches     2739     2910     +171     
==========================================
+ Hits        12021    12660     +639     
- Misses       5162     5505     +343     
- Partials      120      126       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arkq

This comment was marked as resolved.

@borine

This comment was marked as resolved.

@borine

This comment was marked as resolved.

@arkq

This comment was marked as resolved.

@arkq

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants