-
Notifications
You must be signed in to change notification settings - Fork 467
fix(alsa): hybrid enumeration and direction detection #1081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
10aa237 to
c4d9996
Compare
Combines ALSA hints with physical card probing to ensure all hardware devices are enumerated, even when hints don't list them. - Add hybrid enumeration: hints (virtual/configured) + physical probing - Add direction detection from hint metadata and physical hardware - Add Default implementation for Device - Remove unused StreamType enum Fixes #1079
c4d9996 to
e2f8abf
Compare
e2f8abf to
2ad6603
Compare
calwe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I obviously don't feel qualified to give a technical review in this code base, these changes do in fact work for me - and correctly show both the virtual devices from hints, and now the same hardware devices that would appear in 0.16. Cheers!
Per ALSA docs, NULL IOID indicates both input and output; mark hints with NULL as DeviceDirection::Duplex. Whether a stream actually works in a direction must be determined by attempting to open it.
39541ba to
bab2fdd
Compare
* Don't open devices during enumeration to avoid leaking file descriptors from failed snd_pcm_open (e.g. alsaequal returning EPERM). * Treat EPERM and EAGAIN like ENOENT/EBUSY and return DeviceNotAvailable.
* Map ENOENT, EBUSY, EPERM and EAGAIN returned when taking a PCM handle to DeviceNotAvailable. * Add a comment to clarify reuse of cached device handles to avoid opening the device twice. * Minor documentation improvements.
bab2fdd to
dfec6ac
Compare
Thank you for the feedback and testing! Your confirmation helped uncover two additional issues that needed addressing:
None of this is ideal. Applications will need to attempt opening a stream to be certain that a particular direction works. But it provides better compatibility across real-world ALSA configurations. If you could give this a final whirl on your systems too, this could warrant releasing a patch release sometime soon. |
|
For posterity I want to mention that this'll show most virtual devices are capture devices. Typically most of them won't actually be capture devices, but, the fact that And for playback, output from |
Fixes device enumeration on systems where ALSA hints don't include physical devices.
DeviceDirection::Input/Output/Duplex/Unknownbased on hint metadata and hardware capabilities (previously all devices reportedNone)Defaultimplementation that returns the ALSA "default" deviceFixes #1079