flacparse: Drain the parser when a CAPS event is received
authorSebastian Dröge <sebastian@centricular.com>
Mon, 16 Apr 2018 18:27:47 +0000 (21:27 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 16 Apr 2018 18:29:57 +0000 (21:29 +0300)
commit336a97157c0aeae470c5c60492a7b69a35215cec
treeaf9b4ea0fcb803af4507d0040780a69b61e10e1c
parentdff05f451de5ed472eb491a88feda44347dc4cca
flacparse: Drain the parser when a CAPS event is received

After a CAPS event, in theory a new stream can start and it might start
with the FLAC headers again. We can't detect FLAC headers in the middle
of the stream, so we drain the parser to be able to detect either FLAC
headers after the CAPS event or the continuation of the previous stream.

This fixes for example

gst-launch-1.0 audiotestsrc num-buffers=200 ! flacenc ! c. \
    audiotestsrc num-buffers=200 freq=880 ! flacenc ! c. \
    concat name=c ! rtpgstpay ! udpsink host=127.0.0.1 port=5000

gst-launch-1.0 udpsrc multicast-group=127.0.0.1 port=5000 \
    caps=application/x-rtp,media=application,clock-rate=90000,encoding-name=X-GST ! \
    rtpgstdepay ! flacparse ! flacdec ! audioconvert ! pulsesin
gst/audioparsers/gstflacparse.c