Android: expose the device's own type (`AudioDeviceInfo.getType()`) in `DeviceDescription`
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- android, rust
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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?).
- 主要言語
- Rust
- スター
- 4k
- フォーク
- 554
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RustAudio/cpal のほかの issue
-
API design
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
correctness
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)対応中かも @dannyward630 が 39 日前に担当しました。 オープンhost - aaudio platform - android
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
-
WebAudio wasm build fails with wasm-bindgen panic=unwind closures対応中かも @bogusyogi が 48 日前に担当しました。 オープンhost - webaudio platform - web
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
PipeWire: dropping callback captures on the realtime worker can terminate the process with SIGXCPUオープンhost - pipewire platform - linux
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
ci: migrate pinned macos-15 runners to macos-26 and macos-26-intel対応中かも @hawkingrei が今日担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
nowledge-co/hawdb#2224 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
eclipse-score/coverage_tool#95 ·
メンテナーはふだん 2 日以内に返信
-
bug nvim
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100