Open alexey2baranov opened 8 years ago
We test this two cases with 3 webcams.
The first case below results 6 events "createdPeer" and 6 remote videos and 100+% CPU usage.
$(function () {
var CAM_INDEX=1;
navigator.mediaDevices.enumerateDevices()
.then((devices)=> {
// var isAudioNeeded= true;
devices.forEach(eachDevice=> {
if (eachDevice.kind == "videoinput") {
let nick= "cam"+ CAM_INDEX++;
console.log(nick);
console.log(eachDevice);
let webrtc = new SimpleWebRTC({
socketio: {'force new connection': true},
media: {
audio:false,
video: {
optional: [{
sourceId: eachDevice.deviceId
}]
}
},
localVideoEl: 'localVideos',
remoteVideosEl: 'remoteVideos',
autoRequestMedia: true,
nick: nick
});
webrtc.on('readyToCall', function () {
webrtc.joinRoom("many-cams-test-room");
});
webrtc.on('createdPeer', function (peer) {
console.log(nick+' createdPeer', peer);
});
}
});
});
});
The second case below results 3 events "createdPeer" and 3 remote videos only. 3 remote videos vs 6 remote videos get us -40% CPU usage. And this is not bad. Haw can we prevent this last 3 remote videos?
$(function () {
var CAM_INDEX=1;
navigator.mediaDevices.enumerateDevices()
.then((devices)=> {
// var isAudioNeeded= true;
devices.forEach(eachDevice=> {
if (eachDevice.kind == "videoinput") {
let nick= "cam"+ CAM_INDEX++;
console.log(nick);
console.log(eachDevice);
let webrtc = new SimpleWebRTC({
socketio: {'force new connection': true},
media: {
audio:false,
video: {
optional: [{
sourceId: eachDevice.deviceId
}]
}
},
localVideoEl: 'localVideos',
remoteVideosEl: 'remoteVideos',
autoRequestMedia: true,
receiveMedia: {
offerToReceiveAudio: 0,
offerToReceiveVideo: 0
},
nick: nick
});
webrtc.on('readyToCall', function () {
webrtc.joinRoom("many-cams-test-room");
});
webrtc.on('createdPeer', function (peer) {
console.log(nick+' createdPeer', peer);
});
}
});
});
});
Hello dear friend! We have try to tune receiveMedia and done some tests as written in prev post but have not resolve our question. As I written we have won +40% CPU usage but could not prevent 3 of 6 streams.
Can you guide us next step? We are very appreciate your help.
Hello dear friends!
We have a project with 4 webcams and 4 SimpleWebRTC objects into one page which joined to one room. We would like each SimpleWebRTC object do two jobs only:
So we need to configure this 4 SimpleWebRTC objects they do not decode each other because this is very CPU expensive