Pause/Resume MediaCodec
The MediaCodec
discards its configuration when stopped, so you will need to call configure()
again. I'm not sure why you're trying to do restart it though -- you can just leave it active, without feeding it data.
For example, see the CameraCaptureActivity
in Grafika, which leaves the encoder alive across activity restarts. If you don't want to have a pause in the video during the restart, you'll need to keep track of how long encoding was paused, and then adjust the timestamps being fed into the muxer.