mediacodec: check exceptions after createByCodecName()

Release MediaCodec only if the codec has been successfully created.
This might avoid some crashes.