fix(audio): restart capture when the device is unavailable (#16142)

* fix(audio): restart capture when the device is unavailable

* refact: remove low-value test

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2026-09-10 15:32:49 +08:00
committed by GitHub
parent 5cfe136fb0
commit 978e2e28b9

View File

@@ -11,7 +11,10 @@ pub(super) struct CaptureErrorHandler {
impl CaptureErrorHandler {
pub(super) fn handle(&self, error: cpal::StreamError) {
if matches!(error, cpal::StreamError::StreamInterrupted { .. }) {
if matches!(
error,
cpal::StreamError::StreamInterrupted { .. } | cpal::StreamError::DeviceNotAvailable
) {
// ScreenCaptureKit can stop capture while the remote session stays open.
// The observed -3821 error does not identify its underlying trigger.
// https://developer.apple.com/documentation/screencapturekit/scstreamdelegate/stream(_:didstopwitherror:)