vorbisdec: Improve "new headers while initialized" handling
authorEdward Hervey <edward@centricular.com>
Tue, 13 Feb 2018 07:36:30 +0000 (08:36 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 13 Feb 2018 07:41:29 +0000 (08:41 +0100)
commitaab5cccc340c5562429869612f2e788cfcd579f7
tree44f52b374baff007d23795d791072184327d4a64
parenteacb7a77d2f00304a4af884d2cfc4966da861acf
vorbisdec: Improve "new headers while initialized" handling

If new headers arrive after we are initialized, we need to make
sure that they are indeed valid.

A vorbis bitstream always begins with three header packets and must
be in order.

Also some streams have unframed (invalid?) headers that might
confuse and disrupt the decoding process.

Therefore if ever we see new headers, we accumulate them and once
we get a non-header packet we check them to make sure that:
* We have at least 3 headers
* They are the expected ones (identification, comments and setup)
* They are in order
* Any other "header" is ignored

If those conditions are met, we reset and reconfigure the decoder

https://bugzilla.gnome.org/show_bug.cgi?id=784530
ext/vorbis/gstvorbisdec.c
ext/vorbis/gstvorbisdec.h