title: How to keep decoding alive during screen orientation?
body: <p>Folks,</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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. </p>
  
  <p>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?</p>
  
  <p>Or, perhaps there is a way to store the internal state of the MediaCodec object and transfer it to a new MediaCodec object.</p>
  
  <p>I would appreciate it if you can guide me in the right direction. Thank you in advance for your help.</p>