We've implemented a custom camera wrapper (built on the android::camera from the android sources) in the fashion of OpenCV camera_wrapper for android. We now want to use this wrapper for Google Glass but unfortunately do not get any message for an available preview frame. We were able to track down the problem to the SurfaceTexture creation. When we setup the preview we do
android::sp<android::SurfaceTexture> surfaceTexture(new android::SurfaceTexture(0x10));
if(pimpl->camera->setPreviewTexture(surfaceTexture) != 0)
{
LOGE("setPreviewTexture call failed");
return false;
}
It seems that everything is fine but when using the camera later (e.g. call camera->dumpParameter) the application crashes. I checked to not setPreviewTexture but only create the SurfaceTexture with the magic ID 0x10 (no clue if this is correct for Glass??) we get a crash directly at the end of the function when the shared pointer is released.
We also tried the OpenCV approach (their wrapper) and it has the same behavior.
We use the android 4.0.4_r2.1 branch from the android sources.
Anyone using the android::camera directly to work on Glass? I would appreciate any hint where to search for the bug or change it to get it work.
Best, Manuel