user1730694
user1730694

Reputation: 472

render camera in openles 2.0 with forced delay

Is it possible to render camera in openles 2.0 with forced delay? for example delay is 5 frames? For now i'm rendering output with surfacetexture and opengles-2.0.

Upvotes: 1

Views: 80

Answers (1)

fadden
fadden

Reputation: 52323

If you're receiving 30 frames per second, and you want to introduce a constant delay of 5 frames, you need to do something with those 5 frames.

SurfaceTexture doesn't do (much) buffering. Because the producer and consumer endpoints are in the same process, it would be very easy to cause a deadlock by overrunning the consumer. So SurfaceTexture uses a BufferQueue in "async" mode, which means it drops frames if the consumer isn't ready for the next one.

So you'll need a way to do your own buffering, which means copying the data out of the "external" texture. One way to do this is to render the textures to a series of FBOs, from which you can render later. Be sure to keep an eye on the memory usage here -- a 1920x1080 32-bit ARGB image occupies about 8MB, so keeping 5 around increases your memory footprint by 40MB.

Some loss of color fidelity may result, as a YUV-to-RGB conversion will be involved, but if your eventual target is RGB then this shouldn't matter.

So it's possible, but it's not easy. What are you trying to accomplish?

Upvotes: 1

Related Questions