I'm running into a crash when converting a YUV Planar image to RGBA8888 using fcvColorYCbCr420PlanarToRGBA8888u8().
I'm using a Android's MediaCodec to decoder a frame from a video file. I'm using the byteBuffer mode where the decoder renders the frame into a direct byte buffer. I then send the byteBuffer to JNI where I try to use fcvColorYCbCr420PlanarToRGBA8888u8() to convert. I allocate a destination buffer using `fcvMemAlloc` alligned to `sizeof(size_t)`. I've also tried just allocating using `std::vector` but am seeing the same results.
I've tried outputing the source YUV to file and then reading it in OpenCV and rendering it and the image looks fine. So I believe the source image is good.
This is the log of what I'm getting. I'm not seeing any additional logs and I'm not sure how to enable any detailed logging if possible.
--------- beginning of crash07-29 07:13:27.601 6114 6114 F libc : Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x6dbad00000 in tid 6114 (e.drivermonitor), pid 6114 (e.drivermonitor)07-29 07:13:27.751 5875 5875 W HidlServiceManagement: Waited one second for [email protected]::ISecureElement/SIM107-29 07:13:27.752 595 595 I hwservicemanager: Since [email protected]::ISecureElement/SIM1 is not registered, trying to start it as a lazy HAL.07-29 07:13:27.753 5875 5875 I HidlServiceManagement: getService: Trying again for [email protected]::ISecureElement/SIM1...07-29 07:13:27.774 595 6151 W libc : Unable to set property "ctl.interface_start" to "[email protected]::ISecureElement/SIM1": error code: 0x2007-29 07:13:27.774 595 6151 I hwservicemanager: Tried to start [email protected]::ISecureElement/SIM1 as a lazy service, but was unable to. Usually this happens when a service is not installed, but if the service is intended to be used as a lazy service, then it may be configured incorrectly.07-29 07:13:27.872 6150 6150 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstoneProto07-29 07:13:27.876 707 707 I tombstoned: received crash request for pid 611407-29 07:13:27.880 6150 6150 I crash_dump64: performing dump of process 6114 (target tid = 6114)07-29 07:13:28.274 6150 6150 I crash_dump64: type=1400 audit(0.0:22806): avc: denied { read } for name="data@resource[email protected]@idmap" dev="dm-35" ino=2372 scontext=u:r:crash_dump:s0:c163,c256,c512,c768 tcontext=u:object_r:resourcecache_data_file:s0 tclass=file permissive=1 app=com.motive.drivermonitor07-29 07:13:28.274 6150 6150 I crash_dump64: type=1400 audit(0.0:22807): avc: denied { open } for path="/data/resource-cache/data@resource[email protected]@idmap" dev="dm-35" ino=2372 scontext=u:r:crash_dump:s0:c163,c256,c512,c768 tcontext=u:object_r:resourcecache_data_file:s0 tclass=file permissive=1 app=com.motive.drivermonitor07-29 07:13:28.274 6150 6150 I crash_dump64: type=1400 audit(0.0:22808): avc: denied { getattr } for path="/data/resource-cache/data@resource[email protected]@idmap" dev="dm-35" ino=2372 scontext=u:r:crash_dump:s0:c163,c256,c512,c768 tcontext=u:object_r:resourcecache_data_file:s0 tclass=file permissive=1 app=com.motive.drivermonitor07-29 07:13:28.274 6150 6150 I crash_dump64: type=1400 audit(0.0:22809): avc: denied { map } for path="/data/resource-cache/data@resource[email protected]@idmap" dev="dm-35" ino=2372 scontext=u:r:crash_dump:s0:c163,c256,c512,c768 tcontext=u:object_r:resourcecache_data_file:s0 tclass=file permissive=1 app=com.motive.drivermonitor07-29 07:13:28.298 6150 6150 I crash_dump64: type=1400 audit(0.0:22810): avc: denied { read } for name="FrameworksResTarget.apk" dev="dm-4" ino=3646 scontext=u:r:crash_dump:s0:c163,c256,c512,c768 tcontext=u:object_r:vendor_overlay_file:s0 tclass=file permissive=1 app=com.motive.drivermonitor07-29 07:13:28.361 6150 6150 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***07-29 07:13:28.361 6150 6150 F DEBUG : Build fingerprint: 'qti/lahaina/lahaina:13/TKQ1.230315.002/eng.jprofi.20230724.190348:userdebug/test-keys'07-29 07:13:28.361 6150 6150 F DEBUG : Revision: '0'07-29 07:13:28.361 6150 6150 F DEBUG : ABI: 'arm64'07-29 07:13:28.361 6150 6150 F DEBUG : Timestamp: 2023-07-29 07:13:27.920031697+000007-29 07:13:28.361 6150 6150 F DEBUG : Process uptime: 2s07-29 07:13:28.361 6150 6150 F DEBUG : Cmdline: com.motive.drivermonitor07-29 07:13:28.361 6150 6150 F DEBUG : pid: 6114, tid: 6114, name: e.drivermonitor >>> com.motive.drivermonitor <<<07-29 07:13:28.361 6150 6150 F DEBUG : uid: 1016307-29 07:13:28.362 6150 6150 F DEBUG : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x0000006dbad0000007-29 07:13:28.362 6150 6150 F DEBUG : x0 b400006dbac1eff0 x1 b400006dbacc7c00 x2 b400006dbad00000 x3 b400006db9a01fe807-29 07:13:28.362 6150 6150 F DEBUG : x4 0000000000000500 x5 b400006dbac1f010 x6 0000000000000088 x7 00000000000000e507-29 07:13:28.362 6150 6150 F DEBUG : x8 00000000000013fc x9 00000000000004ff x10 00000000000004de x11 00000000000013f807-29 07:13:28.362 6150 6150 F DEBUG : x12 0000000000000167 x13 0000000000000080 x14 00000000ffffff49 x15 00000000ffffffa807-29 07:13:28.362 6150 6150 F DEBUG : x16 00000000000001c6 x17 00000000000000ff x18 b400006db9a02068 x19 000000000000589007-29 07:13:28.362 6150 6150 F DEBUG : x20 000000000000012b x21 00000000ffffff1a x22 00000000ffffffff x23 00000000000000e507-29 07:13:28.362 6150 6150 F DEBUG : x24 00000000ffffffff x25 00000000ffffffff x26 00000000ffffffff x27 000000000000050007-29 07:13:28.362 6150 6150 F DEBUG : x28 00000000000002d0 x29 0000007fc7b0428007-29 07:13:28.362 6150 6150 F DEBUG : lr 0000006dc2a74eb8 sp 0000007fc7b04240 pc 0000006dc2a6b784 pst 000000008000100007-29 07:13:28.362 6150 6150 F DEBUG : backtrace:07-29 07:13:28.362 6150 6150 F DEBUG : #00 pc 0000000000428784 /data/app/~~n6zvItHHXylKfKo_FkruXg==/com.motive.drivermonitor-QAlbSmllJWtWr7GgafXlHQ==/base.apk!libdrivermonitor.so (yyuvp2bgra+232) (BuildId: 80bca6b475b2ef5614374846a4746b7f89a73b5a)07-29 07:13:28.389 707 707 E tombstoned: Tombstone written to: tombstone_1107-29 07:13:28.438 1534 12327 E MediaBufferGroup: buffer(0xb40000735e7df960) has residual remoteRefcount 107-29 07:13:28.438 1534 12327 E MediaBufferGroup: buffer(0xb40000735e7df060) has residual remoteRefcount 107-29 07:13:28.438 1534 12327 E MediaBufferGroup: buffer(0xb40000735e7dfd50) has residual remoteRefcount 107-29 07:13:28.438 1534 12327 E MediaBufferGroup: buffer(0xb40000735e7dcf30) has residual remoteRefcount 107-29 07:13:28.439 1540 2532 E mediaserver: unlinkToDeath: removed reference to death recipient but unlink failed.07-29 07:13:28.440 1540 2532 E IPCThreadState: attemptIncStrongHandle(1): Not supported07-29 07:13:28.442 852 852 I Zygote : Process 6114 exited due to signal 11 (Segmentation fault)07-29 07:13:28.442 1615 2618 V C2Store : in ~ComponentModule07-29 07:13:28.442 1615 2618 V C2Store : unloading dll07-29 07:13:28.456 6099 6099 I app_process: System.exit called, status: 007-29 07:13:28.457 6099 6099 I AndroidRuntime: VM exiting with result code 0.07-29 07:13:28.489 1404 1621 I libprocessgroup: Successfully killed process cgroup uid 10163 pid 6114 in 45ms
I'm sorry for posting this, please ignore. I found what I was doing wrong and fixed the problem.