Fix Reolink RTMP restart bug, fix undefined codec array

auto-build-api-doc-with-code
Moe 2021-03-31 11:01:05 -07:00
parent ad27f9ee2f
commit 40d172e52c
2 changed files with 19 additions and 11 deletions

View File

@ -81,6 +81,7 @@ module.exports = (s,config,lang) => {
streams.forEach((stream) => { streams.forEach((stream) => {
try{ try{
const codecType = stream.codec_type || 'video' const codecType = stream.codec_type || 'video'
if(!streamIndex[codecType])streamIndex[codecType] = []
const simpleInfo = { const simpleInfo = {
fps: eval(stream.r_frame_rate) || '', fps: eval(stream.r_frame_rate) || '',
width: stream.coded_width, width: stream.coded_width,

View File

@ -71,19 +71,26 @@ module.exports = (s,config,lang) => {
if(activeMonitor.childNode){ if(activeMonitor.childNode){
s.cx({f:'kill',d:s.cleanMonitorObject(e)},activeMonitor.childNodeId) s.cx({f:'kill',d:s.cleanMonitorObject(e)},activeMonitor.childNodeId)
}else{ }else{
if(proc && proc.kill){ try{
if(s.isWin){ proc.stdin.write("q\r\n")
spawn("taskkill", ["/pid", proc.pid, '/t']) setTimeout(() => {
}else{ if(proc && proc.kill){
proc.kill('SIGTERM') if(s.isWin){
} spawn("taskkill", ["/pid", proc.pid, '/t'])
setTimeout(function(){ }else{
try{ proc.kill('SIGTERM')
proc.kill() }
}catch(err){ setTimeout(function(){
s.debugLog(err) try{
proc.kill()
}catch(err){
s.debugLog(err)
}
},1000)
} }
},1000) },1000)
}catch(err){
s.debugLog(err)
} }
} }
} }