flask-video-streaming icon indicating copy to clipboard operation
flask-video-streaming copied to clipboard

resetting yield generator during long run

Open saumya221 opened this issue 4 years ago • 5 comments

Hi, After a long duration of streaming (15-20 minutes) , I observe that latency keeps on increasing. While latency is very good in the beginning period, I suspect due to the python generator "yield" in the while loop of the "run" function , in case there is a delay due to either network speed or something else, it adds on to the latency cumulatively. So is there any way to periodically reset the python generator to ensure stream latency does go grow out of bounds?

saumya221 avatar Jun 26 '21 17:06 saumya221

The only way that comes to mind is to use JavaScript to set the src attribute of the image again. This should cause the stream to end and a new stream to start immediately after.

miguelgrinberg avatar Jun 26 '21 19:06 miguelgrinberg

Are you referring to "src" in index.html?

saumya221 avatar Jun 27 '21 02:06 saumya221

The src in the img element that is the source of the stream.

miguelgrinberg avatar Jun 27 '21 07:06 miguelgrinberg

Hi, I am also facing the same issue .The latency keeps on increasing after some time. I have tried updating the img src tag (using JS)periodically but still the video gets stuck.

Codeforglory avatar Jan 17 '22 08:01 Codeforglory

@Codeforglory that is not a problem you can address from this side. You have to make your frame generator work faster, at a slower frame rate or with smaller image size so that it can keep up.

miguelgrinberg avatar Jan 17 '22 11:01 miguelgrinberg