Platform Audio: device-selection capability + explicit mobile no-op#1156
Open
MaxHeimbrock wants to merge 3 commits into
Open
Platform Audio: device-selection capability + explicit mobile no-op#1156MaxHeimbrock wants to merge 3 commits into
MaxHeimbrock wants to merge 3 commits into
Conversation
Device selection is only meaningful on desktop; on iOS/Android the OS owns audio routing (AVAudioSession / AudioManager). Previously the "no-op on mobile" was accidental — a fallback in the native layer selected index 0 whenever a GUID didn't match — which also silently swallowed a real desktop error (a saved device that no longer exists). - proto: add PlatformAudioInfo.device_selection_supported. - PlatformAudio::supports_device_selection() — false on iOS/Android, true on desktop. Lets clients hide device-picker UI where selection has no effect. - set_/switch_ recording/playout device short-circuit to Ok(()) on mobile before touching native, so the no-op is explicit rather than dependent on native device-reporting quirks (iOS RecordingDeviceName -1; Android empty GUID). - ffi server populates the new field from the accessor. - webrtc-sys: drop the index-0 fallback in set_*_device_by_guid so an unknown GUID returns false -> DeviceNotFound on desktop; mobile never reaches it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
ChangesetThe following package versions will be affected by this PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes platform-audio device selection behave explicitly per platform and exposes a capability flag clients can query.
PlatformAudioInfo.device_selection_supported(new proto field) — surfaced so bindings/clients can hide device-picker UI where selection has no effect.PlatformAudio::supports_device_selection()—falseon iOS/Android,trueon desktop.set_recording_device/set_playout_device/switch_recording_device/switch_playout_deviceshort-circuit toOk(())on iOS/Android before touching native, instead of relying on native device-reporting quirks (iOSRecordingDeviceNamereturns -1; Android reports a single GUID-less device).webrtc-sysset_*_device_by_guidno longer falls back to index 0 on a GUID miss — an unknown GUID returnsfalse→DeviceNotFound. This lets a caller detect "the saved device is gone" instead of silently landing on the default. Mobile never reaches this path now.Why
The previous "no-op on mobile" was accidental — it fell out of the index-0 fallback in
audio_device_controller.cpp, which conflated the mobile-unsupported case with a legitimate desktop error (stale GUID).Notes
main); may need a rebase ontomainbefore merge.PlatformAudio.IsDeviceSelectionSupported, sample + tests) is a stacked PR inclient-sdk-unitythat bumps the submodule to this commit.cargo fmtapplied;cargo build -p livekit-fficlean.🤖 Generated with Claude Code