Hello,
Here is the environment
Project : rowboat-ics-sgx (http://code.google.com/p/rowboat/wiki/ICSonBeagleboard_WithSGX)
Hardware project : hardware-ti-omap3 commit 386b90d
Board : beableboard-xM
Camera : vga camera (mt9v113)
issue : when calling setPreviewCallback or setPreviewCallbackWithBuffer in a java application i get the following error
F/libc ( 3844): Fatal signal 11 (SIGSEGV) at 0x414e7000 (code=1)I/DEBUG ( 1024): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***I/DEBUG ( 1024): Build fingerprint: 'Android/beagleboard/beagleboard:4.0.3/IML74K/eng.beagle.20120730.134854:eng/test-keys'I/DEBUG ( 1024): pid: 3844, tid: 3899 >>> /system/bin/mediaserver <<<I/DEBUG ( 1024): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 414e7000I/DEBUG ( 1024): r0 0000adb7 r1 0000a817 r2 0000002d r3 414e7000I/DEBUG ( 1024): r4 41e46000 r5 00071000 r6 414e7000 r7 00096000I/DEBUG ( 1024): r8 00000082 r9 40045318 10 0000007d fp 41dd5000I/DEBUG ( 1024): ip 000000b6 sp 4233ae20 lr 40043f47 pc 40043eba cpsr 20000030I/DEBUG ( 1024): d0 c008000000000000 d1 4065f4395810624dI/DEBUG ( 1024): d2 0000001000000002 d3 3ff989374bc6a7f0I/DEBUG ( 1024): d4 4063600000000000 d5 0000000000000000I/DEBUG ( 1024): d6 000000af00000001 d7 000000b8000000b6I/DEBUG ( 1024): d8 0000000000000000 d9 0000000000000000I/DEBUG ( 1024): d10 0000000000000000 d11 0000000000000000I/DEBUG ( 1024): d12 0000000000000000 d13 0000000000000000I/DEBUG ( 1024): d14 0000000000000000 d15 0000000000000000I/DEBUG ( 1024): d16 40670e978d4fdf3b d17 400024dd2f1a9fbeI/DEBUG ( 1024): d18 4000000000000000 d19 bfd90624dd2f1aa0I/DEBUG ( 1024): d20 4066db7ced916872 d21 bebbac583349cd18I/DEBUG ( 1024): d22 3ff0000000000000 d23 3fe7819101615a87I/DEBUG ( 1024): d24 3e66376972bea4d0 d25 0000000000000000I/DEBUG ( 1024): d26 0000000000000000 d27 0000000000000000I/DEBUG ( 1024): d28 0000000000000000 d29 0000000000000000I/DEBUG ( 1024): d30 0000000000000000 d31 0000000000000000I/DEBUG ( 1024): scr 80000010I/DEBUG ( 1024):I/DEBUG ( 1024): #00 pc 00006eba /system/lib/hw/camera.omap3.soI/DEBUG ( 1024): #01 pc 00006f42 /system/lib/hw/camera.omap3.so (_Z19convertYUYVtoRGB565PhS_ii)I/DEBUG ( 1024): #02 pc 000062da /system/lib/hw/camera.omap3.so (_ZN7android14CameraHardware13previewThreadEv)I/DEBUG ( 1024): #03 pc 00006330 /system/lib/hw/camera.omap3.soI/DEBUG ( 1024): #04 pc 00021196 /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv)I/DEBUG ( 1024): #05 pc 000217dc /system/lib/libutils.soI/DEBUG ( 1024): #06 pc 00012be4 /system/lib/libc.so (__thread_entry)I/DEBUG ( 1024): #07 pc 00012738 /system/lib/libc.so (pthread_create)I/DEBUG ( 1024):I/DEBUG ( 1024): code around pc:I/DEBUG ( 1024): 40043e98 10c070e1 2a90ee17 bfa82aff ea2222ff .p.....*.*..."".I/DEBUG ( 1024): 40043ea8 10ca71e2 21c0ea42 70ecea2c ea411082 .q..B..!,..p..A.I/DEBUG ( 1024): 40043eb8 70181042 2207f3c0 4770705a 8000f3af B..p..."ZppG....I/DEBUG ( 1024): 40043ec8 76c8b439 3ff29fbe 9374bc6a bfea0418 9..v...?j.t.....I/DEBUG ( 1024): 40043ed8 4bc6a7f0 3ff98937 dd2f1aa0 bfd90624 ...K7..?../.$...I/DEBUG ( 1024):I/DEBUG ( 1024): code around lr:I/DEBUG ( 1024): 40043f24 78e34293 46d4bfdf 469a4640 bfc44688 .B.x...F@F.F.F..I/DEBUG ( 1024): 40043f34 4608469c 46414633 f8cd4652 f7ffc000 .F.F3FAFRF......I/DEBUG ( 1024): 40043f44 f8ddff6d 1cb3c000 46604641 f7ff4652 m.......AF`FRF..I/DEBUG ( 1024): 40043f54 3504ff65 34043604 dbd742bd 8ffee8bd e..5.6.4.B......I/DEBUG ( 1024): 40043f64 00020624 ffffffa8 0000140e 2a2a2a2a $...........****I/DEBUG ( 1024):I/DEBUG ( 1024): memory map around addr 414e7000: I/DEBUG ( 1024): 41476000-414e7000 /dev/ashmem/MemoryHeapBase (deleted)I/DEBUG ( 1024): (no map for address)I/DEBUG ( 1024): 414f9000-415f9000 /dev/ashmem/AudioFlinger::Client (deleted)I/DEBUG ( 1024):I/DEBUG ( 1024): stack:I/DEBUG ( 1024): 4233ade0 4233ae04I/DEBUG ( 1024): 4233ade4 4015107f /system/lib/libutils.soI/DEBUG ( 1024): 4233ade8 4233ae04I/DEBUG ( 1024): 4233adec 00000000I/DEBUG ( 1024): 4233adf0 0002efd8 [heap] I/DEBUG ( 1024): 4233adf4 40010a47 /system/lib/libcameraservice.soI/DEBUG ( 1024): 4233adf8 0002e8a8 [heap] I/DEBUG ( 1024): 4233adfc 4001234b /system/lib/libcameraservice.soI/DEBUG ( 1024): 4233ae00 0002e8a8 [heap] I/DEBUG ( 1024): 4233ae04 0002efb8 [heap] I/DEBUG ( 1024): 4233ae08 0002e8d8 [heap] I/DEBUG ( 1024): 4233ae0c 0002e8b8 [heap] I/DEBUG ( 1024): 4233ae10 0002e8d8 [heap] I/DEBUG ( 1024): 4233ae14 0002e8b8 [heap] I/DEBUG ( 1024): 4233ae18 df0027adI/DEBUG ( 1024): 4233ae1c 00000000I/DEBUG ( 1024): #01 4233ae20 000000acI/DEBUG ( 1024): 4233ae24 ffffffa8I/DEBUG ( 1024): 4233ae28 00000280I/DEBUG ( 1024): 4233ae2c 000199d0 [heap] I/DEBUG ( 1024): 4233ae30 0002e8c0 [heap] I/DEBUG ( 1024): 4233ae34 41dd5000 /dev/video2I/DEBUG ( 1024): 4233ae38 00000000I/DEBUG ( 1024): 4233ae3c 000199dc [heap] I/DEBUG ( 1024): 4233ae40 0004b000I/DEBUG ( 1024): 4233ae44 000001e0I/DEBUG ( 1024): 4233ae48 00000001I/DEBUG ( 1024): 4233ae4c 400432df /system/lib/hw/camera.omap3.soI/BootReceiver( 1122): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)W/AudioSystem( 1122): AudioFlinger server died!W/AudioSystem( 1122): AudioPolicyService server died!I/ServiceManager( 1021): service 'media.audio_flinger' diedI/ServiceManager( 1021): service 'media.player' diedI/ServiceManager( 1021): service 'media.camera' diedI/ServiceManager( 1021): service 'media.audio_policy' diedW/Camera ( 3878): Camera server died!W/Camera ( 3878): ICamera diedE/Camera ( 3878): Error 100E/CameraErrorCallback( 3878): Got camera error callback. error=100D/AndroidRuntime( 3878): Shutting down VM
There is no such error when setPreviewCallback* is commented out.
Is this a known bug? is this related to hardware-ti-omap3 or does it look like i did something wrong with java?
Best regards,
Jean-Michel
As far as i checked, it looks like it's a format conversion problem.
i tried to change the preview format on the java side with the following line :
params.setPreviewFormat(android.graphics.ImageFormat.YV12)
but it is not supported (this is specified in hardware/ti/omap3/camera/CameraHardware.cpp in setParameters method).
After checking this :
https://groups.google.com/forum/#!msg/android-opencv/YHUHHvJv-3o/p3ltYW49V4wJ
i realized framesize in hardware/ti/omap3/camera/CameraHardware.cpp's previewThread method was not correct.
i added the following lines :
diff --git a/camera/CameraHardware.cpp b/camera/CameraHardware.cppindex 92eb55b..60c743d 100644--- a/camera/CameraHardware.cpp+++ b/camera/CameraHardware.cpp@@ -348,6 +348,11 @@ int CameraHardware::previewThread() if ((mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME) || (mMsgEnabled & CAMERA_MSG_VIDEO_FRAME)) {+ if (strcmp(mParameters.getPreviewFormat(), (const char *) CameraParameters::PIXEL_FORMAT_YUV422SP) == 0)+ {+ framesize = 2* width * height; // yuv422sp+ }+ camera_memory_t* picture = mRequestMemory(-1, framesize, 1, NULL); convertYUYVtoRGB565((unsigned char *)tempbuf, (unsigned char*)picture->data, width, height);
The error disappeared, now setPreviewCallback* works but i am no expert with image formats and this hack is probably not good enough.
With this modification i have been able to run OpenCv 2.4.2 tutorial 1 sample, though it looks like my modification messed up with resolution and colors.
Should i post this in omap forum instead of android?
Regards,
Hi,
I was getting the exact same problem with a usb camera C920 that i'm trying to connect to the beaglebone. I applied your patch and now the startPreview function brings up the first image but the auto recuperation of images is not working. Does anybody have an idea about this ?