Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera frozen when putting app in background for a while and go back #555

Open
tuan-jason opened this issue Dec 11, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@tuan-jason
Copy link

tuan-jason commented Dec 11, 2024

Describe the bug
Front camera is frozen after putting app in background for a while (~1 min) then putting it back in foreground

To Reproduce
Steps to reproduce the behavior:

  1. Connect to a LiveKit room.
  2. Publish a local video track using self-created CameraCapturer and show it in a TextureViewRenderer
  3. Put app in background after making sure front camera view is displaying properly
  4. Open the app again after a while (1-2 mins) (or to be exact, when you can see the below logcat exception) and observe the front camera view.

Camera2Session: Error: Camera device could not be opened due to a device policy.
Camera2Session: Stop internal
Session 0: Exception while stopping repeating: (Ask Gemini)
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2429)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1329)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579)
at livekit.org.webrtc.Camera2Session.stopInternal(Camera2Session.java:384)
at livekit.org.webrtc.Camera2Session.reportError(Camera2Session.java:405)
at livekit.org.webrtc.Camera2Session.-$$Nest$mreportError(Unknown Source:0)
at livekit.org.webrtc.Camera2Session$CameraStateCallback.onError(Camera2Session.java:110)
at android.hardware.camera2.impl.CameraDeviceImpl.notifyError(CameraDeviceImpl.java:1809)
at android.hardware.camera2.impl.CameraDeviceImpl.$r8$lambda$KBQCqQRdhVVn7uHI9Xdha6OqnsU(Unknown Source:0)
at android.hardware.camera2.impl.CameraDeviceImpl$$ExternalSyntheticLambda0.accept(Unknown Source:8)
at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:281)
at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)

Expected behavior
Camera frames should not be frozen

Device Info:

  • Device: Google Pixel 3a
  • OS: Android 12
  • LiveKit SDK version: 2.10.0 (exactly at this commit in main branch: db34adb)

Bug report

We shared via direct message in Slack to @davidliu due to potentially sensitive information.

Patch file to recreate issue
Reproduce_a_camera_frozen_issue.patch

@tuan-jason tuan-jason added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant