light cleanup, still broken
still blacks on monitor restart with pipe 3 enabeldpushover
parent
0637e32d38
commit
712c2a0419
|
@ -7,7 +7,6 @@ var P = SAT.Polygon;
|
||||||
var P2P = require('pipe2pam')
|
var P2P = require('pipe2pam')
|
||||||
var PamDiff = require('pam-diff')
|
var PamDiff = require('pam-diff')
|
||||||
module.exports = function(jsonData,pamDiffResponder){
|
module.exports = function(jsonData,pamDiffResponder){
|
||||||
var s = {};
|
|
||||||
var noiseFilterArray = {};
|
var noiseFilterArray = {};
|
||||||
const groupKey = jsonData.rawMonitorConfig.ke
|
const groupKey = jsonData.rawMonitorConfig.ke
|
||||||
const monitorId = jsonData.rawMonitorConfig.mid
|
const monitorId = jsonData.rawMonitorConfig.mid
|
||||||
|
@ -22,6 +21,15 @@ module.exports = function(jsonData,pamDiffResponder){
|
||||||
fs.appendFileSync('/home/Shinobi/test.log',text + '\n','utf8')
|
fs.appendFileSync('/home/Shinobi/test.log',text + '\n','utf8')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(typeof pamDiffResponder === 'function'){
|
||||||
|
var sendDetectedData = function(detectorObject){
|
||||||
|
pamDiffResponder(detectorObject)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var sendDetectedData = function(detectorObject){
|
||||||
|
pamDiffResponder.write(Buffer.from(JSON.stringify(detectorObject)))
|
||||||
|
}
|
||||||
|
}
|
||||||
createPamDiffEngine = function(){
|
createPamDiffEngine = function(){
|
||||||
var width,
|
var width,
|
||||||
height,
|
height,
|
||||||
|
@ -112,7 +120,7 @@ module.exports = function(jsonData,pamDiffResponder){
|
||||||
if(!err1 && !err2)++filteredCountSuccess
|
if(!err1 && !err2)++filteredCountSuccess
|
||||||
if(filteredCount === trigger.merged.length && filteredCountSuccess > 0){
|
if(filteredCount === trigger.merged.length && filteredCountSuccess > 0){
|
||||||
detectorObject.doObjectDetection = (jsonData.globalInfo.isAtleatOneDetectorPluginConnected && jsonData.rawMonitorConfig.details.detector_use_detect_object === '1')
|
detectorObject.doObjectDetection = (jsonData.globalInfo.isAtleatOneDetectorPluginConnected && jsonData.rawMonitorConfig.details.detector_use_detect_object === '1')
|
||||||
pamDiffResponder.write(Buffer.from(JSON.stringify(detectorObject)))
|
sendDetectedData(detectorObject)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -124,7 +132,7 @@ module.exports = function(jsonData,pamDiffResponder){
|
||||||
checkTriggerThreshold(region, detectorObject, function(err2) {
|
checkTriggerThreshold(region, detectorObject, function(err2) {
|
||||||
if(!err1 && !err2){
|
if(!err1 && !err2){
|
||||||
detectorObject.doObjectDetection = (jsonData.globalInfo.isAtleatOneDetectorPluginConnected && jsonData.rawMonitorConfig.details.detector_use_detect_object === '1')
|
detectorObject.doObjectDetection = (jsonData.globalInfo.isAtleatOneDetectorPluginConnected && jsonData.rawMonitorConfig.details.detector_use_detect_object === '1')
|
||||||
pamDiffResponder.write(Buffer.from(JSON.stringify(detectorObject)))
|
sendDetectedData(detectorObject)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -177,7 +185,7 @@ module.exports = function(jsonData,pamDiffResponder){
|
||||||
checkTriggerThreshold(region, detectorObject, function(err2) {
|
checkTriggerThreshold(region, detectorObject, function(err2) {
|
||||||
if(!err1 && ! err2){
|
if(!err1 && ! err2){
|
||||||
detectorObject.doObjectDetection = (jsonData.globalInfo.isAtleatOneDetectorPluginConnected && jsonData.rawMonitorConfig.details.detector_use_detect_object === '1')
|
detectorObject.doObjectDetection = (jsonData.globalInfo.isAtleatOneDetectorPluginConnected && jsonData.rawMonitorConfig.details.detector_use_detect_object === '1')
|
||||||
pamDiffResponder.write(Buffer.from(JSON.stringify(detectorObject)))
|
sendDetectedData(detectorObject)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -348,7 +356,7 @@ module.exports = function(jsonData,pamDiffResponder){
|
||||||
}
|
}
|
||||||
return trigger
|
return trigger
|
||||||
}
|
}
|
||||||
s.isAtleastOneMatrixInRegion = function(regions,matrices,callback){
|
isAtleastOneMatrixInRegion = function(regions,matrices,callback){
|
||||||
var regionPolys = []
|
var regionPolys = []
|
||||||
var matrixPoints = []
|
var matrixPoints = []
|
||||||
regions.forEach(function(region,n){
|
regions.forEach(function(region,n){
|
||||||
|
@ -413,14 +421,8 @@ module.exports = function(jsonData,pamDiffResponder){
|
||||||
//frames from motion detect
|
//frames from motion detect
|
||||||
if(jsonData.rawMonitorConfig.details.detector_pam === '1'){
|
if(jsonData.rawMonitorConfig.details.detector_pam === '1'){
|
||||||
createPamDiffEngine()
|
createPamDiffEngine()
|
||||||
p2p.pipe(pamDiff)
|
|
||||||
cameraProcess.stdio[3].on('data',(data)=>{
|
cameraProcess.stdio[3].pipe(p2p).pipe(pamDiff)
|
||||||
try{
|
|
||||||
p2p.write(data)
|
|
||||||
}catch(err){
|
|
||||||
fallback(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@ const spawn = require('child_process').spawn
|
||||||
process.send = process.send || function () {};
|
process.send = process.send || function () {};
|
||||||
// [CTRL] + [C] = exit
|
// [CTRL] + [C] = exit
|
||||||
process.on('SIGINT', function() {
|
process.on('SIGINT', function() {
|
||||||
cameraProcess.kill('SIGTERM')
|
cameraProcess.kill(0)
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!process.argv[2] || !process.argv[3]){
|
if(!process.argv[2] || !process.argv[3]){
|
||||||
|
@ -43,15 +43,19 @@ for(var i=0; i < stdioPipes; i++){
|
||||||
newPipes[i] = 2
|
newPipes[i] = 2
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
stdioWriters[i] = fs.createWriteStream(null, {fd: i});
|
stdioWriters[i] = fs.createWriteStream(null, {fd: i, end:false});
|
||||||
if(rawMonitorConfig.details.detector === '1' && rawMonitorConfig.details.detector_pam === '1'){
|
if(rawMonitorConfig.details.detector === '1' && rawMonitorConfig.details.detector_pam === '1'){
|
||||||
newPipes[i] = 'pipe'
|
newPipes[i] = 'pipe'
|
||||||
}else{
|
}else{
|
||||||
newPipes[i] = stdioWriters[i]
|
newPipes[i] = stdioWriters[i]
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
stdioWriters[i] = fs.createWriteStream(null, {fd: i, end:false});
|
||||||
|
newPipes[i] = 'pipe'
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
stdioWriters[i] = fs.createWriteStream(null, {fd: i});
|
stdioWriters[i] = fs.createWriteStream(null, {fd: i, end:false});
|
||||||
newPipes[i] = stdioWriters[i]
|
newPipes[i] = stdioWriters[i]
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +65,7 @@ stdioWriters.forEach((writer)=>{
|
||||||
writeToStderr(err.stack);
|
writeToStderr(err.stack);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
writeToStderr(JSON.stringify(ffmpegCommandString))
|
||||||
var cameraProcess = spawn(ffmpegAbsolutePath,ffmpegCommandString,{detached: true,stdio:newPipes})
|
var cameraProcess = spawn(ffmpegAbsolutePath,ffmpegCommandString,{detached: true,stdio:newPipes})
|
||||||
cameraProcess.on('close',()=>{
|
cameraProcess.on('close',()=>{
|
||||||
writeToStderr('Process Closed')
|
writeToStderr('Process Closed')
|
||||||
|
@ -69,12 +74,14 @@ cameraProcess.on('close',()=>{
|
||||||
})
|
})
|
||||||
process.exit();
|
process.exit();
|
||||||
})
|
})
|
||||||
|
cameraProcess.stdio[5].on('data',(data)=>{
|
||||||
|
stdioWriters[5].write(data)
|
||||||
|
})
|
||||||
writeToStderr('Thread Opening')
|
writeToStderr('Thread Opening')
|
||||||
writeToStderr(JSON.stringify(rawMonitorConfig))
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(()=>{
|
|
||||||
if(rawMonitorConfig.details.detector === '1' && rawMonitorConfig.details.detector_pam === '1'){
|
if(rawMonitorConfig.details.detector === '1' && rawMonitorConfig.details.detector_pam === '1'){
|
||||||
try{
|
try{
|
||||||
const attachPamDetector = require(__dirname + '/detector.js')(jsonData,stdioWriters[3])
|
const attachPamDetector = require(__dirname + '/detector.js')(jsonData,stdioWriters[3])
|
||||||
attachPamDetector(cameraProcess,(err)=>{
|
attachPamDetector(cameraProcess,(err)=>{
|
||||||
|
@ -83,5 +90,4 @@ setTimeout(()=>{
|
||||||
}catch(err){
|
}catch(err){
|
||||||
writeToStderr(err.stack)
|
writeToStderr(err.stack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},3000)
|
|
||||||
|
|
|
@ -1018,6 +1018,11 @@ module.exports = function(s,config,lang,onFinish){
|
||||||
x.ffmpegCommandString = s.splitForFFPMEG(x.ffmpegCommandString)
|
x.ffmpegCommandString = s.splitForFFPMEG(x.ffmpegCommandString)
|
||||||
//launch that bad boy
|
//launch that bad boy
|
||||||
// return spawn(config.ffmpegDir,x.ffmpegCommandString,{detached: true,stdio:x.stdioPipes})
|
// return spawn(config.ffmpegDir,x.ffmpegCommandString,{detached: true,stdio:x.stdioPipes})
|
||||||
|
try{
|
||||||
|
fs.unlinkSync(e.sdir + 'cmd.txt')
|
||||||
|
}catch(err){
|
||||||
|
|
||||||
|
}
|
||||||
fs.writeFileSync(e.sdir + 'cmd.txt',JSON.stringify({
|
fs.writeFileSync(e.sdir + 'cmd.txt',JSON.stringify({
|
||||||
cmd: x.ffmpegCommandString,
|
cmd: x.ffmpegCommandString,
|
||||||
pipes: x.stdioPipes.length,
|
pipes: x.stdioPipes.length,
|
||||||
|
@ -1032,6 +1037,7 @@ module.exports = function(s,config,lang,onFinish){
|
||||||
config.ffmpegDir,
|
config.ffmpegDir,
|
||||||
e.sdir + 'cmd.txt'
|
e.sdir + 'cmd.txt'
|
||||||
]
|
]
|
||||||
|
console.log(`node ${cameraCommandParams.join(' ')}`)
|
||||||
return spawn('node',cameraCommandParams,{detached: true,stdio:x.stdioPipes})
|
return spawn('node',cameraCommandParams,{detached: true,stdio:x.stdioPipes})
|
||||||
}
|
}
|
||||||
if(!config.ffmpegDir){
|
if(!config.ffmpegDir){
|
||||||
|
|
118
libs/monitor.js
118
libs/monitor.js
|
@ -348,79 +348,71 @@ module.exports = function(s,config,lang){
|
||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraDestroy = function(x,e,p){
|
cameraDestroy = function(e,p){
|
||||||
if(s.group[e.ke]&&s.group[e.ke].activeMonitors[e.id]&&s.group[e.ke].activeMonitors[e.id].spawn !== undefined){
|
if(s.group[e.ke]&&s.group[e.ke].activeMonitors[e.id]&&s.group[e.ke].activeMonitors[e.id].spawn !== undefined){
|
||||||
if(s.group[e.ke].activeMonitors[e.id].spawn){
|
const activeMonitor = s.group[e.ke].activeMonitors[e.id];
|
||||||
s.group[e.ke].activeMonitors[e.id].allowStdinWrite = false
|
const proc = s.group[e.ke].activeMonitors[e.id].spawn;
|
||||||
|
if(proc){
|
||||||
|
activeMonitor.allowStdinWrite = false
|
||||||
s.txToDashcamUsers({
|
s.txToDashcamUsers({
|
||||||
f : 'disable_stream',
|
f : 'disable_stream',
|
||||||
ke : e.ke,
|
ke : e.ke,
|
||||||
mid : e.id
|
mid : e.id
|
||||||
},e.ke)
|
},e.ke)
|
||||||
// if(s.group[e.ke].activeMonitors[e.id].p2pStream){s.group[e.ke].activeMonitors[e.id].p2pStream.unpipe();}
|
// if(activeMonitor.p2pStream){activeMonitor.p2pStream.unpipe();}
|
||||||
if(s.group[e.ke].activeMonitors[e.id].p2p){s.group[e.ke].activeMonitors[e.id].p2p.unpipe();}
|
if(activeMonitor.p2p){activeMonitor.p2p.unpipe();}
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].p2pStream)
|
delete(activeMonitor.p2pStream)
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].p2p)
|
delete(activeMonitor.p2p)
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].pamDiff)
|
delete(activeMonitor.pamDiff)
|
||||||
try{
|
try{
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.removeListener('end',s.group[e.ke].activeMonitors[e.id].spawn_exit);
|
proc.removeListener('end',activeMonitor.spawn_exit);
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.removeListener('exit',s.group[e.ke].activeMonitors[e.id].spawn_exit);
|
proc.removeListener('exit',activeMonitor.spawn_exit);
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].spawn_exit);
|
delete(activeMonitor.spawn_exit);
|
||||||
}catch(er){}
|
}catch(er){
|
||||||
|
|
||||||
}
|
}
|
||||||
if(s.group[e.ke].activeMonitors[e.id].audioDetector){
|
|
||||||
s.group[e.ke].activeMonitors[e.id].audioDetector.stop()
|
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].audioDetector)
|
|
||||||
}
|
}
|
||||||
s.group[e.ke].activeMonitors[e.id].firstStreamChunk = {}
|
if(activeMonitor.audioDetector){
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].recordingChecker);
|
activeMonitor.audioDetector.stop()
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].recordingChecker);
|
delete(activeMonitor.audioDetector)
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].streamChecker);
|
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].streamChecker);
|
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].checkSnap);
|
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].checkSnap);
|
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].watchdog_stop);
|
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].watchdog_stop);
|
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].lastJpegDetectorFrame);
|
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].detectorFrameSaveBuffer);
|
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].recordingSnapper);
|
|
||||||
clearInterval(s.group[e.ke].activeMonitors[e.id].getMonitorCpuUsage);
|
|
||||||
if(s.group[e.ke].activeMonitors[e.id].onChildNodeExit){
|
|
||||||
s.group[e.ke].activeMonitors[e.id].onChildNodeExit()
|
|
||||||
}
|
}
|
||||||
if(s.group[e.ke].activeMonitors[e.id].mp4frag){
|
activeMonitor.firstStreamChunk = {}
|
||||||
var mp4FragChannels = Object.keys(s.group[e.ke].activeMonitors[e.id].mp4frag)
|
clearTimeout(activeMonitor.recordingChecker);
|
||||||
|
delete(activeMonitor.recordingChecker);
|
||||||
|
clearTimeout(activeMonitor.streamChecker);
|
||||||
|
delete(activeMonitor.streamChecker);
|
||||||
|
clearTimeout(activeMonitor.checkSnap);
|
||||||
|
delete(activeMonitor.checkSnap);
|
||||||
|
clearTimeout(activeMonitor.watchdog_stop);
|
||||||
|
delete(activeMonitor.watchdog_stop);
|
||||||
|
delete(activeMonitor.lastJpegDetectorFrame);
|
||||||
|
delete(activeMonitor.detectorFrameSaveBuffer);
|
||||||
|
clearTimeout(activeMonitor.recordingSnapper);
|
||||||
|
clearInterval(activeMonitor.getMonitorCpuUsage);
|
||||||
|
if(activeMonitor.onChildNodeExit){
|
||||||
|
activeMonitor.onChildNodeExit()
|
||||||
|
}
|
||||||
|
if(activeMonitor.mp4frag){
|
||||||
|
var mp4FragChannels = Object.keys(activeMonitor.mp4frag)
|
||||||
mp4FragChannels.forEach(function(channel){
|
mp4FragChannels.forEach(function(channel){
|
||||||
s.group[e.ke].activeMonitors[e.id].mp4frag[channel].removeAllListeners()
|
activeMonitor.mp4frag[channel].removeAllListeners()
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].mp4frag[channel])
|
delete(activeMonitor.mp4frag[channel])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(config.childNodes.enabled === true && config.childNodes.mode === 'child' && config.childNodes.host){
|
if(config.childNodes.enabled === true && config.childNodes.mode === 'child' && config.childNodes.host){
|
||||||
s.cx({f:'clearCameraFromActiveList',ke:e.ke,id:e.id})
|
s.cx({f:'clearCameraFromActiveList',ke:e.ke,id:e.id})
|
||||||
}
|
}
|
||||||
if(s.group[e.ke].activeMonitors[e.id].childNode){
|
if(activeMonitor.childNode){
|
||||||
s.cx({f:'kill',d:s.cleanMonitorObject(e)},s.group[e.ke].activeMonitors[e.id].childNodeId)
|
s.cx({f:'kill',d:s.cleanMonitorObject(e)},activeMonitor.childNodeId)
|
||||||
}else{
|
}else{
|
||||||
s.coSpawnClose(e)
|
s.coSpawnClose(e)
|
||||||
if(!x||x===1){return};
|
if(proc && proc.kill){
|
||||||
p = x.pid;
|
proc.kill('SIGINT')
|
||||||
if(s.group[e.ke].rawMonitorConfigurations[e.id].type===('dashcam'||'socket'||'jpeg'||'pipe')){
|
|
||||||
x.stdin.pause()
|
|
||||||
setTimeout(function(){
|
|
||||||
x.kill('SIGTERM')
|
|
||||||
},500)
|
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
x.stdin.setEncoding('utf8')
|
|
||||||
x.stdin.write('q')
|
|
||||||
}catch(er){}
|
|
||||||
}
|
|
||||||
setTimeout(function(){
|
|
||||||
exec('kill -9 '+p,{detached: true})
|
|
||||||
},1000)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s.cameraCheckObjectsInDetails = function(e){
|
s.cameraCheckObjectsInDetails = function(e){
|
||||||
//parse Objects
|
//parse Objects
|
||||||
(['detector_cascades','cords','detector_filters','input_map_choices']).forEach(function(v){
|
(['detector_cascades','cords','detector_filters','input_map_choices']).forEach(function(v){
|
||||||
|
@ -1024,7 +1016,7 @@ module.exports = function(s,config,lang){
|
||||||
})
|
})
|
||||||
s.group[e.ke].activeMonitors[e.id].audioDetector = audioDetector
|
s.group[e.ke].activeMonitors[e.id].audioDetector = audioDetector
|
||||||
audioDetector.start()
|
audioDetector.start()
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.stdio[6].pipe(audioDetector.streamDecoder)
|
s.group[e.ke].activeMonitors[e.id].spawn.stdio[6].pipe(audioDetector.streamDecoder,{ end: false })
|
||||||
}
|
}
|
||||||
if(e.details.record_timelapse === '1'){
|
if(e.details.record_timelapse === '1'){
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.stdio[7].on('data',function(data){
|
s.group[e.ke].activeMonitors[e.id].spawn.stdio[7].on('data',function(data){
|
||||||
|
@ -1056,8 +1048,12 @@ module.exports = function(s,config,lang){
|
||||||
if(e.details.detector_pam === '1'){
|
if(e.details.detector_pam === '1'){
|
||||||
// s.group[e.ke].activeMonitors[e.id].spawn.stdio[3].pipe(s.group[e.ke].activeMonitors[e.id].p2p).pipe(s.group[e.ke].activeMonitors[e.id].pamDiff)
|
// s.group[e.ke].activeMonitors[e.id].spawn.stdio[3].pipe(s.group[e.ke].activeMonitors[e.id].p2p).pipe(s.group[e.ke].activeMonitors[e.id].pamDiff)
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.stdio[3].on('data',function(buf){
|
s.group[e.ke].activeMonitors[e.id].spawn.stdio[3].on('data',function(buf){
|
||||||
|
try{
|
||||||
var data = JSON.parse(buf)
|
var data = JSON.parse(buf)
|
||||||
s.triggerEvent(data)
|
s.triggerEvent(data)
|
||||||
|
} catch(err){
|
||||||
|
console.log(buf.toString())
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if(e.details.detector_use_detect_object === '1'){
|
if(e.details.detector_use_detect_object === '1'){
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.stdio[4].on('data',function(data){
|
s.group[e.ke].activeMonitors[e.id].spawn.stdio[4].on('data',function(data){
|
||||||
|
@ -1079,7 +1075,7 @@ module.exports = function(s,config,lang){
|
||||||
s.group[e.ke].activeMonitors[e.id].mp4frag['MAIN'].on('error',function(error){
|
s.group[e.ke].activeMonitors[e.id].mp4frag['MAIN'].on('error',function(error){
|
||||||
s.userLog(e,{type:lang['Mp4Frag'],msg:{error:error}})
|
s.userLog(e,{type:lang['Mp4Frag'],msg:{error:error}})
|
||||||
})
|
})
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.stdio[1].pipe(s.group[e.ke].activeMonitors[e.id].mp4frag['MAIN'])
|
s.group[e.ke].activeMonitors[e.id].spawn.stdio[1].pipe(s.group[e.ke].activeMonitors[e.id].mp4frag['MAIN'],{ end: false })
|
||||||
break;
|
break;
|
||||||
case'flv':
|
case'flv':
|
||||||
frameToStreamPrimary = function(d){
|
frameToStreamPrimary = function(d){
|
||||||
|
@ -1137,7 +1133,7 @@ module.exports = function(s,config,lang){
|
||||||
case'mp4':
|
case'mp4':
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber])
|
delete(s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber])
|
||||||
if(!s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber])s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber] = new Mp4Frag();
|
if(!s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber])s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber] = new Mp4Frag();
|
||||||
s.group[e.ke].activeMonitors[e.id].spawn.stdio[pipeNumber].pipe(s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber])
|
s.group[e.ke].activeMonitors[e.id].spawn.stdio[pipeNumber].pipe(s.group[e.ke].activeMonitors[e.id].mp4frag[pipeNumber],{ end: false })
|
||||||
break;
|
break;
|
||||||
case'mjpeg':
|
case'mjpeg':
|
||||||
frameToStreamAdded = function(d){
|
frameToStreamAdded = function(d){
|
||||||
|
@ -1367,7 +1363,7 @@ module.exports = function(s,config,lang){
|
||||||
if(s.group[e.ke].activeMonitors[e.id].isStarted === true){
|
if(s.group[e.ke].activeMonitors[e.id].isStarted === true){
|
||||||
e.errorCount = 0;
|
e.errorCount = 0;
|
||||||
s.group[e.ke].activeMonitors[e.id].errorSocketTimeoutCount = 0;
|
s.group[e.ke].activeMonitors[e.id].errorSocketTimeoutCount = 0;
|
||||||
cameraDestroy(s.group[e.ke].activeMonitors[e.id].spawn,e)
|
cameraDestroy(e)
|
||||||
startVideoProcessor = function(err,o){
|
startVideoProcessor = function(err,o){
|
||||||
if(o.success === true){
|
if(o.success === true){
|
||||||
s.group[e.ke].activeMonitors[e.id].isRecording = true
|
s.group[e.ke].activeMonitors[e.id].isRecording = true
|
||||||
|
@ -1419,7 +1415,7 @@ module.exports = function(s,config,lang){
|
||||||
startVideoProcessor(null,{success:true})
|
startVideoProcessor(null,{success:true})
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
cameraDestroy(s.group[e.ke].activeMonitors[e.id].spawn,e)
|
cameraDestroy(e)
|
||||||
}
|
}
|
||||||
if(callback)callback()
|
if(callback)callback()
|
||||||
})
|
})
|
||||||
|
@ -1510,7 +1506,7 @@ module.exports = function(s,config,lang){
|
||||||
};
|
};
|
||||||
},5000);
|
},5000);
|
||||||
}else{
|
}else{
|
||||||
cameraDestroy(s.group[e.ke].activeMonitors[e.id].spawn,e)
|
cameraDestroy(e)
|
||||||
}
|
}
|
||||||
s.sendMonitorStatus({id:e.id,ke:e.ke,status:lang.Died})
|
s.sendMonitorStatus({id:e.id,ke:e.ke,status:lang.Died})
|
||||||
s.onMonitorDiedExtensions.forEach(function(extender){
|
s.onMonitorDiedExtensions.forEach(function(extender){
|
||||||
|
@ -1691,13 +1687,9 @@ module.exports = function(s,config,lang){
|
||||||
if(s.group[e.ke].activeMonitors[e.id].fswatchStream){s.group[e.ke].activeMonitors[e.id].fswatchStream.close();delete(s.group[e.ke].activeMonitors[e.id].fswatchStream)}
|
if(s.group[e.ke].activeMonitors[e.id].fswatchStream){s.group[e.ke].activeMonitors[e.id].fswatchStream.close();delete(s.group[e.ke].activeMonitors[e.id].fswatchStream)}
|
||||||
if(s.group[e.ke].activeMonitors[e.id].last_frame){delete(s.group[e.ke].activeMonitors[e.id].last_frame)}
|
if(s.group[e.ke].activeMonitors[e.id].last_frame){delete(s.group[e.ke].activeMonitors[e.id].last_frame)}
|
||||||
if(s.group[e.ke].activeMonitors[e.id].isStarted !== true){return}
|
if(s.group[e.ke].activeMonitors[e.id].isStarted !== true){return}
|
||||||
cameraDestroy(s.group[e.ke].activeMonitors[e.id].spawn,e)
|
cameraDestroy(e)
|
||||||
if(e.neglectTriggerTimer === 1){
|
|
||||||
delete(e.neglectTriggerTimer);
|
|
||||||
}else{
|
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].trigger_timer)
|
clearTimeout(s.group[e.ke].activeMonitors[e.id].trigger_timer)
|
||||||
delete(s.group[e.ke].activeMonitors[e.id].trigger_timer)
|
delete(s.group[e.ke].activeMonitors[e.id].trigger_timer)
|
||||||
}
|
|
||||||
clearInterval(s.group[e.ke].activeMonitors[e.id].detector_notrigger_timeout)
|
clearInterval(s.group[e.ke].activeMonitors[e.id].detector_notrigger_timeout)
|
||||||
clearTimeout(s.group[e.ke].activeMonitors[e.id].err_fatal_timeout);
|
clearTimeout(s.group[e.ke].activeMonitors[e.id].err_fatal_timeout);
|
||||||
s.group[e.ke].activeMonitors[e.id].isStarted = false
|
s.group[e.ke].activeMonitors[e.id].isStarted = false
|
||||||
|
|
Loading…
Reference in New Issue