ralfbiedert / openh264-rs

Idiomatic Rust wrappers around OpenH264.
66 stars 32 forks source link

Fixed decoder needing flush in some cases #21

Closed msabansal closed 1 year ago

msabansal commented 1 year ago

In a local test environment i have an h264 stream that returns 0 on the first call to decode_frame_no_delay and iBufferStatus != 0.

In this case we should check the numbers of frames remaining in buffer (0 or 1) and flush the buffer if it is 1.

ralfbiedert commented 1 year ago

Thanks!

ralfbiedert commented 1 year ago

Ah, I forgot to mention. In your own interest, could you also submit a follow-up PR containing a test case and a minimal .h264 file triggering the issue?

It's not strictly necessary, but otherwise there is a risk for that logic to accidentally get refactored out at some point.

msabansal commented 1 year ago

@ralfbiedert thanks for merging. I was unsure of a test on this. The file decodes without any error without this code. Only that output has artifacts and that too on subsequent call to decode.

Unclear if I should add something that compares output to an image

msabansal commented 1 year ago

For now added a simple test to validate fame is decoded properly https://github.com/ralfbiedert/openh264-rust/pull/22