Question about the ksstream_pointer?

When I was using KsPinGetLeadingEdgeStreamPointer function to processing data frame in a video capture driver based on avssamp sample from the DDK, the function receives the State argument which take one of KSSTREAM_POINTER_STATE_LOCKED and KSSTREAM_POINTER_STATE_UNLOCKED. I just wondered that when the data buffer for data frame was allocated in the minidriver, in pin creation or else where? Thank you for your help.

I know where to get the data frame allocated. It is through ksallocator_framing_ex to allocate the data buffer.