Merge branch 'wvp-28181-2.0' into main-dev

结构优化
648540858 2023-07-24 09:42:32 +08:00
commit 7d3cbb8253
15 changed files with 308 additions and 150 deletions

View File

@ -107,6 +107,10 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
- [X] 支持MysqlPostgresql金仓等数据库 - [X] 支持MysqlPostgresql金仓等数据库
- [X] 支持Onvif(目前在onvif分支需要安装onvif服务服务请在知识星球获取) - [X] 支持Onvif(目前在onvif分支需要安装onvif服务服务请在知识星球获取)
# 非开源的内容
- [X] ONVIF设备的接入支持点播云台控制国标级联点播自动点播。在[知识星球](https://t.zsxq.com/10WAnH2MP)放了试用安装包以及使用教程,没有使用时间限制,需要源码可以星球私信我或者邮箱联系。
# 授权协议 # 授权协议
本项目自有代码使用宽松的MIT协议在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。 但是本项目也零碎的使用了一些其他的开源代码,在商用的情况下请自行替代或剔除; 由于使用本项目而产生的商业纠纷或侵权行为一概与本项目及开发者无关,请自行承担法律风险。 在使用本项目代码时,也应该在授权协议中同时表明本项目依赖的第三方库的协议 本项目自有代码使用宽松的MIT协议在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。 但是本项目也零碎的使用了一些其他的开源代码,在商用的情况下请自行替代或剔除; 由于使用本项目而产生的商业纠纷或侵权行为一概与本项目及开发者无关,请自行承担法律风险。 在使用本项目代码时,也应该在授权协议中同时表明本项目依赖的第三方库的协议

View File

@ -0,0 +1,191 @@
package com.genersoft.iot.vmp.common;
import io.swagger.v3.oas.annotations.media.Schema;
public class CommonGbChannel {
/**
*
*/
@Schema(description = "归属")
private String owner;
/**
*
*/
@Schema(description = "行政区划")
private String civilCode;
/**
*
*/
@Schema(description = "安装地址")
private String address;
/**
*
*/
@Schema(description = "经度")
private Double longitude;
/**
*
*/
@Schema(description = "纬度")
private Double latitude;
/**
* :
* 1-;
* 2-;
* 3-;
* 4-
*/
@Schema(description = "摄像机类型")
private Integer ptzType;
/**
*
* 1-
* 2-
* 3-
* 4-广
* 5-
* 6-
* 7-
* 8-
* 9-
* 10-线
*/
@Schema(description = "摄像机位置类型扩展")
private Integer positionType;
/**
*
* 1-
* 2-
*/
@Schema(description = "安装位置室外、室内属性")
private Integer roomType;
/**
*
* 1-
* 2-
* 3-
*/
@Schema(description = "用途")
private Integer useType;
/**
*
* 1-
* 2-
* 3-
*/
@Schema(description = "补光属性")
private Integer supplyLightType;
/**
*
* 1-
* 2-西
* 3-
* 4-
* 5-
* 6-
* 7-西
* 8-西
*
*/
@Schema(description = "方位")
private Integer directionType;
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getCivilCode() {
return civilCode;
}
public void setCivilCode(String civilCode) {
this.civilCode = civilCode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Integer getPtzType() {
return ptzType;
}
public void setPtzType(Integer ptzType) {
this.ptzType = ptzType;
}
public Integer getPositionType() {
return positionType;
}
public void setPositionType(Integer positionType) {
this.positionType = positionType;
}
public Integer getRoomType() {
return roomType;
}
public void setRoomType(Integer roomType) {
this.roomType = roomType;
}
public Integer getUseType() {
return useType;
}
public void setUseType(Integer useType) {
this.useType = useType;
}
public Integer getSupplyLightType() {
return supplyLightType;
}
public void setSupplyLightType(Integer supplyLightType) {
this.supplyLightType = supplyLightType;
}
public Integer getDirectionType() {
return directionType;
}
public void setDirectionType(Integer directionType) {
this.directionType = directionType;
}
}

View File

@ -63,7 +63,7 @@ public class SipLayer implements CommandLineRunner {
private void addListeningPoint(String monitorIp, int port){ private void addListeningPoint(String monitorIp, int port){
SipStackImpl sipStack; SipStackImpl sipStack;
try { try {
sipStack = (SipStackImpl)SipFactory.getInstance().createSipStack(DefaultProperties.getProperties(monitorIp, userSetting.getSipLog())); sipStack = (SipStackImpl)SipFactory.getInstance().createSipStack(DefaultProperties.getProperties("GB28181_SIP", userSetting.getSipLog()));
sipStack.setMessageParserFactory(new GbStringMsgParserFactory()); sipStack.setMessageParserFactory(new GbStringMsgParserFactory());
} catch (PeerUnavailableException e) { } catch (PeerUnavailableException e) {
logger.error("[SIP SERVER] SIP服务启动失败 监听地址{}失败,请检查ip是否正确", monitorIp); logger.error("[SIP SERVER] SIP服务启动失败 监听地址{}失败,请检查ip是否正确", monitorIp);

View File

@ -12,10 +12,10 @@ import java.util.Properties;
*/ */
public class DefaultProperties { public class DefaultProperties {
public static Properties getProperties(String ip, boolean sipLog) { public static Properties getProperties(String name, boolean sipLog) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP"); properties.setProperty("javax.sip.STACK_NAME", name);
properties.setProperty("javax.sip.IP_ADDRESS", ip); // properties.setProperty("javax.sip.IP_ADDRESS", ip);
// 关闭自动会话 // 关闭自动会话
properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off"); properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
/** /**

View File

@ -344,7 +344,7 @@ public class XmlUtil {
if (!ObjectUtils.isEmpty(civilCode) if (!ObjectUtils.isEmpty(civilCode)
&& civilCode.length() <= 8 && civilCode.length() <= 8
&& NumberUtils.isParsable(civilCode) && NumberUtils.isParsable(civilCode)
&& Integer.parseInt(civilCode)%2 == 0 && civilCode.length()%2 == 0
) { ) {
deviceChannel.setCivilCode(civilCode); deviceChannel.setCivilCode(civilCode);
} }

View File

@ -3,12 +3,14 @@ package com.genersoft.iot.vmp.media.zlm;
import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.media.zlm.dto.MediaSendRtpPortInfo; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.utils.redis.RedisUtil; import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.support.atomic.RedisAtomicInteger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
@ -26,23 +28,14 @@ public class SendRtpPortManager {
@Autowired @Autowired
private RedisTemplate<Object, Object> redisTemplate; private RedisTemplate<Object, Object> redisTemplate;
private final String KEY = "VM_MEDIA_SEND_RTP_PORT_RANGE_"; private final String KEY = "VM_MEDIA_SEND_RTP_PORT_";
public int getNextPort(MediaServerItem mediaServer) {
public void initServerPort(String mediaServerId, int startPort, int endPort){ if (mediaServer == null) {
String key = KEY + userSetting.getServerId() + "_" + mediaServerId; logger.warn("[发送端口管理] 参数错误mediaServer为NULL");
MediaSendRtpPortInfo mediaSendRtpPortInfo = new MediaSendRtpPortInfo(startPort, endPort, mediaServerId); return -1;
redisTemplate.opsForValue().set(key, mediaSendRtpPortInfo);
}
public int getNextPort(String mediaServerId) {
String sendIndexKey = KEY + userSetting.getServerId() + "_" + mediaServerId;
MediaSendRtpPortInfo mediaSendRtpPortInfo = (MediaSendRtpPortInfo)redisTemplate.opsForValue().get(sendIndexKey);
if (mediaSendRtpPortInfo == null) {
logger.warn("[发送端口管理] 获取{}的发送端口时未找到端口信息", mediaServerId);
return 0;
} }
String sendIndexKey = KEY + userSetting.getServerId() + "_" + mediaServer.getId();
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
+ userSetting.getServerId() + "_*"; + userSetting.getServerId() + "_*";
List<Object> queryResult = RedisUtil.scan(redisTemplate, key); List<Object> queryResult = RedisUtil.scan(redisTemplate, key);
@ -54,14 +47,39 @@ public class SendRtpPortManager {
sendRtpItemMap.put(sendRtpItem.getLocalPort(), sendRtpItem); sendRtpItemMap.put(sendRtpItem.getLocalPort(), sendRtpItem);
} }
} }
String sendRtpPortRange = mediaServer.getSendRtpPortRange();
int startPort;
int endPort;
if (sendRtpPortRange == null) {
logger.warn("{}未设置发送端口默认值自动使用40000-50000作为端口范围", mediaServer.getId());
String[] portArray = sendRtpPortRange.split(",");
if (portArray.length != 2 || !NumberUtils.isParsable(portArray[0]) || !NumberUtils.isParsable(portArray[1])) {
logger.warn("{}发送端口配置格式错误自动使用40000-50000作为端口范围", mediaServer.getId());
startPort = 50000;
endPort = 60000;
}else {
int port = getPort(mediaSendRtpPortInfo.getCurrent(), if ( Integer.parseInt(portArray[1]) - Integer.parseInt(portArray[0]) < 1) {
mediaSendRtpPortInfo.getStart(), logger.warn("{}发送端口配置错误,结束端口至少比开始端口大一自动使用40000-50000作为端口范围", mediaServer.getId());
mediaSendRtpPortInfo.getEnd(), checkPort -> sendRtpItemMap.get(checkPort) == null); startPort = 50000;
endPort = 60000;
mediaSendRtpPortInfo.setCurrent(port); }else {
redisTemplate.opsForValue().set(sendIndexKey, mediaSendRtpPortInfo); startPort = Integer.parseInt(portArray[0]);
return port; endPort = Integer.parseInt(portArray[1]);
}
}
}else {
startPort = 50000;
endPort = 60000;
}
if (redisTemplate == null || redisTemplate.getConnectionFactory() == null) {
logger.warn("{}获取redis连接信息失败", mediaServer.getId());
return -1;
}
RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(sendIndexKey , redisTemplate.getConnectionFactory());
return redisAtomicInteger.getAndUpdate((current)->{
return getPort(current, startPort, endPort, checkPort-> !sendRtpItemMap.containsKey(checkPort));
});
} }
interface CheckPortCallback{ interface CheckPortCallback{
@ -69,22 +87,25 @@ public class SendRtpPortManager {
} }
private int getPort(int current, int start, int end, CheckPortCallback checkPortCallback) { private int getPort(int current, int start, int end, CheckPortCallback checkPortCallback) {
int port; if (current <= 0) {
if (current %2 != 0) { if (start%2 == 0) {
port = current + 1; current = start;
}else {
port = current + 2;
}
if (port > end) {
if (start %2 != 0) {
port = start + 1;
}else { }else {
port = start; current = start + 1;
}
}else {
current += 2;
if (current > end) {
if (start%2 == 0) {
current = start;
}else {
current = start + 1;
}
} }
} }
if (!checkPortCallback.check(port)) { if (!checkPortCallback.check(current)) {
return getPort(port, start, end, checkPortCallback); return getPort(current + 2, start, end, checkPortCallback);
} }
return port; return current;
} }
} }

View File

@ -171,7 +171,7 @@ public class ZLMServerFactory {
// 默认为随机端口 // 默认为随机端口
int localPort = 0; int localPort = 0;
if (userSetting.getGbSendStreamStrict()) { if (userSetting.getGbSendStreamStrict()) {
localPort = sendRtpPortManager.getNextPort(serverItem.getId()); localPort = sendRtpPortManager.getNextPort(serverItem);
if (localPort == 0) { if (localPort == 0) {
return null; return null;
} }
@ -207,7 +207,7 @@ public class ZLMServerFactory {
// 默认为随机端口 // 默认为随机端口
int localPort = 0; int localPort = 0;
if (userSetting.getGbSendStreamStrict()) { if (userSetting.getGbSendStreamStrict()) {
localPort = sendRtpPortManager.getNextPort(serverItem.getId()); localPort = sendRtpPortManager.getNextPort(serverItem);
if (localPort == 0) { if (localPort == 0) {
return null; return null;
} }

View File

@ -1,50 +0,0 @@
package com.genersoft.iot.vmp.media.zlm.dto;
public class MediaSendRtpPortInfo {
private int start;
private int end;
private String mediaServerId;
private int current;
public MediaSendRtpPortInfo(int start, int end, String mediaServerId) {
this.start = start;
this.current = start;
this.end = end;
this.mediaServerId = mediaServerId;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
public String getMediaServerId() {
return mediaServerId;
}
public void setMediaServerId(String mediaServerId) {
this.mediaServerId = mediaServerId;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
}

View File

@ -121,34 +121,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
if (ssrcFactory.hasMediaServerSSRC(mediaServerItem.getId())) { if (ssrcFactory.hasMediaServerSSRC(mediaServerItem.getId())) {
ssrcFactory.initMediaServerSSRC(mediaServerItem.getId(), null); ssrcFactory.initMediaServerSSRC(mediaServerItem.getId(), null);
} }
if (userSetting.getGbSendStreamStrict()) {
int startPort = 50000;
int endPort = 60000;
String sendRtpPortRange = mediaServerItem.getSendRtpPortRange();
if (sendRtpPortRange == null) {
logger.warn("[zlm] ] 未配置发流端口范围默认使用50000到60000");
}else {
String[] sendRtpPortRangeArray = sendRtpPortRange.trim().split(",");
if (sendRtpPortRangeArray.length != 2) {
logger.warn("[zlm] ] 发流端口范围错误默认使用50000到60000");
}else {
try {
startPort = Integer.parseInt(sendRtpPortRangeArray[0]);
endPort = Integer.parseInt(sendRtpPortRangeArray[1]);
if (endPort <= startPort) {
logger.warn("[zlm] ] 发流端口范围错误,结束端口应大于开始端口,使用默认端口");
startPort = 50000;
endPort = 60000;
}
}catch (NumberFormatException e) {
logger.warn("[zlm] ] 发流端口范围错误默认使用50000到60000");
}
}
}
logger.info("[[zlm] ] 配置发流端口范围,{}-{}", startPort, endPort);
sendRtpPortManager.initServerPort(mediaServerItem.getId(), startPort, endPort);
}
// 查询redis是否存在此mediaServer // 查询redis是否存在此mediaServer
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId();
Boolean hasKey = redisTemplate.hasKey(key); Boolean hasKey = redisTemplate.hasKey(key);

View File

@ -440,7 +440,7 @@ public class PlayServiceImpl implements IPlayService {
InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getCode(),
InviteErrorCode.SUCCESS.getMsg(), InviteErrorCode.SUCCESS.getMsg(),
streamInfo); streamInfo);
logger.info("[点播成功] deviceId: {}, channelId:{}, 码流类型:{}", device.getDeviceId(), logger.info("[点播成功] deviceId: {}, channelId:{}, 码流类型:{}", device.getDeviceId(), channelId,
device.isSwitchPrimarySubStream() ? "辅码流" : "主码流"); device.isSwitchPrimarySubStream() ? "辅码流" : "主码流");
snapOnPlay(mediaServerItemInuse, device.getDeviceId(), channelId, ssrcInfo.getStream()); snapOnPlay(mediaServerItemInuse, device.getDeviceId(), channelId, ssrcInfo.getStream());
}, (event) -> { }, (event) -> {

View File

@ -155,25 +155,24 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
return; return;
} }
String talkKey = UUID.randomUUID().toString();
dynamicTask.startCron(talkKey, ()->{
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(param.getApp(), param.getStream(), mediaInfo.getId(), false);
if (streamInfo != null) {
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
}
}, 1000);
String delayTalkKey = UUID.randomUUID().toString();
dynamicTask.startDelay(delayTalkKey, ()->{
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(param.getApp(), param.getStream(), mediaInfo.getId(), false);
if (streamInfo != null) {
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
}else {
dynamicTask.stop(talkKey);
callback.run(ErrorCode.ERROR100.getCode(), "超时", null);
}
}, 5000);
if (param.isEnable()) { if (param.isEnable()) {
String talkKey = UUID.randomUUID().toString();
dynamicTask.startCron(talkKey, ()->{
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(param.getApp(), param.getStream(), mediaInfo.getId(), false);
if (streamInfo != null) {
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
}
}, 1000);
String delayTalkKey = UUID.randomUUID().toString();
dynamicTask.startDelay(delayTalkKey, ()->{
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(param.getApp(), param.getStream(), mediaInfo.getId(), false);
if (streamInfo != null) {
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
}else {
dynamicTask.stop(talkKey);
callback.run(ErrorCode.ERROR100.getCode(), "超时", null);
}
}, 5000);
JSONObject jsonObject = addStreamProxyToZlm(param); JSONObject jsonObject = addStreamProxyToZlm(param);
if (jsonObject != null && jsonObject.getInteger("code") == 0) { if (jsonObject != null && jsonObject.getInteger("code") == 0) {
dynamicTask.stop(talkKey); dynamicTask.stop(talkKey);
@ -190,13 +189,16 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
} }
if (jsonObject == null){ if (jsonObject == null){
callback.run(ErrorCode.ERROR100.getCode(), "记录已保存,启用失败", null); callback.run(ErrorCode.ERROR100.getCode(), "记录已保存,启用失败", null);
return;
}else { }else {
callback.run(ErrorCode.ERROR100.getCode(), jsonObject.getString("msg"), null); callback.run(ErrorCode.ERROR100.getCode(), jsonObject.getString("msg"), null);
return;
} }
} }
} }
else{
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(
mediaInfo, param.getApp(), param.getStream(), null, null);
callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
}
} }
private String getSchemaFromFFmpegCmd(String ffmpegCmd) { private String getSchemaFromFFmpegCmd(String ffmpegCmd) {

View File

@ -139,8 +139,8 @@ public class RtpController {
redisTemplate.opsForValue().set(receiveKey, otherRtpSendInfo); redisTemplate.opsForValue().set(receiveKey, otherRtpSendInfo);
if (isSend != null && isSend) { if (isSend != null && isSend) {
// 预创建发流信息 // 预创建发流信息
int portForVideo = sendRtpPortManager.getNextPort(mediaServerItem.getId()); int portForVideo = sendRtpPortManager.getNextPort(mediaServerItem);
int portForAudio = sendRtpPortManager.getNextPort(mediaServerItem.getId()); int portForAudio = sendRtpPortManager.getNextPort(mediaServerItem);
otherRtpSendInfo.setSendLocalIp(mediaServerItem.getSdpIp()); otherRtpSendInfo.setSendLocalIp(mediaServerItem.getSdpIp());
otherRtpSendInfo.setSendLocalPortForVideo(portForVideo); otherRtpSendInfo.setSendLocalPortForVideo(portForVideo);

View File

@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.VersionInfo; import com.genersoft.iot.vmp.conf.VersionInfo;
import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe; import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@ -72,6 +73,9 @@ public class ServerController {
@Autowired @Autowired
private IRedisCatchStorage redisCatchStorage; private IRedisCatchStorage redisCatchStorage;
@Autowired
private SendRtpPortManager sendRtpPortManager;
@GetMapping(value = "/media_server/list") @GetMapping(value = "/media_server/list")
@ResponseBody @ResponseBody
@ -262,4 +266,12 @@ public class ServerController {
return result; return result;
} }
@PostMapping(value = "/test/getPort")
@ResponseBody
public int getPort() {
int result = sendRtpPortManager.getNextPort(mediaServerService.getDefaultMediaServer());
System.out.println(result);
return result;
}
} }

View File

@ -51,15 +51,15 @@ public class ApiStreamController {
@Autowired @Autowired
private IRedisCatchStorage redisCatchStorage; private IRedisCatchStorage redisCatchStorage;
@Autowired
private IInviteStreamService inviteStreamService;
@Autowired @Autowired
private IDeviceService deviceService; private IDeviceService deviceService;
@Autowired @Autowired
private IPlayService playService; private IPlayService playService;
@Autowired
private IInviteStreamService inviteStreamService;
/** /**
* - * -
* @param serial * @param serial
@ -92,7 +92,7 @@ public class ApiStreamController {
result.put("error","device[ " + serial + " ]未找到"); result.put("error","device[ " + serial + " ]未找到");
resultDeferredResult.setResult(result); resultDeferredResult.setResult(result);
return resultDeferredResult; return resultDeferredResult;
}else if (!device.isOnLine()) { }else if (device.isOnLine()) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("error","device[ " + code + " ]offline"); result.put("error","device[ " + code + " ]offline");
resultDeferredResult.setResult(result); resultDeferredResult.setResult(result);
@ -133,11 +133,17 @@ public class ApiStreamController {
result.put("ChannelName", deviceChannel.getName()); result.put("ChannelName", deviceChannel.getName());
result.put("ChannelCustomName", ""); result.put("ChannelCustomName", "");
result.put("FLV", inviteInfo.getStreamInfo().getFlv().getUrl()); result.put("FLV", inviteInfo.getStreamInfo().getFlv().getUrl());
result.put("HTTPS_FLV", inviteInfo.getStreamInfo().getHttps_flv().getUrl());
result.put("WS_FLV", inviteInfo.getStreamInfo().getWs_flv().getUrl()); result.put("WS_FLV", inviteInfo.getStreamInfo().getWs_flv().getUrl());
result.put("WSS_FLV", inviteInfo.getStreamInfo().getWss_flv().getUrl());
result.put("RTMP", inviteInfo.getStreamInfo().getRtmp().getUrl()); result.put("RTMP", inviteInfo.getStreamInfo().getRtmp().getUrl());
result.put("RTMPS", inviteInfo.getStreamInfo().getRtmps().getUrl());
result.put("HLS", inviteInfo.getStreamInfo().getHls().getUrl()); result.put("HLS", inviteInfo.getStreamInfo().getHls().getUrl());
result.put("HTTPS_HLS", inviteInfo.getStreamInfo().getHttps_hls().getUrl());
result.put("RTSP", inviteInfo.getStreamInfo().getRtsp().getUrl()); result.put("RTSP", inviteInfo.getStreamInfo().getRtsp().getUrl());
result.put("RTSPS", inviteInfo.getStreamInfo().getRtsps().getUrl());
result.put("WEBRTC", inviteInfo.getStreamInfo().getRtc().getUrl()); result.put("WEBRTC", inviteInfo.getStreamInfo().getRtc().getUrl());
result.put("HTTPS_WEBRTC", inviteInfo.getStreamInfo().getRtcs().getUrl());
result.put("CDN", ""); result.put("CDN", "");
result.put("SnapURL", ""); result.put("SnapURL", "");
result.put("Transport", device.getTransport()); result.put("Transport", device.getTransport());

View File

@ -145,8 +145,8 @@ media:
enable: true enable: true
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性不然自动配置此属性可能不成功 # [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性不然自动配置此属性可能不成功
port-range: 30000,30500 # 端口范围 port-range: 30000,30500 # 端口范围
# [可选] 国标级联在此范围内选择端口发送媒体流 # [可选] 国标级联在此范围内选择端口发送媒体流,请不要与收流端口范围重合
send-port-range: 30000,30500 # 端口范围 send-port-range: 50502,50506 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用 # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
record-assist-port: 0 record-assist-port: 0