Skip to content

VideoDecoder H.264 decode is sometimes one frame short #116

@jamespearce2006

Description

@jamespearce2006

I'm decoding individual H.264 GOPs and I'm finding that sometimes the decoder will not emit the last frame, and I'm not sure what I'm doing wrong. It's not a problem with the source data as the same GOP will work and then fail. I'm assuming it's something wrong with the way I'm using flush.

The GOPs are 25 frames long, and are closed.

I'm calling decode() for each sample in the GOP (so 25 times), then calling flush(). On each callback, I generate an imagebitmap from the videoframe, then call destroy on the videoframe.

Most of the time it all works OK, and my output callback is called 25 times. Occasionally, My callback is only called 24 times and the final frame is not emitted.

Can anyone think what I might be doing wrong? Or could this be a genuine issue?

I have found that I can apparently fix the issue by calling flush() every time my frame callback is called, which seems to add weight to my thought that this is a flush problem. The solution seems a bit expensive though.

Metadata

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