[Vorbis] Chained Vorbis Stream Distorting

Ralph Giles giles at thaumas.net
Mon Apr 3 18:59:26 UTC 2017


On 2017-04-03 10:41 AM, Drake Witt wrote:

> I've uploaded a test of the chain here:
> https://s3.amazonaws.com/teamalphaservices-test/b1-Live-b2.ogg 

It looks like the second segment is missing an eos, but all segments
have bos pages. The hole-in-data is from the header-to-data sequence
number jump in the live segment. Both of those should be fine.

> It plays perfectly in Google chrome, but when attempting to use my own
> decoder, it has strange distortion when playing the live part.

I think the distortion could be from dropping a page in the no-eos case.
That doesn't match the sequencing you describe, but it looks like you
reset the _state when you see an eos or bos page, but this is _after_
calling ogg_stream_pagein() on the page (and not checking the return value).

If there's no eos page, that means the bos page will have been rejected
by ogg_stream_pagein() because the serialno doesn't match. Then _state
is reset, but that page is dropped and the new stream is initialized
based on the _second_ page of the new segment when the parser is entered
again.

Also note you need to call ogg_stream_clear() on the old stream struct
before calling ogg_stream_init() again to avoid leaking memory.

 -r


More information about the Vorbis mailing list