Log in or register to post comments

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 20, 2012 - 8:57am #1

Hi,

I run into a very weird problem that SurfaceTexture fails to update the video data to opengl texture(GL_TEXTURE_EXTERNAL_OES).

I actually took the code from VideoPlayback sample, and make it be able to dynamically load different number of videos(played on targets)

This problem happens in this case.

1. First time I open up the camera and load let's say 1 target/video(which uses one texture, assuming the texture ID is 6), then leave camera, which destroys the Activity(I think the opengl surface should also be destroyed.)

2. Open up the camera again, and this time we load 2 targets/videos(which uses two textures, assuming the texture ID 1 for video A, 2 for video B)

3. Video A plays nicely, but when we start to play video B, it crashes due to the failure of updateTexImage. The exception stack is below.

 

---------

11-21 00:52:21.177: E/SurfaceTexture(8122): error binding external texture image 0x567fb0 (slot 0): 0x502

11-21 00:52:21.177: W/System.err(8122): java.lang.RuntimeException: Error during updateTexImage (see logs)

11-21 00:52:21.177: W/System.err(8122): at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:164)

11-21 00:52:21.177: W/System.err(8122): at xxxxxxx.VideoPlayerHelper.updateVideoData(VideoPlayerHelper.java:602)

11-21 00:52:21.177: W/System.err(8122): at xxxxxxx.ARViewRenderer.onDrawFrame(ARViewRenderer.java:464)

11-21 00:52:21.177: W/System.err(8122): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)

11-21 00:52:21.177: W/System.err(8122): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

--------
 
This problem only happens on Samsung Galaxy S2, it runs nicely on HTC J, HTC One S, Sharp SH530U...
Could someone tell me why? I have no clue for this issue.....
Thanks.

 

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

December 17, 2012 - 2:26am #13

You're welcome!

I'm really glad to hear that 2.0 has fixed it.

Actually I just checked with our engineering team and they confirmed me that there was a little/subtle issue with background texture binding, which is now indeed completely solved in Vuforia 2.0.

So, yes, if you find any similar issues by doing more tests, please share it with us,

but I really believe you will not face this issue any longer on any device ;-)

 

 

 

 

Hi, after integrating vuforia

December 17, 2012 - 12:28am #12

Hi, after integrating vuforia SDK 2.0, this issue seems no longer existing.

It runs pretty ok now.

Thanks for your reply, I will do more test to see if this issue is still there or not.

Thanks again! :)

OK, so, can you summarize the

December 16, 2012 - 1:56pm #11

OK, so, can you summarize the list of devices where this occurs (black texture and/or crashing)

and for each device, the exact model and Android version ?

I will then check internally with the engineering team to see what could be the issue.

 

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

December 13, 2012 - 12:55am #10

Hi, I found a similar problem and it's on other devices(HTC One S/Sharp SH530U), black texture appears(if previous QCAR camera device initialized 6 textures, and the black texture ID is 8, ), and once I remove drawVideoBackground() from _renderFrame(), the texture will showup normally.

It looks like there should be something wrong in drawVideoBackground().

Thanks.

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

December 12, 2012 - 10:09am #9

Hi, as you suggested, I remove drawVideoBackground() in _renderFrame(), and this problem disappears!

Apparently it looks like that drawVideoBackground() causes this problem.. Is there any quick fix or workaround for this?

Thanks!

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 22, 2012 - 11:09am #8

Hi, the function I was referring to is called drawVideoBackground() (not bindVideoBackground());

it is in the _renderFrame() function in native (C++) code.

 

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 22, 2012 - 9:47am #7

I don't see bindVideoBackgroundTexture() from the _renderFrame() method, actually I don't see in my whole project...

I am not actually that familiar with OpenGL stuff, so removing all QCAR dependencies from my project is gonna take a while...

Thanks for your suggestion, I will get back to you if I have any new finding!

Thanks again!

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 21, 2012 - 9:16am #6

OK, that indeed looks very odd.

What I would suggest is to try to make an application that plays the videos without QCAR (basically you keep your project as it is now but you remove all QCAR dependencies, and you can just replace the Pose matrix of the trackables with some custom matrices); this will also make the video background disappear.

Then you can still keep the rest of the logic in place and play the videos on texture anyway.

This will tell us if this issue is caused by some OpenGL interactions by QCAR or if it is really a general OpenGL/Android issue with that device.

If you prefer, as a first experiment you could also just remove the code bindVideoBackgroundTexture() from the _renderFrame() method (and then evebntually make the full QCAR removal if you don't see any differences).

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 21, 2012 - 8:38am #5

Yes, what I mean "open the camera" is restarting the QCAR camera.

and ...

- is the onPause and onResume called (in the Java activity) ?

Yes.

- is the _initRendering native function called the second time (when you "re-open the camera") ?

Yes.

- is the glGenTextures() inside the _initRendering called ?

Yes. onSurfaceCreated(java, the GL thread) then calls _initRendering, and finally glGenTextures is called.

 

Basically the activity is destroyed when I stop QCAR camera, and is recreated when I start QCAR camera.

This issue happens only on Galaxy S2... which is soooo weird......

BTW, there is another symptom is that there is only one corrupt texture and it's decided when I first time start QCAR camera, later no matter how many time I stop/start QCAR camera(loads different number of videos) the corrupt texture ID is always the same.(in this example the corrupt texture ID is [7])

 

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 21, 2012 - 6:16am #4

OK, I see the texture IDs look good. 

You say "open the camera"; what do you mean exactly ? do you pause/resume the app, or do you stop and restart the QCAR camera device ?

It would be helpful if you could be more detailed here, and if you can verify what functions are called, i.e.:

- is the onPause and onResume called (in the Java activity) ?

- is the _initRendering native function called the second time (when you "re-open the camera") ?

- is the glGenTextures() inside the _initRendering called ?

my suspect is that your OpenGL context is at some point destroyed and then recreated, but you're still using the old texture IDs (unless you are sure that glGenTextures() is called twice, and not just the first time);

 

 

 

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 21, 2012 - 3:36am #3

Hi, sorry there is some typo in the post, "texture ID 1 for video A, 2 for video B)" is wrong, it should be "texture ID 6 for video A, 7 for video B)"

and.. I did print out the texture value, and they look OK.  Let me explain more detail of the symptom below..

--

1st time open camera : Texture [6] used.

2nd time open camera : Texture [6] OK, Texture [7] not OK, Texture [8] OK, Texture [9] OK, so on and so on....

--

glGenTextures does its job, the value of texture all look good to me...

any idea? thanks!

SurfaceTexture fails to "updateTexImage"(on Samsung Galaxy S2)

November 21, 2012 - 12:56am #2

Hi, can you put a Log in the call to "glGenTextures(1, &videoPlaybackTextureID[i]);" in the _initRendering function, to see if the glGenTexture is called also the second time ?     mayeb also print out the values of the textures.

Log in or register to post comments