From 9555d3a537a828731ad89ef5258ba537acf8cc11 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 3 Dec 2024 23:06:33 +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; }