修复添加级联平台是三个布尔字段无效的bug
parent
87acd73efc
commit
5ba39861d7
|
@ -81,7 +81,7 @@ public class ParentPlatform {
|
||||||
/**
|
/**
|
||||||
* 允许云台控制
|
* 允许云台控制
|
||||||
*/
|
*/
|
||||||
private boolean PTZEnable;
|
private boolean ptz;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RTCP流保活
|
* RTCP流保活
|
||||||
|
@ -220,12 +220,12 @@ public class ParentPlatform {
|
||||||
this.characterSet = characterSet;
|
this.characterSet = characterSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPTZEnable() {
|
public boolean isPtz() {
|
||||||
return PTZEnable;
|
return ptz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPTZEnable(boolean PTZEnable) {
|
public void setPtz(boolean ptz) {
|
||||||
this.PTZEnable = PTZEnable;
|
this.ptz = ptz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRtcp() {
|
public boolean isRtcp() {
|
||||||
|
@ -251,4 +251,5 @@ public class ParentPlatform {
|
||||||
public void setChannelCount(int channelCount) {
|
public void setChannelCount(int channelCount) {
|
||||||
this.channelCount = channelCount;
|
this.channelCount = channelCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,10 @@ public class ZLMHttpHookListener {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString());
|
logger.debug("ZLM HOOK on_play API调用,参数:" + json.toString());
|
||||||
}
|
}
|
||||||
|
ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_play, json);
|
||||||
|
if (subscribe != null ) {
|
||||||
|
subscribe.response(json);
|
||||||
|
}
|
||||||
JSONObject ret = new JSONObject();
|
JSONObject ret = new JSONObject();
|
||||||
ret.put("code", 0);
|
ret.put("code", 0);
|
||||||
ret.put("msg", "success");
|
ret.put("msg", "success");
|
||||||
|
|
|
@ -70,6 +70,27 @@ public class ZLMHttpHookSubscribe {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSubscribe(HookType type, JSONObject hookResponse) {
|
||||||
|
Map<JSONObject, Event> eventMap = allSubscribes.get(type);
|
||||||
|
if (eventMap == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (JSONObject key : eventMap.keySet()) {
|
||||||
|
Boolean result = null;
|
||||||
|
for (String s : key.keySet()) {
|
||||||
|
if (result == null) {
|
||||||
|
result = key.getString(s).equals(hookResponse.getString(s));
|
||||||
|
}else {
|
||||||
|
result = result && key.getString(s).equals(hookResponse.getString(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
eventMap.remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个类型的所有的订阅
|
* 获取某个类型的所有的订阅
|
||||||
* @param type
|
* @param type
|
||||||
|
|
|
@ -42,6 +42,9 @@ public class ZLMMediaListManager {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IStreamPushService streamPushService;
|
private IStreamPushService streamPushService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ZLMHttpHookSubscribe subscribe;
|
||||||
|
|
||||||
|
|
||||||
public void updateMediaList() {
|
public void updateMediaList() {
|
||||||
storager.clearMediaList();
|
storager.clearMediaList();
|
||||||
|
@ -66,12 +69,27 @@ public class ZLMMediaListManager {
|
||||||
|
|
||||||
if (streamPushItems != null) {
|
if (streamPushItems != null) {
|
||||||
storager.updateMediaList(streamPushItems);
|
storager.updateMediaList(streamPushItems);
|
||||||
|
for (StreamPushItem streamPushItem : streamPushItems) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("app", streamPushItem.getApp());
|
||||||
|
jsonObject.put("stream", streamPushItem.getStream());
|
||||||
|
subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{
|
||||||
|
System.out.println(1222211111);
|
||||||
|
updateMedia(response.getString("app"), response.getString("stream"));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMedia(String app, String streamId) {
|
public void addMedia(String app, String streamId) {
|
||||||
|
//使用异步更新推流
|
||||||
|
updateMedia(app, streamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updateMedia(String app, String streamId) {
|
||||||
//使用异步更新推流
|
//使用异步更新推流
|
||||||
zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
|
zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class ZLMRunner implements CommandLineRunner {
|
||||||
param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s");
|
param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s");
|
||||||
param.put("hook.enable","1");
|
param.put("hook.enable","1");
|
||||||
param.put("hook.on_flow_report","");
|
param.put("hook.on_flow_report","");
|
||||||
param.put("hook.on_play","");
|
param.put("hook.on_play",String.format("%s/on_play", hookPrex));
|
||||||
param.put("hook.on_http_access","");
|
param.put("hook.on_http_access","");
|
||||||
param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
|
param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
|
||||||
param.put("hook.on_record_mp4","");
|
param.put("hook.on_record_mp4","");
|
||||||
|
|
|
@ -14,10 +14,10 @@ import java.util.List;
|
||||||
public interface ParentPlatformMapper {
|
public interface ParentPlatformMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
|
@Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
|
||||||
" devicePort, username, password, expires, keepTimeout, transport, characterSet, PTZEnable, rtcp, " +
|
" devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
|
||||||
" status) " +
|
" status) " +
|
||||||
" VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
|
" VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
|
||||||
" '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${PTZEnable}, ${rtcp}, " +
|
" '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
|
||||||
" ${status})")
|
" ${status})")
|
||||||
int addParentPlatform(ParentPlatform parentPlatform);
|
int addParentPlatform(ParentPlatform parentPlatform);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public interface ParentPlatformMapper {
|
||||||
"keepTimeout=#{keepTimeout}, " +
|
"keepTimeout=#{keepTimeout}, " +
|
||||||
"transport=#{transport}, " +
|
"transport=#{transport}, " +
|
||||||
"characterSet=#{characterSet}, " +
|
"characterSet=#{characterSet}, " +
|
||||||
"PTZEnable=#{PTZEnable}, " +
|
"ptz=#{ptz}, " +
|
||||||
"rtcp=#{rtcp}, " +
|
"rtcp=#{rtcp}, " +
|
||||||
"status=#{status} " +
|
"status=#{status} " +
|
||||||
"WHERE serverGBId=#{serverGBId}")
|
"WHERE serverGBId=#{serverGBId}")
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.genersoft.iot.vmp.vmanager.server;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.VManageBootstrap;
|
||||||
|
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
|
||||||
|
import gov.nist.javax.sip.SipStackImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.sip.ListeningPoint;
|
||||||
|
import javax.sip.ObjectInUseException;
|
||||||
|
import javax.sip.SipProvider;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@CrossOrigin
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/server")
|
||||||
|
public class ServerController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfigurableApplicationContext context;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/restart")
|
||||||
|
@ResponseBody
|
||||||
|
public Object restart(){
|
||||||
|
Thread restartThread = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider");
|
||||||
|
SipStackImpl stack = (SipStackImpl)up.getSipStack();
|
||||||
|
stack.stop();
|
||||||
|
Iterator listener = stack.getListeningPoints();
|
||||||
|
while (listener.hasNext()) {
|
||||||
|
stack.deleteListeningPoint((ListeningPoint) listener.next());
|
||||||
|
}
|
||||||
|
Iterator providers = stack.getSipProviders();
|
||||||
|
while (providers.hasNext()) {
|
||||||
|
stack.deleteSipProvider((SipProvider) providers.next());
|
||||||
|
}
|
||||||
|
VManageBootstrap.restart();
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
} catch (ObjectInUseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
restartThread.setDaemon(false);
|
||||||
|
restartThread.start();
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -15,8 +15,6 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="stream" label="流ID" width="240" align="center">
|
<el-table-column prop="stream" label="流ID" width="240" align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="totalReaderCount" label="在线人数" width="240" align="center">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="gbId" label="国标编码" width="150" align="center">
|
<el-table-column prop="gbId" label="国标编码" width="150" align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="开始时间" align="center" >
|
<el-table-column label="开始时间" align="center" >
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="其他选项">
|
<el-form-item label="其他选项">
|
||||||
<el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox>
|
<el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox>
|
||||||
<el-checkbox label="云台控制" v-model="platform.PTZEnable"></el-checkbox>
|
<el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox>
|
||||||
<el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox>
|
<el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
|
@ -120,28 +120,10 @@ export default {
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
isLoging: false,
|
isLoging: false,
|
||||||
onSubmit_text: "立即创建",
|
onSubmit_text: "立即创建",
|
||||||
// platform: {
|
|
||||||
// enable: false,
|
|
||||||
// PTZEnable: true,
|
|
||||||
// rtcp: false,
|
|
||||||
// name: null,
|
|
||||||
// serverGBId: null,
|
|
||||||
// serverGBDomain: null,
|
|
||||||
// serverIP: null,
|
|
||||||
// serverPort: null,
|
|
||||||
// deviceGBId: null,
|
|
||||||
// deviceIp: null,
|
|
||||||
// devicePort: null,
|
|
||||||
// username: null,
|
|
||||||
// password: null,
|
|
||||||
// expires: 300,
|
|
||||||
// keepTimeout: 60,
|
|
||||||
// transport: "UDP",
|
|
||||||
// characterSet: "GB2312",
|
|
||||||
// },
|
|
||||||
platform: {
|
platform: {
|
||||||
enable: true,
|
enable: true,
|
||||||
PTZEnable: true,
|
ptz: true,
|
||||||
rtcp: false,
|
rtcp: false,
|
||||||
name: "测试001",
|
name: "测试001",
|
||||||
serverGBId: "34020000002000000001",
|
serverGBId: "34020000002000000001",
|
||||||
|
|
Loading…
Reference in New Issue