## multiqueue multiqueue — Multiple data queue |

## Synopsis

                        GstMultiQueue;

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstMultiQueue

## Properties

      "extra-size-buffers"       guint                 : Read / Write
      "extra-size-bytes"         guint                 : Read / Write
      "extra-size-time"          guint64               : Read / Write
      "max-size-buffers"         guint                 : Read / Write
      "max-size-bytes"           guint                 : Read / Write
      "max-size-time"            guint64               : Read / Write
      "high-percent"             gint                  : Read / Write
      "low-percent"              gint                  : Read / Write
      "use-buffering"            gboolean              : Read / Write

## Signals

      "overrun"                                        : Run First
      "underrun"                                       : Run First

## Description

Multiqueue is similar to a normal GstQueue with the following additional features:

1. Multiple streamhandling

   - The element handles queueing data on more than one stream at once. To achieve such a feature it has request sink pads (sink%d) and 'sometimes' src pads (src%d).

     When requesting a given sinkpad with `gst_element_get_request_pad()`, the associated srcpad for that stream will be created. Example: requesting sink1 will generate src1.

2. Non-starvation on multiple streams

   - If more than one stream is used with the element, the streams' queues will be dynamically grown (up to a limit), in order to ensure that no stream is risking data starvation. This guarantees that at any given time there are at least N bytes queued and available for each individual stream.

     If an EOS event comes through a srcpad, the associated queue will be considered as 'not-empty' in the queue-size-growing algorithm.

3. Non-linked srcpads graceful handling

   - In order to better support dynamic switching between streams, the multiqueue (unlike the current GStreamer queue) continues to push buffers on non-linked pads rather than shutting down.

     In addition, to prevent a non-linked stream from very quickly consuming all available buffers and thus 'racing ahead' of the other streams, the element must ensure that buffers and inlined events for a non-linked stream are pushed in the same order as they were received, relative to the other streams controlled by the element. This means that a buffer cannot be pushed to a non-linked pad any sooner than buffers in any other stream which were received before it.

Data is queued until one of the limits specified by the "max-size-buffers", "max-size-bytes" and/or "max-size-time" properties has been reached. Any attempt to push more buffers into the queue will block the pushing thread until more space becomes available. "extra-size-buffers",

"extra-size-bytes" and "extra-size-time" are currently unused.

The default queue size limits are 5 buffers, 10MB of data, or two second worth of data, whichever is reached first. Note that the number of buffers will dynamically grow depending on the fill level of other queues.

The "underrun" signal is emitted when all of the queues are empty. The "overrun" signal is emitted when one of the queues is filled. Both signals are emitted from the context of the streaming thread.

Last reviewed on 2008-01-25 (0.10.17)

## Details

### GstMultiQueue

    typedef struct _GstMultiQueue GstMultiQueue;

Opaque GstMultiQueue structure.

## Property Details

### The `"extra-size-buffers"` property

      "extra-size-buffers"       guint                 : Read / Write

Amount of buffers the queues can grow if one of them is empty (0=disable) (NOT IMPLEMENTED).

Default value: 5

### The `"extra-size-bytes"` property

      "extra-size-bytes"         guint                 : Read / Write

Amount of data the queues can grow if one of them is empty (bytes, 0=disable) (NOT IMPLEMENTED).

Default value: 10485760

### The `"extra-size-time"` property

      "extra-size-time"          guint64               : Read / Write

Amount of time the queues can grow if one of them is empty (in ns, 0=disable) (NOT IMPLEMENTED).

Default value: 3000000000

### The `"max-size-buffers"` property

      "max-size-buffers"         guint                 : Read / Write

Max. number of buffers in the queue (0=disable).

Default value: 5

### The `"max-size-bytes"` property

      "max-size-bytes"           guint                 : Read / Write

Max. amount of data in the queue (bytes, 0=disable).

Default value: 10485760

### The `"max-size-time"` property

      "max-size-time"            guint64               : Read / Write

Max. amount of data in the queue (in ns, 0=disable).

Default value: 2000000000

### The `"high-percent"` property

      "high-percent"             gint                  : Read / Write

High threshold percent for buffering to finish.

Allowed values: [0,100]

Default value: 99

Since 0.10.26

### The `"low-percent"` property

      "low-percent"              gint                  : Read / Write

Low threshold percent for buffering to start.

Allowed values: [0,100]

Default value: 10

Since 0.10.26

### The `"use-buffering"` property

      "use-buffering"            gboolean              : Read / Write

Enable the buffering option in multiqueue so that BUFFERING messages are emited based on low-/high-percent thresholds.

Default value: FALSE

Since 0.10.26

## Signal Details

### The `"overrun"` signal

    void                user_function                      (GstMultiQueue *multiqueue,
                                                            gpointer       user_data)       : Run First

Reports that one of the queues in the multiqueue is full (overrun). A queue is full if the total amount of data inside it (num-buffers, time, size) is higher than the boundary values which can be set through the GObject properties.

This can be used as an indicator of pre-roll.

`multiqueue` : | the multiqueue instance
`user_data` : | user data set when the signal handler was connected.

### The `"underrun"` signal

    void                user_function                      (GstMultiQueue *multiqueue,
                                                            gpointer       user_data)       : Run First

This signal is emitted from the streaming thread when there is no data in any of the queues inside the multiqueue instance (underrun).

This indicates either starvation or EOS from the upstream data sources.

`multiqueue` : | the multqueue instance
`user_data` : | user data set when the signal handler was connected.

## See Also

GstQueue