'GStreamer volume plugin seems slow to react to volume property change
I'm currently building a small video player (and cutter) using GStreamer and Qt. My pipeline is as follows :
| | -> video -> | Queue | -----------------------------------------------------> | PlaySink |
| UriDecodeBin | -> audio1 -> | Queue | -> | AudioConvert | -> | Volume | -> | AudioMixer | -> | |
| | -> audio2 -> | Queue | -> | AudioConvert | -> | Volume | -> | |
Volume is the plugin from https://gstreamer.freedesktop.org/documentation/volume/index.html?gi-language=c Playback is fine, pausing and seeking as well, but when I try to change the volume (while playing a video) using following call :
g_object_set(_volumes[track], "volume", value, NULL);
The change can be heard only around 1 second later, which feels extremely slow.
Is this latency to be expected for this plugin (and/or whole pipeline) ?
If it isn't, how can I improve the latency of the change ?
If it is, is there any other plugin I can use to change the volume that would react faster ?
Solution 1:[1]
note : images inserted are quite wide, so open them in new tab if you want to zoom in
The answer came by printing the full pipeline : delay was caused by playsink element.
So, the old pipeline I used in the question looks like this :
We can see here that it the playsink created two queues, one for audio aqueue and one for video vqueue, and that those queues are using default buffering settings, allowing for up to one second of buffering, which was corresponding more or less to the delay I was experiencing when modifying volume parameters of the volume elements.
To solve the problem, I first looked into configuring the queues size for playsink, but it was unsuccessful, so I simply removed playsink from the pipeline, which now looks like this :
The audio queue audioQueue is setup to allow at most 50ms of buffering, which makes audio volume change quite reactive.
I didn't added a StreamSynchronizer as playsink uses. Synchronization seems to be fine. I'll try to figure out if it is needed or not in my case (single pipeline), and will update here if I find an answer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Felix Bertoni |


