Commit 4d975c21da2d10233d82d6047e72b0d82b7da343
1 parent
9466bf58
优化国标级联目录推送,支持zlm新特性ssrc校验
Showing
11 changed files
with
83 additions
and
31 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| ... | ... | @@ -129,6 +129,11 @@ public class Device { |
| 129 | 129 | */ |
| 130 | 130 | private int subscribeCycleForAlarm; |
| 131 | 131 | |
| 132 | + /** | |
| 133 | + * 是否开启ssrc校验,默认关闭,开启可以防止串流 | |
| 134 | + */ | |
| 135 | + private boolean ssrcCheck; | |
| 136 | + | |
| 132 | 137 | |
| 133 | 138 | public String getDeviceId() { |
| 134 | 139 | return deviceId; |
| ... | ... | @@ -321,4 +326,12 @@ public class Device { |
| 321 | 326 | public void setSubscribeCycleForAlarm(int subscribeCycleForAlarm) { |
| 322 | 327 | this.subscribeCycleForAlarm = subscribeCycleForAlarm; |
| 323 | 328 | } |
| 329 | + | |
| 330 | + public boolean isSsrcCheck() { | |
| 331 | + return ssrcCheck; | |
| 332 | + } | |
| 333 | + | |
| 334 | + public void setSsrcCheck(boolean ssrcCheck) { | |
| 335 | + this.ssrcCheck = ssrcCheck; | |
| 336 | + } | |
| 324 | 337 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
| ... | ... | @@ -169,6 +169,11 @@ public class DeviceChannel { |
| 169 | 169 | */ |
| 170 | 170 | private boolean hasAudio; |
| 171 | 171 | |
| 172 | + /** | |
| 173 | + * 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 174 | + */ | |
| 175 | + private int channelType; | |
| 176 | + | |
| 172 | 177 | public int getId() { |
| 173 | 178 | return id; |
| 174 | 179 | } |
| ... | ... | @@ -441,4 +446,12 @@ public class DeviceChannel { |
| 441 | 446 | public void setUpdateTime(String updateTime) { |
| 442 | 447 | this.updateTime = updateTime; |
| 443 | 448 | } |
| 449 | + | |
| 450 | + public int getChannelType() { | |
| 451 | + return channelType; | |
| 452 | + } | |
| 453 | + | |
| 454 | + public void setChannelType(int channelType) { | |
| 455 | + this.channelType = channelType; | |
| 456 | + } | |
| 444 | 457 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| ... | ... | @@ -260,24 +260,27 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 260 | 260 | catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); |
| 261 | 261 | catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); |
| 262 | 262 | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| 263 | - catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 264 | - catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); | |
| 265 | - catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); | |
| 266 | - catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 267 | 263 | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| 268 | 264 | if (channel.getParentId() != null) { |
| 269 | 265 | catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); |
| 270 | 266 | } |
| 271 | - catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); | |
| 272 | 267 | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| 273 | 268 | catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n"); |
| 274 | - catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n"); | |
| 275 | - catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n"); | |
| 276 | - catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); | |
| 277 | - catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); | |
| 278 | - catalogXml.append("<Info>\r\n"); | |
| 279 | - catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); | |
| 280 | - catalogXml.append("</Info>\r\n"); | |
| 269 | + catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); | |
| 270 | + if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段 | |
| 271 | + catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 272 | + catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); | |
| 273 | + catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); | |
| 274 | + catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 275 | + catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n"); | |
| 276 | + catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n"); | |
| 277 | + catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); | |
| 278 | + catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); | |
| 279 | + catalogXml.append("<Info>\r\n"); | |
| 280 | + catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); | |
| 281 | + catalogXml.append("</Info>\r\n"); | |
| 282 | + } | |
| 283 | + | |
| 281 | 284 | catalogXml.append("</Item>\r\n"); |
| 282 | 285 | } |
| 283 | 286 | } |
| ... | ... | @@ -539,10 +542,6 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 539 | 542 | catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); |
| 540 | 543 | catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); |
| 541 | 544 | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| 542 | - catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 543 | - catalogXml.append("<Owner>0</Owner>\r\n"); | |
| 544 | - catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); | |
| 545 | - catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 546 | 545 | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| 547 | 546 | if (channel.getParentId() != null) { |
| 548 | 547 | catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); |
| ... | ... | @@ -550,6 +549,12 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 550 | 549 | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| 551 | 550 | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| 552 | 551 | catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); |
| 552 | + if (channel.getChannelType() == 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性 | |
| 553 | + catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 554 | + catalogXml.append("<Owner>0</Owner>\r\n"); | |
| 555 | + catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); | |
| 556 | + catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 557 | + } | |
| 553 | 558 | if (!"presence".equals(subscribeInfo.getEventType())) { |
| 554 | 559 | catalogXml.append("<Event>" + type + "</Event>\r\n"); |
| 555 | 560 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
| ... | ... | @@ -83,10 +83,10 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 83 | 83 | catalog.setParentId(parentPlatform.getDeviceGBId()); |
| 84 | 84 | } |
| 85 | 85 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 86 | + // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 87 | + deviceChannel.setChannelType(2); | |
| 86 | 88 | deviceChannel.setChannelId(catalog.getId()); |
| 87 | 89 | deviceChannel.setName(catalog.getName()); |
| 88 | - deviceChannel.setLongitude(0.0); | |
| 89 | - deviceChannel.setLatitude(0.0); | |
| 90 | 90 | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| 91 | 91 | deviceChannel.setManufacture("wvp-pro"); |
| 92 | 92 | deviceChannel.setStatus(1); |
| ... | ... | @@ -94,9 +94,6 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 94 | 94 | deviceChannel.setParentId(catalog.getParentId()); |
| 95 | 95 | deviceChannel.setRegisterWay(1); |
| 96 | 96 | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| 97 | - deviceChannel.setModel("live"); | |
| 98 | - deviceChannel.setOwner("wvp-pro"); | |
| 99 | - deviceChannel.setSecrecy("0"); | |
| 100 | 97 | allChannels.add(deviceChannel); |
| 101 | 98 | } |
| 102 | 99 | } |
| ... | ... | @@ -107,6 +104,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 107 | 104 | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| 108 | 105 | } |
| 109 | 106 | DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); |
| 107 | + // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 108 | + deviceChannel.setChannelType(0); | |
| 110 | 109 | deviceChannel.setParental(0); |
| 111 | 110 | deviceChannel.setParentId(channel.getCatalogId()); |
| 112 | 111 | deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6)); |
| ... | ... | @@ -120,6 +119,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 120 | 119 | gbStream.setCatalogId(null); |
| 121 | 120 | } |
| 122 | 121 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 122 | + // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 123 | + deviceChannel.setChannelType(1); | |
| 123 | 124 | deviceChannel.setChannelId(gbStream.getGbId()); |
| 124 | 125 | deviceChannel.setName(gbStream.getName()); |
| 125 | 126 | deviceChannel.setLongitude(gbStream.getLongitude()); | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| ... | ... | @@ -81,7 +81,7 @@ public class ZLMRTPServerFactory { |
| 81 | 81 | return result; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public int createRTPServer(MediaServerItem mediaServerItem, String streamId) { | |
| 84 | + public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc) { | |
| 85 | 85 | int result = -1; |
| 86 | 86 | // 查询此rtp server 是否已经存在 |
| 87 | 87 | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| ... | ... | @@ -94,6 +94,7 @@ public class ZLMRTPServerFactory { |
| 94 | 94 | param.put("enable_tcp", 1); |
| 95 | 95 | param.put("stream_id", streamId); |
| 96 | 96 | param.put("port", 0); |
| 97 | + param.put("ssrc", ssrc); | |
| 97 | 98 | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| 98 | 99 | |
| 99 | 100 | if (openRtpServerResultJson != null) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
| ... | ... | @@ -44,9 +44,9 @@ public interface IMediaServerService { |
| 44 | 44 | |
| 45 | 45 | void updateVmServer(List<MediaServerItem> mediaServerItemList); |
| 46 | 46 | |
| 47 | - SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId); | |
| 47 | + SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck); | |
| 48 | 48 | |
| 49 | - SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback); | |
| 49 | + SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck, boolean isPlayback); | |
| 50 | 50 | |
| 51 | 51 | void closeRTPServer(String deviceId, String channelId, String ssrc); |
| 52 | 52 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -117,12 +117,12 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | @Override |
| 120 | - public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId) { | |
| 121 | - return openRTPServer(mediaServerItem, streamId, false); | |
| 120 | + public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck) { | |
| 121 | + return openRTPServer(mediaServerItem, streamId, ssrcCheck,false); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | @Override |
| 125 | - public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback) { | |
| 125 | + public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck, boolean isPlayback) { | |
| 126 | 126 | if (mediaServerItem == null || mediaServerItem.getId() == null) { |
| 127 | 127 | return null; |
| 128 | 128 | } |
| ... | ... | @@ -146,7 +146,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 146 | 146 | } |
| 147 | 147 | int rtpServerPort = mediaServerItem.getRtpProxyPort(); |
| 148 | 148 | if (mediaServerItem.isRtpEnable()) { |
| 149 | - rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId); | |
| 149 | + rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0); | |
| 150 | 150 | } |
| 151 | 151 | redisUtil.set(key, mediaServerItem); |
| 152 | 152 | return new SSRCInfo(rtpServerPort, ssrc, streamId); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -188,7 +188,7 @@ public class PlayServiceImpl implements IPlayService { |
| 188 | 188 | if (mediaServerItem.isRtpEnable()) { |
| 189 | 189 | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 190 | 190 | } |
| 191 | - SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); | |
| 191 | + SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck()); | |
| 192 | 192 | play(mediaServerItem, ssrcInfo, device, channelId, (mediaServerItemInUse, response)->{ |
| 193 | 193 | if (hookEvent != null) { |
| 194 | 194 | hookEvent.response(mediaServerItem, response); |
| ... | ... | @@ -232,7 +232,7 @@ public class PlayServiceImpl implements IPlayService { |
| 232 | 232 | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 233 | 233 | } |
| 234 | 234 | if (ssrcInfo == null) { |
| 235 | - ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); | |
| 235 | + ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck()); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // 超时处理 | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| ... | ... | @@ -37,6 +37,7 @@ public interface DeviceMapper { |
| 37 | 37 | "subscribeCycleForMobilePosition," + |
| 38 | 38 | "mobilePositionSubmissionInterval," + |
| 39 | 39 | "subscribeCycleForAlarm," + |
| 40 | + "ssrcCheck," + | |
| 40 | 41 | "online" + |
| 41 | 42 | ") VALUES (" + |
| 42 | 43 | "#{deviceId}," + |
| ... | ... | @@ -59,6 +60,7 @@ public interface DeviceMapper { |
| 59 | 60 | "#{subscribeCycleForMobilePosition}," + |
| 60 | 61 | "#{mobilePositionSubmissionInterval}," + |
| 61 | 62 | "#{subscribeCycleForAlarm}," + |
| 63 | + "#{ssrcCheck}," + | |
| 62 | 64 | "#{online}" + |
| 63 | 65 | ")") |
| 64 | 66 | int add(Device device); |
| ... | ... | @@ -84,6 +86,7 @@ public interface DeviceMapper { |
| 84 | 86 | "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" + |
| 85 | 87 | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" + |
| 86 | 88 | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" + |
| 89 | + "<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" + | |
| 87 | 90 | "WHERE deviceId='${deviceId}'"+ |
| 88 | 91 | " </script>"}) |
| 89 | 92 | int update(Device device); | ... | ... |
web_src/src/components/dialog/catalogEdit.vue
| ... | ... | @@ -13,11 +13,24 @@ |
| 13 | 13 | <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
| 14 | 14 | <el-form ref="form" :rules="rules" :model="form" label-width="140px" > |
| 15 | 15 | <el-form-item label="节点编号" prop="id" > |
| 16 | - <el-input v-model="form.id" :disabled="isEdit"></el-input> | |
| 16 | + <el-tooltip class="item" effect="dark" content="" placement="top-start"> | |
| 17 | + <div slot="content"> | |
| 18 | + 建议的类型: | |
| 19 | + <br/> | |
| 20 | +   行政区划(可选2位/4位/6位/8位/10位数字,例如:130432,表示河北省邯郸市广平县) | |
| 21 | + <br/> | |
| 22 | +   业务分组(第11、12、13位215,例如:34020000002150000001) | |
| 23 | + <br/> | |
| 24 | +   虚拟组织(第11、12、13位216,例如:34020000002160000001) | |
| 25 | + </div> | |
| 26 | + <el-input v-model="form.id" :disabled="isEdit"></el-input> | |
| 27 | + </el-tooltip> | |
| 17 | 28 | </el-form-item> |
| 18 | 29 | <el-form-item label="节点名称" prop="name"> |
| 19 | 30 | <el-input v-model="form.name" clearable></el-input> |
| 20 | 31 | </el-form-item> |
| 32 | + | |
| 33 | + | |
| 21 | 34 | <el-form-item> |
| 22 | 35 | <div style="float: right;"> |
| 23 | 36 | <el-button type="primary" @click="onSubmit" >确认</el-button> | ... | ... |
web_src/src/components/dialog/deviceEdit.vue
| ... | ... | @@ -45,6 +45,9 @@ |
| 45 | 45 | <el-form-item v-if="form.subscribeCycleForMobilePosition > 0" label="移动位置报送间隔" prop="subscribeCycleForCatalog" > |
| 46 | 46 | <el-input v-model="form.mobilePositionSubmissionInterval" clearable ></el-input> |
| 47 | 47 | </el-form-item> |
| 48 | + <el-form-item label="其他选项"> | |
| 49 | + <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox> | |
| 50 | + </el-form-item> | |
| 48 | 51 | <el-form-item> |
| 49 | 52 | <div style="float: right;"> |
| 50 | 53 | <el-button type="primary" @click="onSubmit" >确认</el-button> | ... | ... |