mirror of https://github.com/jetkvm/kvm.git
Problem: Previous fix reduced but didn't eliminate the hang when switching audio sources. The C layer was still blocking on snd_pcm_readi()/snd_pcm_writei() while holding the mutex, preventing cleanup from proceeding. Solution: Call snd_pcm_drop() BEFORE acquiring the mutex in close functions. This immediately interrupts any blocking ALSA read/write operations, causing them to return with -EBADFD or -ESTRPIPE. The sequence is now: 1. Set stop_requested flag 2. Call snd_pcm_drop() to interrupt blocking I/O (no mutex needed - thread-safe) 3. Acquire mutex for cleanup 4. Close handles and free resources 5. Release mutex This makes audio source switching instantaneous with zero hang. Changes: - jetkvm_audio_capture_close(): Drop PCM before mutex - jetkvm_audio_playback_close(): Drop PCM before mutex Tested: USB↔HDMI switching now happens instantly with no delay. |
||
|---|---|---|
| .. | ||
| audio | ||
| confparser | ||
| hidrpc | ||
| logging | ||
| mdns | ||
| native | ||
| network/types | ||
| sync | ||
| timesync | ||
| tzdata | ||
| usbgadget | ||
| utils | ||
| websecure | ||