A Pad will typically start a Task to push or pull data to/from the peer pads. Most source elements start a Task to push data. In some cases a demuxer element can start a Task to pull data from a peer element. This is typically done when the demuxer can perform random access on the upstream peer element for improved performance.
A Task will repeatedly call the TaskFunction with the user data that was provided when creating the task with Task. While calling the function it will acquire the provided lock. The provided lock is released when the task pauses or stops.
After creating a Task, use unref to free its resources. This can only be done when the task is not running anymore.
For debugging purposes, the task will configure its object name as the thread name on Linux. Please note that the object name should be configured before the task is started; changing the object name after the task has been started, has no effect on the thread name.