audiobasesink: consuming too much data after EOS and seek back to 0
Submitted by Aleksander Wabik
- have a sink working in a push mode
- play some content till EOS
- after EOS, leave the pipeline in playing state for some time (a minute will do good)
- pause the pipeline,
- flushing seek to 0
- unpause the pipeline
Observed effects (bug):
- the audio sink consumes all data that is provided to it immediately,
- if a queue is put before the sink, it will not fill
- if a queue is put before the video sink, and the queue before audio sink, and the application unpauses only when both queues fill, it will never happen.
I will try to write a minimized testcase.
The root cause of the problem seems to be handling of the EOS event in audiobasesink. It calls gst_audio_base_sink_drain(), but does not call gst_audio_ring_buffer_pause(). Adding gst_audio_ring_buffer_pause() fixes the problem.
If the sink works in a pull mode, and gst_pad_pull_range() returns EOS, then the bug should not reproduce - then gst_audio_ring_buffer_pause() is called after draining the sink.