ralfbiedert / openh264-rs

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

Error: OpenH264 encountered an error. Native:16384. Decoding State:0. User Message:None #50

Open andreytkachenko opened 2 months ago

andreytkachenko commented 2 months ago

Error when trying decode stream with B-frames. I suspect it is because method decode_frame_no_delay is used .

andreytkachenko commented 2 months ago

https://github.com/ralfbiedert/openh264-rs/compare/master...andreytkachenko:openh264-rs:master

ralfbiedert commented 2 months ago

Thanks for the PR suggestion. Unfortunately it's a bit hard to tell what's going on, and how the PR would improve things in general. Right now it breaks two existing unit tests, and changes decode behavior.

Could you please post a small example with an .h264 file and some code that goes wrong? Also, for PRs, it would be helpful to check that all existing unit tests pass, as well as that any new behavior added is covered by additional tests.

andreytkachenko commented 2 months ago

Bug is easy reproducible, most of videos on internet is encoded with B-frames. So you just can take basic example like https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_5MB.mp4 and see the error.

andreytkachenko commented 2 months ago

I guess that method decode_frame_no_delay is made for case when data comes directly from IP camera, so it does not contains B-frames for sure. But for library which may be used in general for decoding any file, required to support B-frames (since openh264 supports it). And optionally expose an _no_delay decode variant for cases when it needed.