Schedule mode: push or pull

Table of Contents

Overview

The scheduling mode of a pad defines how data is retrieved from (source) or given to (sink) pads. GStreamer can operate in two scheduling mode, called push- and pull-mode. GStreamer supports elements with pads in any of the scheduling modes where not all pads need to be operating in the same mode.

So far, we have only discussed _chain ()-operating elements, i.e. elements that have a chain-function set on their sink pad and push buffers on their source pad(s). We call this the push-mode because a peer element will use gst_pad_push () on a srcpad, which will cause our _chain ()-function to be called, which in turn causes our element to push out a buffer on the source pad. The initiative to start the dataflow happens somewhere upstream when it pushes out a buffer and all downstream elements get scheduled when their _chain ()-functions are called in turn.

Before we explain pull-mode scheduling, let's first understand how the different scheduling modes are selected and activated on a pad.

Push or pull

Normally a source element will push data to the downstream element using the gst_pad_push() method. The downstream peer pad will receive the buffer in the Chain function. In the push mode, the source element is the driving force in the pipeline as it initiates data transport.

It is also possible for an element to pull data from an upstream element. The downstream element does this by calling gst_pad_pull_range() on one of its sinkpads. In this mode, the downstream element is the driving force in the pipeline as it initiates data transfer.

It is important that the elements are in the correct state to handle a push() or a pull_range() from the peer element. For push() based elements this means that all downstream elements should be in the correct state and for pull_range() based elements this means the upstream elements should be in the correct state.

Most sinkpads implement a chain function. This is the most common case. sinkpads implementing a loop function will be the exception. Likewise, srcpads implementing a getrange function will be the exception.

Reference

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: Uncategorized