When the iOS application is not in the foreground, the hardware encoder and
decoder become invalidated. There doesn't seem to be a way to query their state
so we don't know they're invalid until we get an error code after an
encode/decode request. To solve the issue, we just don't encode/decode when the
app is not active, and reinitialize the encoder/decoder when the app is active
again.
Also fixes a leak in the decoder.
BUG=webrtc:4081
Review URL: https://codereview.webrtc.org/1732953003
Cr-Commit-Position: refs/heads/master@{#11916}