mirror of
https://github.com/Motion-Project/motion.git
synced 2026-02-05 04:21:32 -05:00
Webstream Rate Update
This commit is contained in:
@@ -44,20 +44,18 @@ static void webu_stream_mjpeg_delay(struct webui_ctx *webui) {
|
||||
/* The stream rate MUST be less than 1000000000 otherwise undefined behaviour
|
||||
* will occur with the SLEEP function.
|
||||
*/
|
||||
stream_delay = ((time_curr.tv_usec - webui->time_last.tv_usec)*1000) -
|
||||
((time_curr.tv_sec - webui->time_last.tv_sec)*1000000);
|
||||
stream_delay = ((time_curr.tv_usec - webui->time_last.tv_usec)*1000) +
|
||||
((time_curr.tv_sec - webui->time_last.tv_sec)*1000000000);
|
||||
if (stream_delay < 0) stream_delay = 0;
|
||||
if (stream_delay > 1000000000 ) stream_delay = 1000000000;
|
||||
|
||||
if (webui->cnt->conf.stream_maxrate > 1){
|
||||
if (webui->cnt->conf.stream_maxrate >= 1){
|
||||
stream_rate = ( (1000000000 / webui->cnt->conf.stream_maxrate) - stream_delay);
|
||||
if ((stream_rate > 0) && (stream_rate < 1000000000)){
|
||||
SLEEP(0,stream_rate);
|
||||
} else if (stream_rate == 1000000000) {
|
||||
SLEEP(1,0);
|
||||
}
|
||||
} else {
|
||||
SLEEP(1,0);
|
||||
}
|
||||
gettimeofday(&webui->time_last, NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user