6

I'm trying to process bitmaps from frames I grabbed from MediaMetadataretriever using native function. But I got a fatal crash saying

SIGNAL 11 (SIGSEGV) at 0x422d8f20 (code=2)
SIGNAL 11 (SIGSEGV) at 0x42311320 (code=2)

I tried logging to see where it went wrong. it appears that it crashes when i call for the native function. Below is the function that I called for native function.

 protected Bitmap processFrame(Bitmap l_frame) {
    WarnC='a';
    int[] rgba = mRGBA;
    byte[] src_array =stream;
    ByteArrayOutputStream src_stream = new ByteArrayOutputStream();
    l_frame.compress(Bitmap.CompressFormat.PNG, 0, src_stream);
    src_array = src_stream.toByteArray();   
Log.i("test", "ok");
    WarnC= processcaller.LaneDetection(mFrameWidth, mFrameHeight, src_array, rgba);
    Bitmap bmp = g_frame; 
    bmp.setPixels(rgba, 0/* offset */, mFrameWidth /* stride */, 0, 0, mFrameWidth,mFrameHeight);  
    rgba =null;
    src_array=null;
    return bmp;
}

The crash signal came out right after the Log.i("test","ok"); I searched around the net and got saw most say it's segmentation fault and might be cause by calling uninitialized or functions that does not exist. But scanning through my code, I just can't find any of it. Any pointers?

krock
  • 28,904
  • 13
  • 79
  • 85
Eddy
  • 61
  • 1
  • 2
  • Segfaults are often bugs in Android's internal code. Check unfiltered logcat for errors immediately before and after. Especially mentions of "out of memory" or other more descriptive error messages can help find a reason or a workaround – zapl Dec 02 '12 at 10:50
  • I've always see some error logs about AlarmManagerService which says "android_set_AlarmManagerService_set to type=0". DataRouter which says "usb connection true" and "DSR is ON. Don't send DTR ON." lights saying "write_int: path/sys/devices/virtual/sec/sec_touchkey/brightness, value 2" I wonder do they have anything to do with my app running? – Eddy Dec 02 '12 at 14:37
  • Overlooked that you mentioned you are using your own native functions and opencv. If `processcaller.LaneDetection` is such a function and it crashes inside there then it's not an Android bug and you need to debug your function. Like http://stackoverflow.com/questions/5314036/how-to-use-addr2line-in-android or http://stackoverflow.com/questions/5575885/android-ndk-debugging or http://www.tag-games.com/2012/06/05/native-android-debugging-in-eclipse/ – zapl Dec 02 '12 at 16:33
  • Will look into that. Apparently, when the other activity call the processcaller.LaneDetection function, it doesn't give me errors. So, I was thinking it might be something related to android instead of opencv. – Eddy Dec 02 '12 at 17:01
  • zapl, I'm not very sure where to place the commands in the link http://stackoverflow.com/questions/5314036/how-to-use-addr2line-in-android. NDK-Stack is another alternative, but then again, after i read the document, I couldn't understand where to write the commands. any more detail guide? it's my first time doing this. – Eddy Dec 03 '12 at 16:42

0 Answers0