mirror of https://github.com/jetkvm/kvm.git
Fix: pcm_snd_wait won't work when device is busy
This commit is contained in:
parent
b040b8feaf
commit
ebb79600b0
|
@ -364,9 +364,14 @@ retry_read:
|
||||||
} else {
|
} else {
|
||||||
// Other errors - limited retry for transient issues
|
// Other errors - limited retry for transient issues
|
||||||
recovery_attempts++;
|
recovery_attempts++;
|
||||||
if (recovery_attempts <= 1 && (pcm_rc == -EINTR || pcm_rc == -EBUSY)) {
|
if (recovery_attempts <= 1 && pcm_rc == -EINTR) {
|
||||||
|
// Interrupted system call - use device-aware wait
|
||||||
snd_pcm_wait(pcm_capture_handle, sleep_microseconds / 2000);
|
snd_pcm_wait(pcm_capture_handle, sleep_microseconds / 2000);
|
||||||
goto retry_read;
|
goto retry_read;
|
||||||
|
} else if (recovery_attempts <= 1 && pcm_rc == -EBUSY) {
|
||||||
|
// Device busy - simple sleep to allow other operations to complete
|
||||||
|
usleep(sleep_microseconds / 2);
|
||||||
|
goto retry_read;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue