I was trying to find a way to add basic delay to my sound that can be set in milliseconds and can be changed on-the-fly, i’ve been told to use queues to try to achieve this but nothing was precise and nothing gave me more than 1-2 seconds of delay.
If you want to delay an audio stream or any stream really you can just use gst_pad_set_offset() on a sink pad, and it will shift forward/backward the running time of that stream (which will be used by sink/mixer elements to position the stream on the timeline).
Of course if you delay a stream that data has to go/stay somewhere, so it will cause some backpressure on the data producer side.
To alleviate that you can add a queue element which will provide buffering and decouple the producer/consumer side with a new thread.
Which will in effect be similar to what you’re doing when you store data inside your element, you kinda reimplement that sort of logic.