Android : Saving Image to Bitmap crashes

on Tuesday, October 14, 2014


I'm working with vuforia sdk. What I'm trying to do is to get one frame from camera and store it in a bitmap. vuforia stores returns each frame in a variable of type Image. So i'm using the code below to convert it to a Bitmap:



Image imageRGB888 = arg0[0];
Bitmap imageBitmap = null;
try {
byte [] imagePixels = new byte [imageRGB888.getPixels().limit()];
if(DEBUG_MODE) Log.d(LOGTAG,"zero");
imageRGB888.getPixels().get(imagePixels, 0, imageRGB888.getPixels().limit());
if(DEBUG_MODE) Log.d(LOGTAG,"first");
if(DEBUG_MODE) Log.d(LOGTAG,"second");
imageBitmap = storeCameraImage2Bitmap(imagePixels, imageRGB888.getWidth(), imageRGB888.getHeight());
if(DEBUG_MODE) Log.d(LOGTAG,"third.");

} catch (Exception e) {

if (DEBUG_MODE) Log.d(LOGTAG, "Failed to create bitmap image.");
result = false;
}


I've put these lines in an AsyncTask. Using logs I've figured out that until this line it works fine:



imageRGB888.getPixels().get(imagePixels, 0, imageRGB888.getPixels().limit());


But it never runs the next line. This happens only on my xperia neoL with android 4.0. I also tested this app on a lenovo yoga tablet with android 4.2.2 but this does not happen there.


Here is the log report:



10-14 16:25:23.936: D/VideoPlayback(2347): zero
10-14 16:25:23.966: D/VideoPlayback(2347): first
10-14 16:25:23.966: D/VideoPlayback(2347): second
10-14 16:25:23.966: A/libc(2347): Fatal signal 11 (SIGSEGV) at 0x00040004 (code=2)
10-14 16:25:24.477: I/DEBUG(119): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-14 16:25:24.477: I/DEBUG(119): Build fingerprint: 'SEMC/MT25i_1265-5721/MT25i:4.0.4/4.1.B.0.631/iL1_3w:user/release-keys'
10-14 16:25:24.477: I/DEBUG(119): pid: 2347, tid: 2431 >>> com.qualcomm.vuforia.samples.VideoPlayback <<<
10-14 16:25:24.477: I/DEBUG(119): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 00040004
10-14 16:25:24.477: I/DEBUG(119): r0 007c3f80 r1 1de00001 r2 007c3f80 r3 00040006
10-14 16:25:24.477: I/DEBUG(119): r4 36792258 r5 0067cc68 r6 00000004 r7 3d150e68
10-14 16:25:24.477: I/DEBUG(119): r8 3eda3c0c r9 3d150e5c 10 3b9d49aa fp 3eda3c24
10-14 16:25:24.477: I/DEBUG(119): ip 3dd05e84 sp 3eda3bf8 lr 3dd05ea0 pc 00040004 cpsr 80000010
10-14 16:25:24.477: I/DEBUG(119): d0 6472656767756265 d1 761a47761e427028
10-14 16:25:24.477: I/DEBUG(119): d2 711b3c72143e7663 d3 183c71183c711a6f
10-14 16:25:24.477: I/DEBUG(119): d4 761740761d3d701d d5 1c3a741d3b751740
10-14 16:25:24.477: I/DEBUG(119): d6 38691938701c3b73 d7 6d17386915386915
10-14 16:25:24.486: I/DEBUG(119): d8 0000000000000000 d9 0000000000000000
10-14 16:25:24.486: I/DEBUG(119): d10 0000000000000000 d11 0000000000000000
10-14 16:25:24.486: I/DEBUG(119): d12 0000000000000000 d13 0000000000000000
10-14 16:25:24.486: I/DEBUG(119): d14 0000000000000000 d15 0000000000000000
10-14 16:25:24.486: I/DEBUG(119): d16 00000000007259e0 d17 0000000000000000
10-14 16:25:24.486: I/DEBUG(119): d18 4000000000000000 d19 3fc7ed6f0ca7a0ef
10-14 16:25:24.486: I/DEBUG(119): d20 3f115248001754af d21 bebbb6a062349c06
10-14 16:25:24.486: I/DEBUG(119): d22 3ff0000000000000 d23 3ff368b2fc6f960a
10-14 16:25:24.486: I/DEBUG(119): d24 3e66376972bea4d0 d25 3a9e30f0270c0bfa
10-14 16:25:24.486: I/DEBUG(119): d26 0000000000000000 d27 2618231f004608e3
10-14 16:25:24.486: I/DEBUG(119): d28 bfd4d5aaff3b4688 d29 3f49efe993f23987
10-14 16:25:24.486: I/DEBUG(119): d30 0000000000000000 d31 0000000000000000
10-14 16:25:24.486: I/DEBUG(119): scr 60000017
10-14 16:25:24.646: I/DEBUG(119): #00 pc 00040004 [heap]
10-14 16:25:24.646: I/DEBUG(119): #01 pc 00039e9c /mnt/asec/com.qualcomm.vuforia.samples.VideoPlayback-1/lib/libVuforia.so (Java_com_qualcomm_vuforia_VuforiaJNI_Image_1getWidth)
10-14 16:25:24.646: I/DEBUG(119): #02 pc 0001ec30 /system/lib/libdvm.so (dvmPlatformInvoke)
10-14 16:25:24.646: I/DEBUG(119): #03 pc 00058c70 /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)
10-14 16:25:24.646: I/DEBUG(119): code around pc:
10-14 16:25:24.646: I/DEBUG(119): 0003ffe4 00000000 00000000 00000000 2be2ba48 ............H..+
10-14 16:25:24.646: I/DEBUG(119): 0003fff4 2be2baa8 2b6a6798 00000000 00000000 ...+.gj+........
10-14 16:25:24.646: I/DEBUG(119): 00040004 00000000 00000000 00000000 00000000 ................
10-14 16:25:24.646: I/DEBUG(119): 00040014 00000000 00000000 00000000 00000000 ................
10-14 16:25:24.646: I/DEBUG(119): 00040024 00000000 00000000 00000000 00000000 ................
10-14 16:25:24.646: I/DEBUG(119): code around lr:
10-14 16:25:24.646: I/DEBUG(119): 3dd05e80 e8bd8000 e52de004 e24dd00c e1a00002 ......-...M.....
10-14 16:25:24.646: I/DEBUG(119): 3dd05e90 e1cd20f0 e5923000 e5933000 e12fff33 . ...0...0..3./.
10-14 16:25:24.646: I/DEBUG(119): 3dd05ea0 e28dd00c e8bd8000 e52de004 e24dd00c ..........-...M.
10-14 16:25:24.646: I/DEBUG(119): 3dd05eb0 e1a00002 e1cd20f0 e5923000 e5933004 ..... ...0...0..
10-14 16:25:24.646: I/DEBUG(119): 3dd05ec0 e12fff33 e28dd00c e8bd8000 e52de004 3./...........-.
10-14 16:25:24.646: I/DEBUG(119): memory map around addr 00040004:
10-14 16:25:24.646: I/DEBUG(119): 0000a000-0000b000 /system/bin/app_process
10-14 16:25:24.646: I/DEBUG(119): 0000b000-007d2000 [heap]
10-14 16:25:24.646: I/DEBUG(119): 10000000-10001000
10-14 16:25:24.646: I/DEBUG(119): stack:
10-14 16:25:24.646: I/DEBUG(119): 3eda3bb8 1d900005
10-14 16:25:24.646: I/DEBUG(119): 3eda3bbc 00000016
10-14 16:25:24.646: I/DEBUG(119): 3eda3bc0 1d800009
10-14 16:25:24.646: I/DEBUG(119): 3eda3bc4 007c6f10 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3bc8 007c6f10 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3bcc 004aec60 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3bd0 1d900005
10-14 16:25:24.646: I/DEBUG(119): 3eda3bd4 2b2f2fbf /system/lib/libdvm.so
10-14 16:25:24.646: I/DEBUG(119): 3eda3bd8 0067d388 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3bdc 0067cc68 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3be0 0067d388 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3be4 2ac1b7e5 /system/lib/libandroid_runtime.so
10-14 16:25:24.646: I/DEBUG(119): 3eda3be8 3652ace0 /dev/ashmem/dalvik-LinearAlloc (deleted)
10-14 16:25:24.646: I/DEBUG(119): 3eda3bec 0067cc68 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3bf0 df0027ad
10-14 16:25:24.646: I/DEBUG(119): 3eda3bf4 00000000
10-14 16:25:24.646: I/DEBUG(119): #01 3eda3bf8 007c3f80 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3bfc 00000000
10-14 16:25:24.646: I/DEBUG(119): 3eda3c00 0067cc68 [heap]
10-14 16:25:24.646: I/DEBUG(119): 3eda3c04 2b2bdc34 /system/lib/libdvm.so
10-14 16:25:28.066: I/BootReceiver(249): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
10-14 16:25:28.126: I/ActivityManager(249): Process com.qualcomm.vuforia.samples.VideoPlayback (pid 2347) has died.
10-14 16:25:28.126: E/SEMC Camera HAL(138): Surface::dequeueBuffer returned error -32
10-14 16:25:28.126: E/mm-camera(138): cam_frame_flush_free_preview: in n = 2
10-14 16:25:28.126: E/mm-camera(138): cam_frame_flush_free_preview: out n = 0
10-14 16:25:28.126: W/ActivityManager(249): Force removing ActivityRecord{2c1deba8 com.qualcomm.vuforia.samples.VideoPlayback/.app.VideoPlayback.VideoPlayback}: app died, no saved state
10-14 16:25:28.126: I/WindowManager(249): WIN DEATH: Window{2c53db50 com.qualcomm.vuforia.samples.VideoPlayback/com.qualcomm.vuforia.samples.VideoPlayback.ui.ActivityList.AboutScreen paused=false}
10-14 16:25:28.136: E/kernel(129): [ 2094.822174] binder: release proc 2347, transaction 120171, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822204] binder: release proc 2347, transaction 120174, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822204] binder: release proc 2347, transaction 120177, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822235] binder: release proc 2347, transaction 120180, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822235] binder: release proc 2347, transaction 120183, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822235] binder: release proc 2347, transaction 120186, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822265] binder: release proc 2347, transaction 120189, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822265] binder: release proc 2347, transaction 120192, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822265] binder: release proc 2347, transaction 120195, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822296] binder: release proc 2347, transaction 120198, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822296] binder: release proc 2347, transaction 120201, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822326] binder: release proc 2347, transaction 120204, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822326] binder: release proc 2347, transaction 120207, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822326] binder: release proc 2347, transaction 120210, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822357] binder: release proc 2347, transaction 120213, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822357] binder: release proc 2347, transaction 120216, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822357] binder: release proc 2347, transaction 120219, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822387] binder: release proc 2347, transaction 120222, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822387] binder: release proc 2347, transaction 120225, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822418] binder: release proc 2347, transaction 120228, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822418] binder: release proc 2347, transaction 120231, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822418] binder: release proc 2347, transaction 120234, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822448] binder: release proc 2347, transaction 120237, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822448] binder: release proc 2347, transaction 120240, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822448] binder: release proc 2347, transaction 120243, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822479] binder: release proc 2347, transaction 120246, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822479] binder: release proc 2347, transaction 120249, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822479] binder: release proc 2347, transaction 120252, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822509] binder: release proc 2347, transaction 120255, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822509] binder: release proc 2347, transaction 120258, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822540] binder: release proc 2347, transaction 120261, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822540] binder: release proc 2347, transaction 120264, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822540] binder: release proc 2347, transaction 120267, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822570] binder: release proc 2347, transaction 120270, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822570] binder: release proc 2347, transaction 120273, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822570] binder: release proc 2347, transaction 120276, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822601] binder: release proc 2347, transaction 120279, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822601] binder: release proc 2347, transaction 120282, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822631] binder: release proc 2347, transaction 120285, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822631] binder: release proc 2347, transaction 120288, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822631] binder: release proc 2347, transaction 120291, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822662] binder: release proc 2347, transaction 120294, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822662] binder: release proc 2347, transaction 120297, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822662] binder: release proc 2347, transaction 120300, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822692] binder: release proc 2347, transaction 120303, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822692] binder: release proc 2347, transaction 120306, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822692] binder: release proc 2347, transaction 120309, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822723] binder: release proc 2347, transaction 120312, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822723] binder: release proc 2347, transaction 120315, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822753] binder: release proc 2347, transaction 120318, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822753] binder: release proc 2347, transaction 120321, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822753] binder: release proc 2347, transaction 120324, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822784] binder: release proc 2347, transaction 120327, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822784] binder: release proc 2347, transaction 120330, not freed
10-14 16:25:28.136: E/kernel(129): [ 2094.822784] binder: release proc 2347, transaction 120333, not freed
10-14 16:25:28.136: D/kernel(129): [ 2094.823577] binder: 249:464 transaction failed 29189, size 56-0
10-14 16:25:28.136: D/kernel(129): [ 2094.823669] binder: 249:464 transaction failed 29189, size 56-0
10-14 16:25:28.136: D/kernel(129): [ 2094.827545] binder: 138:2442 transaction failed 29189, size 80-0
10-14 16:25:28.136: D/SurfaceFlinger(121): Release buffer at 0x92b10
10-14 16:25:28.136: I/WindowManager(249): WIN DEATH: Window{2c4d8688 SurfaceView paused=false}
10-14 16:25:28.136: I/WindowManager(249): WIN DEATH: Window{2c096320 com.qualcomm.vuforia.samples.VideoPlayback/com.qualcomm.vuforia.samples.VideoPlayback.app.VideoPlayback.VideoPlayback paused=false}
10-14 16:25:28.146: D/SurfaceFlinger(121): Release buffer at 0x7f840
10-14 16:25:28.146: D/SurfaceFlinger(121): Release buffer at 0x7f840
10-14 16:25:28.156: D/dalvikvm(2454): Late-enabling CheckJNI
10-14 16:25:28.166: E/mm-camera(138): config_proc_CAMERA_STOP_SNAPSHOT: ctrl->state = 25
10-14 16:25:28.176: I/ActivityManager(249): Start proc com.qualcomm.vuforia.samples.VideoPlayback for activity com.qualcomm.vuforia.samples.VideoPlayback/.ui.ActivityList.AboutScreen: pid=2454 uid=10130 gids={1006, 3003, 1015}
10-14 16:25:28.196: D/Zygote(122): Process 2347 terminated by signal (11)
10-14 16:25:28.316: D/kernel(129): [ 2095.010162] Disabled VREG "gp2"
10-14 16:25:28.316: D/kernel(129): [ 2095.010284] Disabled VREG "lvsw1"
10-14 16:25:28.316: D/kernel(129): [ 2095.010437] Disabled VREG "gp15"
10-14 16:25:28.316: E/SEMC Camera HAL(138): dlclose(libmmipl.so)
10-14 16:25:28.316: W/CameraService(138): native_window_api_disconnect failed: Broken pipe (-32)
10-14 16:25:28.316: I/CameraService(138): Destroying camera 0
10-14 16:25:28.326: W/AudioFlinger(138): session id 66 not found for pid 138
10-14 16:25:28.326: W/AudioFlinger(138): session id 67 not found for pid 138
10-14 16:25:28.366: D/dalvikvm(249): GC_CONCURRENT freed 1011K, 15% free 15037K/17671K, paused 3ms+13ms
10-14 16:25:28.456: I/CrashMonitor(1014): CrashMonitorService: invokeService: android.intent.action.DROPBOX_ENTRY_ADDED
10-14 16:25:28.476: D/dalvikvm(1906): Trying to load lib /data/data/com.sonyericsson.android.bootinfo/lib/libMiscTaAccessor.so 0x2bded780
10-14 16:25:28.476: D/dalvikvm(1906): Shared lib '/data/data/com.sonyericsson.android.bootinfo/lib/libMiscTaAccessor.so' already loaded in same CL 0x2bded780
10-14 16:25:28.576: D/dalvikvm(2454): GC_CONCURRENT freed 316K, 4% free 8999K/9351K, paused 2ms+3ms
10-14 16:25:28.606: D/TextLayoutCache(2454): Using debug level: 0 - Debug Enabled: 0
10-14 16:25:28.626: D/libEGL(2454): loaded /system/lib/egl/libGLES_android.so
10-14 16:25:28.636: D/libEGL(2454): loaded /system/lib/egl/libEGL_adreno200.so
10-14 16:25:28.636: D/libEGL(2454): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
10-14 16:25:28.646: D/libEGL(2454): loaded /system/lib/egl/libGLESv2_adreno200.so
10-14 16:25:28.686: D/OpenGLRenderer(2454): Enabling debug mode 0
10-14 16:25:28.686: W/InputManagerService(249): Got RemoteException sending setActive(false) notification to pid 2347 uid 10130
10-14 16:25:28.806: I/ActivityManager(249): Displayed com.qualcomm.vuforia.samples.VideoPlayback/.ui.ActivityList.AboutScreen: +650ms
10-14 16:25:28.986: I/CrashMonitor(1014): MiscTaInfo: Open the connection to miscta successed
10-14 16:25:28.996: D/SurfaceFlinger(121): Release buffer at 0x9da88
10-14 16:25:29.606: D/dalvikvm(1014): GC_CONCURRENT freed 489K, 6% free 8971K/9543K, paused 7ms+9ms

0 comments:

Post a Comment