audiolatency
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
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.
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBin ╰──audiolatency
Implemented interfaces
Factory details
Authors: – Nirbheek Chauhan
Classification: – Audio/Util
Rank – primary
Plugin – audiolatency
Package – GStreamer Bad Plug-ins
Pad Templates
sink
audio/x-raw:
format: F32LE
layout: interleaved
rate: [ 1, 2147483647 ]
channels: [ 1, 2147483647 ]
src
audio/x-raw:
format: F32LE
layout: interleaved
rate: [ 1, 2147483647 ]
channels: [ 1, 2147483647 ]
Properties
average-latency
“average-latency” gint64
The running average latency, in microseconds
Flags : Read
Default value : 0
last-latency
“last-latency” gint64
The last latency that was measured, in microseconds
Flags : Read
Default value : 0
print-latency
“print-latency” gboolean
Print the measured latencies on stdout
Flags : Read / Write
Default value : false
samplesperbuffer
“samplesperbuffer” gint
The number of audio samples in each outgoing buffer. See also samplesperbuffer
Flags : Read / Write
Default value : 240
Since : 1.20
The results of the search are