Open kanawish opened 12 years ago
I'm blaming that on the camera handle not getting freed from the C++ code until the process gets killed. There needs to be some kind of sanity check when the Camera gets "re-bound" to the process. Dunno if I'm making sense in words but my head seems to be saying I am. -RL
On Sun, Feb 19, 2012 at 22:55, Etienne Caron < reply@reply.github.com
wrote:
I've been getting what looks like crashes from the camera preview. Once that happens, looks like it can't bind to the camera anymore, I have to restart the process before it starts working again. I'll try to investigate, if anyone has hints on what that could be, let me know.
Reply to this email directly or view it on GitHub: https://github.com/borisdb/TodoDetector/issues/9
I'm not sure that's the issue, for what I've seen we pass the JNI method width/height, picture binary data, but no actual hooks to the camera. Otherwise I'd say exactly like you (that's what the symptoms look like for sure)
We aren't doing much clean up, memory management or sanity checking in the C++. I noticed CameraPreview activity crashes, but I didn't have to restart the process on the Nexus S, I just reclicked the camera preview activity and it was running. In other, potentially related, news: I was getting an immediate return on the camera preview activity consistently on the HTC Desire since ~3pm on Sunday, it seems to not be receiving the image matrix, find 0 contours and returns.
it's hard to say what it is, but I would say it will get fixed when we design the workflow properly so we know when to clean up what, and how we get the cropped images or coordinates from OpenCV to the Java
Symptoms
Diagnosis *low memory...the HTC desire has only 512MB and I've had this same behavior where loading a large BMP on the HTC desire, or recording more than 5seconds of 3megapixel video. It was due to the activity calling on destroy when there was low memory. we can verify but putting a toast or log out in the onlowmemory...
if my suspicion is right we also might need to evaluate if we have some memory intensive components of our app apart from the OpenCV, and prioritize our memory consumption in favor of the OpenCV, esp on phones which have only 512MB.
One small trail for the bug (kinda goes towards cesine's low memory diagnosis), I've tried running a test with only the native C function, it was running okay, no crashes. I'll let you know if I find anything else.
I'm getting close to tracking it down using breakpoints in the NDK.
I will post more once I have clear steps for setting up debugging of the C++, for now here is a link to a tutorial for adding debugging in the NDK http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
I've been getting what looks like crashes from the camera preview. Once that happens, looks like it can't bind to the camera anymore, I have to restart the process before it starts working again. I'll try to investigate, if anyone has hints on what that could be, let me know.