Search code examples
androidandroid-cameragoogle-project-tango

Is there any way to simultaneously access front-facing camera and Tango service at the same time?


I know that there are hardware issues with accessing both front-facing and back-facing cameras at the same time on the vast majority of Android devices. When trying to do so, the second Camera.open() call fails.

Today I attempted to load the Tango service after having opened the front-camera:

06-29 17:16:01.538: I/tango-client-api-jni(9090): ConnectTexture context 0x482430b0, camera 3, texture 3
06-29 17:16:01.539: I/tango_client_api(9090): TangoErrorType TangoService_connectTextureId(TangoCameraId, unsigned int, void*, void (*)(void*, TangoCameraId)): camera_id = 3, texture_id = 3.
06-29 17:16:01.539: I/tango_client_api(9090): TangoErrorType TangoService_initializeLOCKED(): Already initialized.
06-29 17:16:01.540: W/tango_client_api(9090): Warning: TangoErrorType TangoService_connectTextureId(TangoCameraId, unsigned int, void*, void (*)(void*, TangoCameraId)) called for cam id(3) before TangoService_connect().  Callback will be registered on next call to TangoService_connect().
06-29 17:16:01.600: E/AndroidRuntime(9090): FATAL EXCEPTION: GLThread 662
06-29 17:16:01.600: E/AndroidRuntime(9090): Process: edu.purdue.andersed.transparentdisplay, PID: 9090
06-29 17:16:01.600: E/AndroidRuntime(9090): com.google.atap.tangoservice.TangoInvalidException
06-29 17:16:01.600: E/AndroidRuntime(9090):     at com.google.atap.tangoservice.Tango.throwTangoExceptionIfNeeded(Tango.java:494)
06-29 17:16:01.600: E/AndroidRuntime(9090):     at com.google.atap.tangoservice.Tango.updateTexture(Tango.java:221)
06-29 17:16:01.600: E/AndroidRuntime(9090):     at edu.purdue.andersed.transparentdisplay.TransparentDisplayRenderer.onDrawFrame(TransparentDisplayRenderer.java:51)
06-29 17:16:01.600: E/AndroidRuntime(9090):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
06-29 17:16:01.600: E/AndroidRuntime(9090):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
06-29 17:16:01.682: I/tango_client_api(9090): void TangoService_disconnect(): Disconnecting from Tango...
06-29 17:16:02.419: I/tango_client_api(9090): void TangoService_disconnect(): Successfully disconnected from Tango.
06-29 17:16:03.292: I/Process(9090): Sending signal. PID: 9090 SIG: 9

Is there any way to get simultaneous access? There is no reference to the front-facing camera in the Tango API so I can't subscribe to new frames via that.


Solution

  • No - if the Tango service has the front RGB camera, you can't have it - if you succeed in taking it, you loose all depth callbacks