Task Submission

Internally, when the application calls the Process function, the SDK performs the following operations:

· Within the same thread, SDK calls back the function Submit to check the validity of the I/O parameters.

  • If the function Submit returns an error code, SDK aborts the operation and returns the error code to the application.
  • If the function Submit approves the I/O parameters, the function returns a task identifier to SDK. A task identifier is a unique user-defined parameter that identifies the work of processing the frames submitted by Process function. The SDK then schedules the task execution based on available resources. Next, the SDK returns a sync point back to the application for later synchronization.

This discussion introduces two new concepts: task submission and task execution. Task submission checks the validity of the I/O parameters within the same application thread and submits a task identifier that is executed later by SDK. Task execution is the actual execution of the submitted task(s) within SDK internal threads.

Due to the asynchronous nature of the SDK API, the application must follow the guidelines below when accessing I/O parameters:

Data Type During Task Submission
( Submit )
During Task Execution
( Execute )

Frame data in system memory

The frame data is not ready. Do not read the frame data buffer.

SDK resolves the data dependency before running the task. The frame data is ready to access.

Frame data in video memory

The frame data is not ready. Do not lock the surface or access to the frame data.

Bitstream data for decoder

The bitstream data is ready. It is safe to read data from buffer and move data pointer.

The bitstream buffer has been reused by application. Do not access it.

Bitstream data for encoder

The bitstream data is not ready. Do not access the bitstream buffer.

SDK resolves the data dependency before running the task. The bitstream data is ready to access.

Parameters in output structures

The structure parameters are available. The Submit function can overwrite output structure parameters if necessary.

The structure parameters are available. However, do not overwrite parameters unless an overwrite is anticipated by downstream components.


有关编译器优化的更完整信息,请参阅优化通知