I am using OpenGLES2 output to display to a SurfaceView or encode to mp4 using MediaCodec.
However, I can only do one at a time. I can obviously draw using OpenGLES2 onto two separate surfaces but that would be a really inefficient use of the GPU.
What I want is to use some sort of reference counting to reuse the buffer to both draw on the screen and encode the single OpenGLES2 output. Like how camera service does in the Shared Surfaces concept.
Can can one do both display and encode of a buffer? Is there some sort of tee element (like in GStreamer) present in Android?