## audiolatency

audiolatency

## Properties

gint64 | average-latency | Read
gint64 | last-latency | Read
gboolean | print-latency | Read / Write

## Types and Values

struct | GstAudioLatency

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBin
                        ╰── GstAudioLatency

## Implemented Interfaces

GstAudioLatency implements GstChildProxy.

## Description

Measures the audio latency between the source pad and the sink pad by outputting period ticks on the source pad and measuring how long they take to arrive on the sink pad.

The ticks have a period of 1 second, so this element can only measure latencies smaller than that.

#### Example pipeline

    1

    gst-launch-1.0 -v autoaudiosrc ! audiolatency print-latency=true ! autoaudiosink

Continuously print the latency of the audio output and the audio capture

In this case, you must ensure that the audio output is captured by the audio source. The simplest way is to use a standard 3.5mm male-to-male audio cable to connect line-out to line-in, or speaker-out to mic-in, etc.

Capturing speaker output with a microphone should also work, as long as the ambient noise level is low enough. You may have to adjust the microphone gain to ensure that the volume is loud enough to be detected by the element, and at the same time that it's not so loud that it picks up ambient noise.

For programmatic use, instead of using 'print-stats', you should read the 'last-latency' and 'average-latency' properties at most once a second, or parse the "latency" element message, which contains the "last-latency" and "average-latency" fields in the GstStructure.

The average latency is a running average of the last 5 measurements.

## Synopsis

### Element Information

plugin | audiolatency
author | Nirbheek Chauhan <nirbheek@centricular.com>
class | Audio/Util

### Element Pads

name | sink
direction | sink
presence | always
details | audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

name | src
direction | source
presence | always
details | audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

## Functions

## Types and Values

### struct GstAudioLatency

    struct GstAudioLatency;

## Property Details

### The `“average-latency”` property

      “average-latency”          gint64

The running average latency, in microseconds.

Flags: Read

Allowed values: [0,1000000]

Default value: 0

### The `“last-latency”` property

      “last-latency”             gint64

The last latency that was measured, in microseconds.

Flags: Read

Allowed values: [0,1000000]

Default value: 0

### The `“print-latency”` property

      “print-latency”            gboolean

Print the measured latencies on stdout.

Flags: Read / Write

Default value: FALSE