Measuring Total Latency of a Pipeline - 2023.1 English

H.264/H.265 Video Codec Unit v1.2 Solutions LogiCORE IP Product Guide (PG252)

Document ID
PG252
Release Date
2023-05-16
Version
2023.1 English

The GStreamer framework includes a tracing module that helps determine source to sink latencies by injecting custom events at source and processing them at sinks. It effectively measures the time between when the buffer is produced by the source pad of the first element and when it reaches the sink pad of the last element. Consider the following pseudo pipeline:

source! element! element! sink

The GStreamer tracing module measures the latency introduced by element ! element, which is the inner processing of the pipeline. The rest (introduced by the capture source and display device) cannot be measured accurately by the user space.

Each element reports to GStreamer the maximum latency time it takes to output the buffer after it is received. GStreamer uses this information for synchronization.

The latency tracer module gives instantaneous latencies which might not be the same as the reported latencies. The latencies might be higher if the inner pipeline (element ! element) takes more time, or lower if the inner pipeline is running faster, but the GStreamer framework waits until the running time equals the reported latency.

You can measure the average userland latency using the following formulas:

Average userland latency = MAX (Pipeline reported latency, AVG (Instantaneous latency))

The following section provides an example of measuring the latency-related data for the AVC 4kp60 capture→encode→decode→display use case. Follow the setup steps described in the wiki.