google / google/oboe

setPreferredMixerAttributes for non-USB devices

Open
#2,194 1 comment 0 reactions 1 assignee Claimed by @flamme View on GitHub
Dominant language
C++
Stars
4.1k
Forks
639
Avg merge
2d 23h
Merged PRs (30d)
8

Description

After the discussion in #2190 I was thinking about setPreferredMixerAttributes, and I was wondering why only USB devices are supported. It seems to be on purpose, but not really a inherent limitation of the approach as all devices have mix port profiles, hence I was wondering what the background was.

Right now, audio policy's decision to always open mix ports at highest rate creates some awkward situations;
When I play a 44.1kHz audio file in power saving mode (but not compressed offload), and I have attached AAC bluetooth headphones in A2DP offload mode, on my Pixel 7a we will get a useless double-conversion:
deep buffer mix port is always opened at 48kHz, hence AF has to upsample my track, and AoC has to downsample again because the AAC codec operates at 44.1kHz via bluetooth.
If the audio HAL declared 44100 sample rate, that situation would nontheless not improve because policy always prefers 48000 because it's higher. But if HAL declared 44100 and 48000, and setPreferredMixerAttributes was allowed for all device types, the app could ask policy to set sample rate to 44100 instead and the double conversion would be avoided. I'm not sure if there's another elegant solution to that problem.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.