oneam / h264bsd

A simple h264 software decoding library
Other
194 stars 52 forks source link

How to skip frames #17

Closed jozefchutka closed 2 years ago

jozefchutka commented 4 years ago

Hi devs, I am using js version of the lib. In my case the player HW is low spec and it is not expected to be able to render all frames recieved. The data (live stream) are recieved via websocket as a stream.

It seems the decoder is trying to render all the received frames (decreased fps?), so over time the playback is getting more and more behind the streamed data a couple seconds (delayed)

Is there any way to instruct decoder to skip queued data until next keyframe is received, or can you think of any better strategy for my case?

thanks

oneam commented 2 years ago

(Better late than never :))

Assuming you're using wasm or js, you can add 'flush': true to the queueInput message to have it jump to the start of the new data.