Add support for instantaneous rate changes
@slomo
Submitted by Sebastian Dröge Link to original bug (#796648)
Description
Currently doing smooth playback rate changes requires doing a non-flushing seek to the current position (start/stop_type=NONE). This generally takes a while as the new rate will only take place once the segment event from the demuxer arrives in the sink, so after all currently buffered data was consumed by the sink.
The code here implements an approach that allows the rate to change more or less instantaneously:
https://cgit.freedesktop.org/~slomo/gstreamer/log/?h=instant-rate-change
https://cgit.freedesktop.org/~slomo/gst-plugins-base/log/?h=instant-rate-change
https://cgit.freedesktop.org/~slomo/gst-plugins-good/log/?h=instant-rate-change
https://cgit.freedesktop.org/~slomo/gst-plugins-bad/log/?h=instant-rate-change
Supported demuxers are matroskademux, qtdemux and tsdemux. Most testing was done with qtdemux but it has all kinds of unrelated seeking problems, matroskademux seems to work best at this point.
The design is described here: https://cgit.freedesktop.org/~slomo/gst-docs/tree/markdown/design/gapless-rate-change.md?h=instant-rate-change
In short the idea is that demuxer notify all sinks immediately about the new rate that is to be applied, the sinks apply it immediately from that point onwards until the corresponding segment event arrives and then compensate for the difference in running time that actually has passed and that upstream believes has passed.