Retry capture on IOException

If the capture fails with an IOException, retry with a lower resolution.

Fixes #5539 <https://github.com/Genymobile/scrcpy/issues/5539>
This commit is contained in:
Romain Vimont 2024-12-03 23:06:33 +01:00
parent aea6a371aa
commit 9555d3a537

View File

@ -112,8 +112,8 @@ public class SurfaceEncoder implements AsyncProcessor {
// 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;
}