Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ALSA PCM plugin compatibility on a2dp-sink, hfp-hf and hsp-hs #745

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

borine
Copy link
Collaborator

@borine borine commented Dec 20, 2024

Permit a BlueALSA PCM to be used more like a hw PCM on a2dp-sink, hfp-hf and hsp-hs nodes by making the PCM capture delay value more useful, and by offering a choice of operating modes to suit different application requirements when a PCM exists but the stream does not offer any samples.

Closes #743

For capture PCMs, Bluetooth does not report its delay, so the value
given by the D-Bus interface is not useful to an ALSA PCM. Therefore
report only the delay represented by the samples in the ring buffer;
this is the minimum required to comply with the ALSA specification
and is sufficient to support applications such as `alsaloop` which
require a meaningful delay value to function correctly.

Also discard any stale samples in the FIFO when preparing a capture
PCM to to ensure a fresh start, especially after overrun.
max_capacity = 1048576; /* Linux default max pipe size */
}
fclose(proc_file);
if (target_capacity > max_capacity)

Check failure

Code scanning / CodeQL

Missing return-value check for a 'scanf'-like function High

This variable is read, but may not have been written. It should be guarded by a check that the
call to fscanf
returns at least 1.
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 43.36283% with 128 lines in your changes missing coverage. Please review.

Project coverage is 69.92%. Comparing base (951d31b) to head (3d45cda).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/asound/bluealsa-pcm.c 43.11% 128 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #745      +/-   ##
==========================================
- Coverage   70.43%   69.92%   -0.52%     
==========================================
  Files          96       96              
  Lines       16025    16178     +153     
  Branches     2515     2553      +38     
==========================================
+ Hits        11288    11312      +24     
- Misses       4618     4747     +129     
  Partials      119      119              

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant