Android: expose the device's own type (`AudioDeviceInfo.getType()`) in `DeviceDescription`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- android, rust
- Ambito
- audio-video-rtc, backend
Direzione di ricerca
Start by reading the Android AAudio host code that builds DeviceDescription and the existing java_interface::AudioDeviceType definition; the issue names both but gives no file paths. Check how DeviceDescription and DeviceDescriptionBuilder are exposed through cpal::platform, then compare the implementation with the proposal. Done means Android callers can retrieve the original device type and existing behavior on other platforms remains unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Android: expose the device's own type (AudioDeviceInfo.getType()) in DeviceDescription
cpal 0.18.2, AAudio host.
The problem
On Android, DeviceDescription::device_type() and interface_type() are
derived from AudioDeviceInfo.getType(), but several of Android's types map
to the same pair, so an app can't tell them apart:
TYPE_BUILTIN_SPEAKERandTYPE_BUILTIN_SPEAKER_SAFE(the speaker's route
for alarms and notifications): both "Speaker", built in. Both are listed,
both named "Speaker" on a Pixel.TYPE_BLUETOOTH_SCO(a headset's link for calls) andTYPE_BLE_HEADSET:
both "Headset", Bluetooth.TYPE_TELEPHONYfalls intoUnknownwith many others, so devices meant
for calls (which an app playing music wants to mark or leave out) can't
all be recognised: the earpiece can, the call link (SCO) and telephony
can't.
The device id doesn't help either: Android gives a Bluetooth device a new id
each time it connects (we saw 28087, then 28061 for the same headphones), so
an app that remembers the user's chosen output needs something stable to
recognise it by. Android's type, the name and the visible part of the address
do that, but the type is lost in the mapping.
Proposal
An Android-only getter beside the existing ones, giving the type as Android
reports it, and the type exported from cpal::platform:
#[cfg(target_os = "android")]
impl DeviceDescription {
/// Android's own type of the device (`AudioDeviceInfo.getType()`), which
/// `device_type()` and `interface_type()` merge.
pub fn android_type(&self) -> Option<cpal::platform::AndroidDeviceType>;
}
AndroidDeviceType is the existing java_interface::AudioDeviceType, made
public (plus PartialEq, Eq, Hash), and DeviceDescriptionBuilder gets
an android_type(..) method that the AAudio host calls with
info.device_type. Nothing changes on other platforms or for existing
callers.
The attached patch (against 0.18.2, about 120 lines) does this; we use it
in our app through [patch.crates-io]. Happy to open a pull request against
master if the shape is acceptable (a field on DeviceDescription, or would
you rather have a platform extension trait?).
- Lingua principale
- Rust
- Stelle
- 4k
- Fork
- 554
- Merge medio
- 1g 3h
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RustAudio/cpal
-
API design
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
correctness
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)Forse già presa @dannyward630 l’ha presa 39 giorni fa. Apertahost - aaudio platform - android
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
-
WebAudio wasm build fails with wasm-bindgen panic=unwind closuresForse già presa @bogusyogi l’ha presa 48 giorni fa. Apertahost - webaudio platform - web
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
PipeWire: dropping callback captures on the realtime worker can terminate the process with SIGXCPUApertahost - pipewire platform - linux
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di RustAudio/cpal
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
ci: migrate pinned macos-15 runners to macos-26 and macos-26-intelForse già presa @hawkingrei l’ha presa oggi. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
nowledge-co/hawdb#2224 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
eclipse-score/coverage_tool#95 ·
I maintainer di solito rispondono entro 2 giorni
-
bug nvim
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100