From 9b620b56c41327ea2fbb54d0ca6ae0662e12e9fe Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 3 Dec 2024 11:20:34 +0100 Subject: [PATCH] Retry capture on IOException If the capture fails with an IOException, retry with a lower resolution. Fixes #5539 --- .../main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java index bc120107b2..1402eceb14 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java @@ -112,8 +112,8 @@ private void streamCapture() throws IOException, ConfigurationException { // The capture might have been closed internally (for example if the camera is disconnected) alive = !stopped.get() && !capture.isClosed(); } - } catch (IllegalStateException | IllegalArgumentException e) { - Ln.e("Encoding error: " + e.getClass().getName() + ": " + e.getMessage()); + } catch (IllegalStateException | IllegalArgumentException | IOException e) { + Ln.e("Capture/encoding error: " + e.getClass().getName() + ": " + e.getMessage()); if (!prepareRetry(size)) { throw e; }