matijagaspar / ws-avc-player

Video player for browser that is able to play realtime low latency h264 video stream from websocket.
BSD 3-Clause "New" or "Revised" License
156 stars 48 forks source link

Example on how to use DecoderAsWorker #2

Closed Esser50K closed 5 years ago

Esser50K commented 6 years ago

I used this project to stream h264 from multiple raspberries through a webserver onto a webpage.

It streams pretty well on 1280x720, but lags quite a bit with 1920x1080..

However that is not my main problem. If I load the streams on different pages they all run well, however when using more than one canvas on the same page I notice a significant performance drop in the decoder. I'm sure this is because the same Decoder is doing all the work instead of using WebWorkers.

Can you provide an example on how to use workers to display more than one stream per page efficiently?

matijagaspar commented 6 years ago

The issue about performance is of course the limitation of using software javascript h264 decoder and the limit of the base profile. This solution was best I could come up with for lowest possible latency, given the limitation of the rpi hardware encoder. So I don't think WebWorker will give any noticable boost on the 1080p

As for running multiple canvases, yes I believe it should help. I will try to set it up, when I have a bit of time. Maybe you might have noticed but the DecoderAsWorker has a "TODO" on top of the file... so is still unfinished work, I didn't have any need for it yet. :)

matijagaspar commented 5 years ago

duplicate of #3