-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Framerate limit #195
Framerate limit #195
Conversation
Add global variable and #define in config to set default. Add new parameter in /control handler and preferences.
Thankyou, especially for doing the ov3660 too!
|
…m-webserver into framerate_limit
I changed UI values to correspond with values used in commands, please see if it makes more sense now. I'm not sure how to understand "loop until it does". Do you want something like this instead of while((esp_timer_get_time() - last_frame)/1000 < minFrameTime) {
delay(1);
} It seems redundant, but I can add it if you consider this right approach. Is 1ms good enough? |
Cool, I'll have a look at this asap. I think we're in lockdown again from tomorrow (:netherlands:) so I should have some spare time at my desk.. sigh. I want to upload and test this for myself, then I'll be better able to understand how the UI works ;-) And yes, I was thinking of an idle loop until the timeout is reached, but I've been thinking overnight and I'm wondering how best to do this without locking the whole cam process up while we wait for the next frame to be served.. especially for values like '1 frame per second'..) I'm seriously thinking:
|
Putting delay after finishing serving the frame causes image to appear in stream with a lag. The reason for this appears to be that browser relies on next frame content boundary in order to determine the end of image. That means that in order for browser to show frame right after receiving it, server needs to send next frame content boundary right after image itself, and delay to limit framerate should be applied after content boundary, not before it. According to https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html sending first frame without content boundary will likely cause its content to be ignored, which seems to be acceptable price for not treating first iteration of the loop as special case.
entering the loop.
With this change it should look better with low fps. Compare streaming something like seconds (on clock) on 0.3fps with and without these commits. |
Note; Not forgotten about this but I'm doing some hotfixes first since expressif have broken stuff with the 2.0.1 core, etc. it means I'll be pushing to master branch again before I can come back to this, sorry ;-) |
Sure thing. |
Thankyou for this, sorry it took me ages to get round to merging it. |
Just a quick note; I've got this fully merged into the 4.0RC now, and had a quick test/play with it.. |
Allow to limit stream framerate in order to make it stable and lower load on the board for usecases where high fps is not required.
In order to keep code simple limit is set not in frames per second but in milliseconds between frames to make it integer.
Web-interface uses drop-down list with set of pre-defined fps values.