opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
211 stars 169 forks source link

Call is in background but camera stopped with exception. #453

Closed ManojCommscope closed 1 year ago

ManojCommscope commented 1 year ago

2023-03-09 14:40:45.773 17115-17115/com.homesight.videocall E/libc: Access denied finding property "vendor.camera.aux.packagelist" 2023-03-09 14:40:45.774 17115-17115/com.homesight.videocall E/libc: Access denied finding property "vendor.camera.aux.packagelist" 2023-03-09 14:40:45.783 17115-17115/com.homesight.videocall E/libc: Access denied finding property "persist.vendor.camera.privapp.list" 2023-03-09 14:40:46.183 17115-17161/com.homesight.videocall E/libc: Access denied finding property "vendor.camera.aux.packagelist" 2023-03-09 14:40:46.189 17115-17161/com.homesight.videocall E/libc: Access denied finding property "vendor.camera.aux.packagelist" 2023-03-09 14:40:46.204 17115-17115/com.homesight.videocall E/CameraCaptureSession: Session 0: Exception while stopping repeating: android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): checkPidStatus:2047: The camera device has been disconnected at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:829) at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97) at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1151) at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:527) at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:738) at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) Caused by: android.os.ServiceSpecificException: checkPidStatus:2047: The camera device has been disconnected (code 4) at android.os.Parcel.createException(Parcel.java:2085) at android.os.Parcel.readException(Parcel.java:2039) at android.os.Parcel.readException(Parcel.java:1987) at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:658) at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:95) at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1151)  at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:527)  at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:738)  at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245)  at android.os.Handler.handleCallback(Handler.java:883)  at android.os.Handler.dispatchMessage(Handler.java:100)  at android.os.Looper.loop(Looper.java:214)  at android.app.ActivityThread.main(ActivityThread.java:7397)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)  2023-03-09 14:40:47.956 17115-17115/com.homesight.videocall D/v

Android Version = 10 Device : Custom Android Device

ManojCommscope commented 1 year ago

Issue seen after improvemnt work with framerate and resolution for publisher. earlier it was working fine but video quality was not good

ManojCommscope commented 1 year ago

look like calling of camera from different thread

ManojCommscope commented 1 year ago

look like got the root cause.

the very first time there is no exception showing in log.

but once we end the call and start the call again we see this exception.

From OpenTok not closing the camera or not closing properly when we end the call and when user join or connect the session again from OpenTok closing and opening again.

CameraCaptureSession: Session 0: Exception while stopping repeating: android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): checkPidStatus:2047: The camera device has been disconnected

Please fix this issue or let me know if any workaround from app side.

v-kpheng commented 1 year ago

Thanks, @ManojCommscope, for letting us know about this issue.

To clarify, can you please tell us what the steps to reproduce are? Also, does this affect all Android phones? Or, just some? Thanks!