An infinitive is the name given to the base (i.e. uninflected) form of a verb when it functions as a nonfinite verbal element, namely when it occurs after certain prepositions, most notably 'to'*, or after an auxiliary verb. Thus the boldfaced forms of the following
He wanted to go to the fair.
Does she do anything besides complain?
Can you help me?
Do you like her?
are all infinitives.
Although properly reserved for the verb form itself, on account of the great frequency of the [to + infinitive] combination, the term ‘infinitive’ is often popularly applied to the entire two-word phrase, with the term ‘bare infinitive’ used to distinguish the one-word form.
Infinitives (with or without a preceding ‘to’) serve 4 major grammatical functions:
1. As COMPLEMENTS (traditionally labeled ‘dependents’) to auxiliary and other verbs
2. As ADJECTIVALS, e.g. ‘to remember’ in It was a day to remember. (‘to remember’ here meaning ‘memorable’)
3. As ADVERBIALS, e.g. ‘to be’ in To be honest, I’ve never even been there. (Cf. Honestly,...)
4. As NOMINALS, e.g. both infinitives of For a Viking, to die in battle was to be destined for glory.
Secondly, to answer your two specific queries:
(1) The infinitive of 'must have been waiting' is 'have' (complementing modal auxiliary 'must')
(2) No, 'sleeping' in the phrase you cite is a gerund.
*N.B. Not all linguists accept the 'to' that precedes an infinitive (as opposed to e.g. that which precedes 'sleeping' in your example) as a true preposition. Given, however, both that it is incontrovertibly one in origin, and that no other word class even remotely suitable for its classification exists, it seems prudent to term it, at the very least, an 'etymological preposition'.
Student or Learner