Skip to content

First MPEG frame is thrown away #4

Open
@grimthorpe

Description

In MpegStreamReader constructor the first MpegFrame found in the file gets thrown away.

`
// find the first Mpeg frame
var frame = FindNextFrame();
while (frame != null && !(frame is MpegFrame))
{
frame = FindNextFrame();
}

        // if we still don't have a frame, we never sync'ed
        if (frame == null) throw new InvalidDataException("Not a valid MPEG file!");

        // the very next frame "should be" an mpeg frame
        frame = FindNextFrame();

`

If the next frame isn't an MpegFrame then the entire decode fails.
At the point before the comment 'the very next frame "should be" an mpeg frame', frame already refers to an MpegFrame so there is no need to read the following one.

This causes me a problem because I am decoding a stream that only contains a single MpegFrame at a time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions