Folks,
I am using MediaCodec to decode a network stream. Method configure() on MediaCodec takes a SurfaceView object as a parameter, making it easy to decode the output directly into the surface view.
The problem comes in when the device orientation is changed. The old surface gets destroyed and a new surface is created. The surface that mediacodec is still holding becomes invalid.
I cannot destroy MediaCodec object and recreate a new one. This would result in waiting for a few more seconds until a new key video frame arrives.
Looking at all the methods that are available on MediaCodec, it appears the only way to change the surface is by calling configure(). Is it okay to call configure() multiple times on the MediaCodec object?
Or, perhaps there is a way to store the internal state of the MediaCodec object and transfer it to a new MediaCodec object.
I would appreciate it if you can guide me in the right direction. Thank you in advance for your help.