Various MediaCodec fixes

/cc @davilla