Skip to content

Display and control your Android device

Stop the repeating capture request on camera stop

MathBach3296957c0f5140
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/CameraCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/CameraCapture.java
index 1aaeafa5..fb529693 100644
--- a/server/src/main/java/com/genymobile/scrcpy/video/CameraCapture.java
+++ b/server/src/main/java/com/genymobile/scrcpy/video/CameraCapture.java
@@ -357,6 +357,14 @@ public class CameraCapture extends SurfaceCapture {
public void stop() {
cameraHandler.post(() -> {
assertCameraThread();
+ if (currentSession != null) {
+ try {
+ currentSession.stopRepeating();
+ } catch (CameraAccessException | IllegalStateException e) {
+ // The session may already be closed (for example if the camera has been disconnected)
+ Ln.d("Could not stop repeating capture request: " + e.getMessage());
+ }
+ }
currentSession = null;
requestBuilder = null;
started = false;