Hello, I have an app written in Kotlin with parts for WebRTC streaming. During live preview and streaming of the camera, and specifically on Android 14 Galaxy devices (S911B) I notice that the camera freezes irrecoverably.
These are some of the logs that the provider service prints:
2024-02-23 23:04:30.754 21733-21739 CamX ven...re.camera.provider-service_64 E [ERROR][CSL ] camxcslhwinternal.cpp:1735 CSLHwInternalSendRequestManagerEvent() frame error: type 5, code 128,requestID 252, device hdl 8061192
2024-02-23 23:04:30.754 21733-21739 CamX ven...re.camera.provider-service_64 E [ERROR][CORE ] camxpipeline.cpp:5957 CSLMessageHandler() request id 252, error type = 5, device handle = 8061192, resource index = 0
2024-02-23 23:04:30.754 21733-21739 CamX ven...re.camera.provider-service_64 E [ERROR][CORE ] camxpipeline.h:3506 SetFullRecoveryFlag() SetFullRecoveryFlag : 1
2024-02-23 23:04:30.754 21733-21739 libc ven...re.camera.provider-service_64 I Requested dump for pid 21733 (binder:21733_2)
2024-02-23 23:04:30.832 21733-21937 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxusecase.cpp:4554 PrepareForRecovery() Usecase:3 cameraId:2 is in bad state.
2024-02-23 23:04:30.832 21733-21937 CamX ven...re.camera.provider-service_64 E [ERROR][HAL ] camxhaldevice.cpp:871 Notify() type 00000001, frame_number 242, error_code 00000002, error_stream 0x0
2024-02-23 23:04:30.833 21733-21937 CamX ven...re.camera.provider-service_64 E [ERROR][HAL ] camxhaldevice.cpp:871 Notify() type 00000001, frame_number 243, error_code 00000002, error_stream 0x0
2024-02-23 23:04:30.833 21733-21937 CamX ven...re.camera.provider-service_64 E [ERROR][HAL ] camxhaldevice.cpp:871 Notify() type 00000001, frame_number 244, error_code 00000002, error_stream 0x0
2024-02-23 23:04:30.833 21733-21937 CamX ven...re.camera.provider-service_64 E [ERROR][HAL ] camxhaldevice.cpp:871 Notify() type 00000001, frame_number 245, error_code 00000002, error_stream 0x0
2024-02-23 23:04:30.833 21733-21937 CamX ven...re.camera.provider-service_64 E [ERROR][HAL ] camxhaldevice.cpp:871 Notify() type 00000001, frame_number 246, error_code 00000002, error_stream 0x0
2024-02-23 23:04:30.833 21733-21937 CamX ven...re.camera.provider-service_64 E [ERROR][HAL ] camxhaldevice.cpp:871 Notify() type 00000001, frame_number 247, error_code 00000002, error_stream 0x0
2024-02-23 23:04:33.945 21733-21733 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxutils.cpp:459 WaitForSemaphore() Waited for Semaphore timed out 3198 ms
2024-02-23 23:04:37.145 21733-21733 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxutils.cpp:459 WaitForSemaphore() Waited for Semaphore timed out 3198 ms
2024-02-23 23:04:40.344 21733-21733 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxutils.cpp:459 WaitForSemaphore() Waited for Semaphore timed out 3198 ms
2024-02-23 23:04:43.544 21733-21733 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxutils.cpp:459 WaitForSemaphore() Waited for Semaphore timed out 3198 ms
2024-02-23 23:04:46.742 21733-21733 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxutils.cpp:459 WaitForSemaphore() Waited for Semaphore timed out 3198 ms
2024-02-23 23:04:49.941 21733-21733 CHIUSECASE ven...re.camera.provider-service_64 E [ERROR ] chxutils.cpp:459 WaitForSemaphore() Waited for Semaphore timed out 3198 ms
This also results in a crash of the provider service, as can be seen here:
12-30 11:08:13.589 31515 31515 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-30 11:08:13.589 31515 31515 F DEBUG : Build fingerprint: 'samsung/dm1qxxx/dm1q:14/UP1A.231005.007/S911BXXS3BWKC:user/release-keys'
12-30 11:08:13.589 31515 31515 F DEBUG : Revision: '13'
12-30 11:08:13.589 31515 31515 F DEBUG : ABI: 'arm64'
12-30 11:08:13.589 31515 31515 F DEBUG : Processor: '1'
12-30 11:08:13.589 31515 31515 F DEBUG : Timestamp: 2023-12-30 11:08:13.499199839+0200
12-30 11:08:13.589 31515 31515 F DEBUG : Process uptime: 0s
12-30 11:08:13.589 31515 31515 F DEBUG : Cmdline: /vendor/bin/hw/vendor.samsung.hardware.camera.provider-service_64
12-30 11:08:13.589 31515 31515 F DEBUG : pid: 28740, tid: 28740, name: binder:28740_2 >>> /vendor/bin/hw/vendor.samsung.hardware.camera.provider-service_64 <<<
12-30 11:08:13.589 31515 31515 F DEBUG : uid: 1047
12-30 11:08:13.589 31515 31515 F DEBUG : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
12-30 11:08:13.589 31515 31515 F DEBUG : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
12-30 11:08:13.589 31515 31515 F DEBUG : signal 35 (<debuggerd signal>), code -6 (SI_TKILL), fault addr --------
12-30 11:08:13.589 31515 31515 F DEBUG : x0 0000000000000000 x1 000000000000704b x2 0000000000000023 x3 b4000072850c8b40
12-30 11:08:13.589 31515 31515 F DEBUG : x4 73761e1ea103e71e x5 73761e1ea103e71e x6 73761e1ea103e71e x7 46da704c50eb5209
12-30 11:08:13.589 31515 31515 F DEBUG : x8 0000000000000083 x9 00000072eac80000 x10 00000072eacb2090 x11 0000000000000001
12-30 11:08:13.589 31515 31515 F DEBUG : x12 000000000000000b x13 000000000000000c x14 b40000737aa8bd40 x15 0000000000000000
12-30 11:08:13.589 31515 31515 F DEBUG : x16 000000737af8e048 x17 000000737af660e0 x18 00000072e387e000 x19 b4000072851d3780
12-30 11:08:13.589 31515 31515 F DEBUG : x20 00000072e7b3cf20 x21 00000072e79f04c0 x22 00000072e7b3cf20 x23 b4000072850c8b48
12-30 11:08:13.589 31515 31515 F DEBUG : x24 00000072eacb3690 x25 00000072eacb3690 x26 00000072e62f205c x27 0000000000000001
12-30 11:08:13.589 31515 31515 F DEBUG : x28 0000000000000000 x29 00000072e41c9a80
12-30 11:08:13.589 31515 31515 F DEBUG : lr 00000072e78b7e7c sp 00000072e41c8be0 pc 000000737af660ec pst 0000000000001000
12-30 11:08:13.589 31515 31515 F DEBUG : 10 total frames
12-30 11:08:13.589 31515 31515 F DEBUG : backtrace:
12-30 11:08:13.589 31515 31515 F DEBUG : #00 pc 00000000000e80ec /apex/com.android.runtime/lib64/bionic/libc.so (tgkill+12) (BuildId: 02a91a85343debb2911714273ff2b670)
12-30 11:08:13.589 31515 31515 F DEBUG : #01 pc 0000000001833e78 /vendor/lib64/hw/camera.qcom.so (CamX::Session::NotifyResult(CamX::ResultsData*)+15064) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.589 31515 31515 F DEBUG : #02 pc 0000000001857db0 /vendor/lib64/hw/camera.qcom.so (CamX::Session::NotifySessionSystemEvent(CamX::SystemEventHeader*, CamX::NodeSystemEventPayload*, CamX::PipelineSystemEventPayload*)+336) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.589 31515 31515 F DEBUG : #03 pc 00000000017b32d8 /vendor/lib64/hw/camera.qcom.so (CamX::Pipeline::HandlePipelineSystemEventPayload(CamX::SystemEventHeader*, CamX::NodeSystemEventPayload*)+440) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.589 31515 31515 F DEBUG : #04 pc 00000000017f47d0 /vendor/lib64/hw/camera.qcom.so (CamX::Pipeline::HandleKernelTriggerErrors(CSLErrorMessageType, unsigned int)+1072) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.590 31515 31515 F DEBUG : #05 pc 00000000017f3cc4 /vendor/lib64/hw/camera.qcom.so (CamX::Pipeline::SendErrorNotification(CSLErrorMessage const*)+308) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.590 31515 31515 F DEBUG : #06 pc 00000000017d634c /vendor/lib64/hw/camera.qcom.so (CamX::Pipeline::CSLMessageHandler(void*, CSLMessage*) (.cfi)+2012) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.590 31515 31515 F DEBUG : #07 pc 00000000018bcfe0 /vendor/lib64/hw/camera.qcom.so (CSLHwInstancePollThreadFunc(void*) (.5c46353098b36fe4ba9301fa609191e2.cfi)+11440) (BuildId: cbee892711a7ce54405c8a4f8ffec4f7)
12-30 11:08:13.590 31515 31515 F DEBUG : #08 pc 00000000000fd0f4 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 02a91a85343debb2911714273ff2b670)
12-30 11:08:13.590 31515 31515 F DEBUG : #09 pc 0000000000096a04 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: 02a91a85343debb2911714273ff2b670)
12-30 11:08:13.603 1310 1310 E tombstoned: Tombstone written to: tombstone_03
After exiting the app, the camera recovers after a few seconds.
This also happens on the Open Camera app and sometimes on the stock Camera app.
Any idea what is going on here?