Android - Fatal Signal 11 when stopping and resetting camera after recording video -


i have app trying record video, following method initialize camera:

private void initrecorder(surface surface) throws ioexception {     if (mcamera == null) {         mcamera = camera.open();         mcamera.unlock();     }      if (mmediarecorder == null) mmediarecorder = new mediarecorder();     mmediarecorder.setpreviewdisplay(surface);     mmediarecorder.setcamera(mcamera);      mmediarecorder.setvideosource(mediarecorder.videosource.default);     mmediarecorder.setoutputformat(mediarecorder.outputformat.mpeg_4);     mmediarecorder.setvideoencoder(mediarecorder.videoencoder.h264);     mmediarecorder.setvideoencodingbitrate(512 * 1000);     mmediarecorder.setvideoframerate(30);     mmediarecorder.setvideosize(640, 480);     mmediarecorder.setoutputfile(videofile);      try {         mmediarecorder.prepare();     } catch (illegalstateexception e) {         e.printstacktrace();     }      initsuccess = true; } 

when try stop camera or when surfacedestroyed called, call following method:

private void resetcamera()  {     mmediarecorder.stop();     mmediarecorder.reset();     mmediarecorder.release();     mcamera.release();      mcamera = null;      try {         initrecorder(mholder.getsurface());     } catch (ioexception e) {         e.printstacktrace();     } } 

however, somewhere in code getting fatal signal 11 error. apparently code trying illegally access portion of memory.

i wondering, how around error?

here logcat dump when start recording video when stop recording:

d/dalvikvm: gc_for_alloc freed 1309k, 27% free 7434k/10168k, paused 9ms, total 9ms i/dalvikvm: not compile trace ljava/util/arrays;fill, offset 5 i/dalvikvm: ++++++++++++++++++++++++++++++++++++++++++++ i/dalvikvm: jit_info: me issues while compiling trace  ljava/util/arrays;fill, offset 5 i/dalvikvm: trace provoked spill. i/dalvikvm: trying less registerization 1 0 d/dalvikvm: gc_for_alloc freed 1415k, 27% free 7438k/10168k, paused 10ms, total 10ms a/libc: fatal signal 11 (sigsegv) @ 0x00000010 (code=1), thread 13774 (arch.treadmill3) 

after mmediarecorder.release(); have write mmediarecorder = null; because release() method seems have few bugs. this:

if (mmediarecorder != null) {         mmediarecorder.stop();         mmediarecorder.reset();         mmediarecorder.release();         mmediarecorder = null;     } 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -