Hi All, I'm relatively new to Ogg and Vorbis and I've hit a pretty puzzling issue, and I'm wondering if a veteran could help me out. I'm attempting to decode a chained live Ogg Vorbis stream. The primary issue is that the source does not exactly follow validation (I have no control of this). The stream switches from a prerecorded segment, to a live segment, back to a prerecorded segment. I believe the live segment is missing a B.O.S. packet, which is creating some unintended effects. The audio ends up playing, but it is very distorted until it switches back to a prerecorded segment. I've uploaded a test of the chain here: https://s3.amazonaws.com/teamalphaservices-test/b1-Live-b2.ogg It plays perfectly in Google chrome, but when attempting to use my own decoder, it has strange distortion when playing the live part. Here's a link to a Github Gist of the decoder I'm using: https://gist.github.com/DrakeWitt/3634299ce4363d26d16c34be229a350f What's the best way to modify my logic to compensate for the odd stream? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xiph.org/pipermail/vorbis/attachments/20170403/f36cfeb8/attachment.html>
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.oggIt 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