kCMTimeInvalid is invalid CMTime, but based on Apple document, there are more invalid CMTime, what are they? What does CMTime "invalid" means? It's overflow, uninitiated or anything else?
https://developer.apple.com/documentation/coremedia/kcmtimeinvalid
All fields are 0, so you can calloc or fill with 0's to make lots of them. Do not test against this using (time == kCMTimeInvalid), there are many CMTimes other than this that are also invalid. Use CMTIME_IS_INVALID(time) instead.
I found some cases when CMTime is invalid:
When flags(CMTimeFlags) kCMTimeFlags_Valid not set.
kCMTimeFlags_Valid Must be set, or the CMTime is considered invalid.
Some operations of CMTimeAdd
+infinity + +infinity == +infinity
-infinity + -infinity == -infinity +infinity + -infinity == invalid -infinity + +infinity == invalid
There are five possible states: