I am continuing work that I referenced here and have hit a few snags. I have a VirtualDisplay that has a Surface that the frames are written to and then I use that same surface as input for a MediaCodec so that the frames from the VirtualDisplay are encoded. This is all occurring in some Threads that are running in an Android Service NOT in an Activity.
I now want to add an intermediary Surface into the chain so that the progress will go VirtualDisplay -> write to SurfaceA -> some logic/features -> write to SurfaceB -> encode SurfaceB
I have created, after much struggle, SurfaceA using just straight OpenGL and EGL calls, not using GLSurfaceView. I'm using this as an example of how I should be writing from SurfaceA to SurfaceB. From my understanding I just need two EGLSurfaces in a single EGLContext.
From my understanding, the GL context can be lost at any time and I may need to recreate my OpenGL texture (and maybe EGLSurfaces too?). This is usually handled via GLSurfaceView but since I am not using one, is there an easy way to know when the context is lost? Should I just use a GLSurfaceView even though none of my work involves a View or is visible to the user? How do you call onPause and onResume for a GLSurfaceView if there is no Activity?
Thanks for the help.