Skip to content

alsa: Calling Host::input_devices() breaks Host::output_devices(), and vice versa #615

@ssssam

Description

@ssssam

To reproduce: find a device name that supports capture and playback (you can use aplay -L and arecord -L), then pass it as poth input and output to feedback example:

> cargo run --example feedback sysdefault:CARD=sofhdadsp sysdefault:CARD=sofhdadsp
thread 'main' panicked at 'failed to find output device', cpal/examples/feedback.rs:119:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Note the device name is same input and output, and it exists when we call input_devices() but not when we call output_devices(). The cause: the second time we iterate Devices, the code calls DeviceHandles::open() on the device and returns EBUSY, so the iterator doesn't return the device.

The code in feedback.rs has not actually opened the device, so perhaps the iterator isn't correctly freeing the handle after opening it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions