Giter Club home page Giter Club logo

Comments (5)

bert2 avatar bert2 commented on May 28, 2024

I think I found the problem. It looks like the last page of that OGG file contains 0 packets and neither PacketProvider.GetNextPacket(ref int pageIndex, ref int packetIndex) nor PacketProvider.CreatePacket(..., int packetCount, ...) handle this case.

This is the complete page as received by PageReader.ParsePageHeader(byte[] pageBuf, int? streamSerial, bool? isResync):

Immediate Window> pageBuf
{byte[28]}
    [0]: 79
    [1]: 103
    [2]: 103
    [3]: 83
    [4]: 0
    [5]: 4
    [6]: 127
    [7]: 93
    [8]: 8
    [9]: 0
    [10]: 0
    [11]: 0
    [12]: 0
    [13]: 0
    [14]: 106
    [15]: 191
    [16]: 203
    [17]: 22
    [18]: 17
    [19]: 0
    [20]: 0
    [21]: 0
    [22]: 96
    [23]: 189
    [24]: 234
    [25]: 244
    [26]: 1
    [27]: 0

I think the last page byte (pageBuf[27]) technically is some page data, because the header only uses the first 26 bytes (right?), but I assume it's some kind of terminating 0 byte?

from nvorbis.

bert2 avatar bert2 commented on May 28, 2024

I did a little reading into the OGG format (maybe I should have done this before creating the PR 🙈), and I found out that pageBuf[26] tells us that there are 1 segments in the segments table. The table entry for that segment at pageBuf[27] in turn tells us that this segment has a size of 0 in the page body.

So for full disclosure, I have no clue where that "page body" is located and thus I'm totally unsure if there is a cleaner way to handle such a segment.

from nvorbis.

ioctlLR avatar ioctlLR commented on May 28, 2024

Wow, that's a fun one... So the file is actually invalid. Ogg does support empty pages, but the final page of a Vorbis stream cannot be empty (it must have EOS set and have just the final packet in it). Adding up the pageBuf[26] bytes following offset 26 should give a positive value, and the final byte cannot be 255. Following that should be a count of bytes equal to the sum of the previous calculation (pageBuf[26 ... 28] = {2, 255, 21} would have a total page length of 27 + 2 + 276 = 305 bytes).

I'll have to play with this a bit to figure out how to cleanly support the file in question. Probably the simplest is to make the packet logic skip the page if zero length... Both readers will need to be updated, though.

from nvorbis.

ioctlLR avatar ioctlLR commented on May 28, 2024

Check out PR #8 for a possible fix. It seems to work fine for me.

from nvorbis.

bert2 avatar bert2 commented on May 28, 2024

I just tried the fixed master branch and it works fine. Thanks!

from nvorbis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.