pulsesink: playing after EOS causes a gap in playback after seek
Submitted by mki..@..il.com
Link to original bug (#788529)
Description
Created attachment 360920
Scenario file for gst-validate
If after EOS playing state of pipeline is maintain, PulseAudio still wants to render client's data and calls request callback. pulsesink doesn't have data to write, thus PulseAudio render "silence". If after some waiting time (e.g. 30 seconds), GStreamer's client seeks (e.g. to 0), a user will hear proper playback for a while (e.g. 12 seconds), than "silence" will be rendered by PulseAudio till stream time doesn't reach waiting time (earlier mentioned 30 seconds).
To reproduce, please run command with attached scenario file:
gst-validate-1.0 --set-scenario=brainson.scenario uridecodebin uri=https://play.podtrac.com/APM-BrainsOn/play.publicradio.org/itunes/d/podcast/minnesota/podcasts/brains_on/2017/02/brainson_20170214_69_20170214_64.mp3 ! autoaudiosink
It seems that:
- pulsesink calculates absolute offset in PulseAudio's client buffer based on running (?) time,
- PulseAudio doesn't increase write index, when silence is rendered (samples for silence are stored in separate memory block), i.e. underrun is happened,
- PulseAudio doesn't correct write index, if data are provided after silence,
- PulseAudio increases read index during silence.
IMHO pulsesink expects that PulseSink' read index should not be increased or write index will be rewind to position of read index after underrun.
Attachment 360920, "Scenario file for gst-validate":
brainson.scenario