Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pulseaudio pulseaudio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 902
    • Issues 902
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 48
    • Merge requests 48
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PulseAudioPulseAudio
  • pulseaudiopulseaudio
  • Merge requests
  • !528

bluetooth: Set up hardware gain control if init volume is received late

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Marijn Suijten requested to merge MarijnS95/pulseaudio:late-bound-hardware-volume into master Mar 16, 2021
  • Overview 9
  • Commits 1
  • Pipelines 5
  • Changes 1

Fixes a regression from !521 (merged):
Hardware volume is not set up when switching from A2DP to HFP and the device sends AT+VGS too late (perhaps device-specific, happens at least on the WH1000-XM3s), leading to desyncs and the attenuation being applied twice.


Originally written for A2DP this rework of that patch enables late-bound hardware volume control on HFP and HSP. As per the specification the headphones (where gain control for both speaker and microphone could happen in hardware on the peer) are supposed to send initial values for these before the SCO connection is created; these AT+VG[MS] commands are also used to determine support for it. PA uses this information in add_{sink,source} to attach hardware volume callbacks, if it is supported. Otherwise PA performs the attenuation in software.

Unfortunately headphones like the WH-1000XM3's connect to A2DP initially and only send AT+VGS (microphone hardware gain is not supported) during SCO connection when the user switches to the HFP profile afterwards; the callbacks set up dynamically in rfcomm_io_callback are written after the sink and source have been created (add_{sink,source}), leaving them without hardware volume callbacks and with software volume when adjusted on the PA side. (The headphones can still send volume updates resulting in abrupt changes if software and peer volume differ. Furthermore the same attenuation is applied twice - once in PA software, once on the peer).

To solve this problem we simply check whether the callbacks have been attached whenever the peer sends a volume change, and if not attach the callbacks to the sink/source and reset software volume.

Fixes: d510ddc7 ("bluetooth: Perform software attenuation until HF/HS reports gain control")
CC @igor.v.kovalenko

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: late-bound-hardware-volume