Bewerken

Delen via


State Transitions

To ensure orderly resource allocation, only a subset of the possible kernel streaming state transitions is allowed. The following table lists the allowed transitions along with tasks that a Stream class minidriver typically performs during such transitions.

Transition Description

Stop to pause

Allocate resources. The read SRBs are queued after the transition to KSSTATE_PAUSE has completed.

Pause to run

Begin streaming.

Run to pause

Stop streaming. The outstanding read SRBs remain in the queue maintained by the minidriver.

Pause to stop

Deallocate resources and complete all outstanding read SRBs. SRBs that have not been filled with an image are completed with zero length in the DataUsed member of the KSSTREAM_HEADER structure.

Note  : Transitions can cycle multiple times between the KSSTATE_PAUSE and KSSTATE_RUN states before returning to the KSSTATE_STOP state. Video capture minidrivers should expect transitions such as:

KSSTATE_STOP -> KSSTATE_ACQUIRE -> KSSTATE_PAUSE -> KSSTATE_RUN -> KSSTATE_PAUSE -> KSSTATE_RUN -> KSSTATE_PAUSE -> KSSTATE_STOP

When a stream is in a KSSTATE_STOP state, the minidriver must immediately complete all outstanding data-read SRBs.

Because a user-mode application can end unexpectedly while streaming, all Stream class minidrivers must accept and process an SRB_CLOSE_STREAM request from the Stream class interface at any time. Before the Stream class interface sends SRB_CLOSE_STREAM to a minidriver, it cancels all outstanding buffers through the minidriver's HwCancelPacket routine. Note that the stream state cannot be set to KSSTATE_STOP before the application terminates.

Do not update the PictureNumber or DropCount members of KS_FRAME_INFO, KS_VBI_FRAME_INFO, or KSPROPERTY_DROPPEDFRAMES_CURRENT_S on transition from KSSTATE_PAUSE to KSSTATE_RUN or KSSTATE_RUN to KSSTATE_PAUSE. For more information, see Capturing Video.