alsasink/ringbuffer cut off when no buffer timestamps
We have simple pipeline where we play raw audio (decodebin is there for test if non-raw audio would be cut-off):
appsrc ! decodebin ! queue ! audioconvert ! audioresample ! identity ! alsasink
Description When EOS is received on bus-watch the glib context is quit and pipeline set to NULL state and unrefed. With identity we see that all buffers were processed, however we still hear that the last samples were cut-off. The buffers have no timestamps as we just push them to the appsrc as they are.
The bug can be reproduced on 1.14 branch (compiled with gst uninstalled), and also on 1.6.3 and 1.8.3.
Workaround The problem is fixed when we use audiorate before alsasink, however this is just workaround. Its not clear (to me) if the alsasink should handle the buffers correctly. Since even without timestamps the audio plays correctly I expect it to not to be cut-off.
Provided C snippet Appsrc example was used for this. appsrctest.c There is audiorate commented out, after uncommenting the cut-off is not heard. Compile:
gcc appsrctest.c `pkg-config --cflags --libs gstreamer-1.0 gstreamer-app-1.0`
Testing file generated in audacity (Generate DTFM tones) containing 3 different beeps. 3beeps-16kHz-16bps-mono.raw
The bug can be heard by running:
./a.out /path/to/3beeps-16kHz-16bps-mono.raw
Logs from run with audiorate and without it: audiorate-used.log audiorate-not-used.log