0

Edit

I implemented the TangoCameraPreview by itself in a test app and it works fine. I think this error is being caused by the specific circumstances of my app. I am using Rajawali to render some graphics in my app so that could be it, but I'm not sure...

Original

I'm using the Java API and trying to use the TangoCameraPreview class instead of building my own SurfaceView and Renderer like they do in the examples. But it looks like something is failing on the JNI level and I can't get it working. Sometimes, I'll see the video for a split second, but inevitably I always get the error:

12-30 17:20:03.544 4005-4515/com.gloppygloop W/tango_client_api: TangoErrorType TangoService_updateTexture(TangoCameraId, double*): TangoService got a negative timestamp -1.000000 from camera with id 2.
12-30 17:20:03.546 4005-4515/com.gloppygloop E/TangoCameraPreview: Error updating texture.
                                                                   com.google.atap.tangoservice.TangoInvalidException
                                                                       at com.google.atap.tangoservice.Tango.throwTangoExceptionIfNeeded(Tango.java:826)
                                                                       at com.google.atap.tangoservice.Tango.updateTexture(Tango.java:333)
                                                                       at com.google.atap.tangoservice.TangoCameraPreview.updateTexture(TangoCameraPreview.java:267)
                                                                       at com.google.atap.tangoservice.TangoCameraPreview$MainRenderer.onDrawFrame(TangoCameraPreview.java:117)
                                                                       at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
                                                                       at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

I'm basically just calling the TangoCameraPreview.onFrameAvailable, whenever I have OnFrameAvailable from the OnTangoUpdateListener like they recommend in the docs. As far as I can tell, its just because the JNI method is not able to get a timestamp properly from the camera and that causes an error. I'm trying to use the Fisheye camera, but I've tried the Color camera and the RGBIR camera as well.

ethan123
  • 1,084
  • 2
  • 14
  • 26

1 Answers1

2

Found the solution, so I'll just leave it here in case anyone else gets stuck with this. The problem was that I was using another GLSurfaceView in the same context as my TangoCameraPreview. After some searching around, I found this answer which cleared things up for me. Basically, whenever you have multiple SurfaceViews in the same context you need to be conscious of the Z-order of these views. Otherwise, you'll just get strange behavior like I was experiencing. The Tango error was just misleading because I'm still getting the error even though the TangoCameraPreview is functioning as expected.

Community
  • 1
  • 1
ethan123
  • 1,084
  • 2
  • 14
  • 26