Skip to content
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

CPU load problem #171

Open
welanderr opened this issue Feb 9, 2021 · 1 comment
Open

CPU load problem #171

welanderr opened this issue Feb 9, 2021 · 1 comment

Comments

@welanderr
Copy link

welanderr commented Feb 9, 2021

Hi,

I am having a problem that I hope some one can help me with.

Opening a stream in the browser gives me a sustained cpu load of ~9 % tested in time frame of 10min, no problem there.

This is the problem I am having. Using one video canves and using a funcion that loops tro stream sourses (about 30+ streams) every 20sec and replaces the src in the canves, gives me incrementing cpu load on every stream change. Tested in time frame of 10min gives me a cpu load of ~39 %

This is the code I am using. I modifide the file download from her #137

This is the funcoin

(function recurse(counter) {
    var arrLength = camaraLink.length;
    var index = counter%arrLength;

    var camaraLinkSrc = camaraLink[index];

    setPlayerSource(camaraLinkSrc, 'test_video');

    setTimeout(function() {
    recurse(counter + 1);
    }, 20000);

})(0);
@welanderr
Copy link
Author

I solved the problem with a "hack" using iframe and the video canvas in separate file it's not pretty but it works.

Solution

(function recurse(counter) {
    var arrLength = camaraLink.length;
    var index = counter%arrLength;

    var camaraLinkSrc = camaraLink[index];

    document.getElementById('video').src = 'http://192.168.10.50/camaras/iframe.php?link=' + camaraLinkSrc;

    setTimeout(function() {
    recurse(counter + 1);
    }, 30000);

})(0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant