appsink ignoring playback rate set with seek event

Alejandro alejandro.gonzalez.correo at gmail.com
Wed Oct 21 00:35:51 UTC 2020


Hello.

I'm trying to add extra sound speed changing functionality to my Rust
that processes audio, which currently reads sound files, processes
them a bit and them encodes them to OGG, using a pipeline like this:

filesrc -> decodebin -> audioconvert -> capsfilter -> audioresample ->
capsfilter -> vorbisenc -> oggmux -> appsink (appsink has "sync" set
to false)

I think I should mention that I'm using the latest version of
GStreamer Rust crates. Also, I use the appsink because I need to
process the raw result file bytes for packaging in a ZIP file. I could
use a filesink with a temporary file, but that sounds much less
performant. Most of the GStreamer related code of the application
follows the structure of the appsink example included with GStreamer
sources.

I've read that, in order to change the audio speed, I should send a
seek event to a paused pipeline, which I'm doing currently like this:

gstreamer_pipeline.seek(
    2.0, gstreamer::SeekFlags::FLUSH,
    gstreamer::SeekType::None, gstreamer::CLOCK_TIME_NONE,
    gstreamer::SeekType::None, gstreamer::CLOCK_TIME_NONE
)?;

However, this does not work, and if I copy the bytes received in the
appsink to a file, the result file plays at normal speed, which is not
what I want. I've tried the following without success:

- Setting "sync" to false: same result
- Using frame stepping: does not work (if I remember right it throws
errors; I've tried it last time some long hours ago)
- Seeking to a start time too: works, but playback rate is unaffected,
so it does not solve the issue
- Combining all the above and several other tricks I don't remember: nope

I've checked the debug logs, and as far as I can view, the seek event
propagates the rate successfully, and both PTS and DTS are calculated
fine in several elements. However, near the appsink sample pulling
calls, I see only mentions to the PTS.

But, if I swap the appsink for a filesink or autoaudiosink, things
work okay, and the audio is audibly faster. Can anyone tell me any
pointers to get the appsink to behave like I want? I believe that this
may be related to an older, unresolved email thread in this list
titled "gst_element_seek() when the pipeline has an appsink - bug? ",
but I'm not sure.


More information about the gstreamer-devel mailing list