优化国标级联目录推送,支持zlm新特性ssrc校验
| | |
| | | */ |
| | | private int subscribeCycleForAlarm; |
| | | |
| | | /** |
| | | * 是否开启ssrc校验,默认关闭,开启可以防止串流 |
| | | */ |
| | | private boolean ssrcCheck; |
| | | |
| | | |
| | | public String getDeviceId() { |
| | | return deviceId; |
| | |
| | | public void setSubscribeCycleForAlarm(int subscribeCycleForAlarm) { |
| | | this.subscribeCycleForAlarm = subscribeCycleForAlarm; |
| | | } |
| | | |
| | | public boolean isSsrcCheck() { |
| | | return ssrcCheck; |
| | | } |
| | | |
| | | public void setSsrcCheck(boolean ssrcCheck) { |
| | | this.ssrcCheck = ssrcCheck; |
| | | } |
| | | } |
| | |
| | | */ |
| | | private boolean hasAudio; |
| | | |
| | | /** |
| | | * 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 |
| | | */ |
| | | private int channelType; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setUpdateTime(String updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public int getChannelType() { |
| | | return channelType; |
| | | } |
| | | |
| | | public void setChannelType(int channelType) { |
| | | this.channelType = channelType; |
| | | } |
| | | } |
| | |
| | | catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); |
| | | catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); |
| | | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| | | if (channel.getParentId() != null) { |
| | | catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); |
| | | } |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| | | catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n"); |
| | | catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n"); |
| | | catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n"); |
| | | catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); |
| | | catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); |
| | | catalogXml.append("<Info>\r\n"); |
| | | catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); |
| | | catalogXml.append("</Info>\r\n"); |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段 |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n"); |
| | | catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n"); |
| | | catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); |
| | | catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); |
| | | catalogXml.append("<Info>\r\n"); |
| | | catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); |
| | | catalogXml.append("</Info>\r\n"); |
| | | } |
| | | |
| | | catalogXml.append("</Item>\r\n"); |
| | | } |
| | | } |
| | |
| | | catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); |
| | | catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); |
| | | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner>0</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); |
| | | if (channel.getParentId() != null) { |
| | | catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); |
| | |
| | | catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); |
| | | catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); |
| | | catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); |
| | | if (channel.getChannelType() == 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性 |
| | | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); |
| | | catalogXml.append("<Owner>0</Owner>\r\n"); |
| | | catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); |
| | | catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); |
| | | } |
| | | if (!"presence".equals(subscribeInfo.getEventType())) { |
| | | catalogXml.append("<Event>" + type + "</Event>\r\n"); |
| | | } |
| | |
| | | catalog.setParentId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 |
| | | deviceChannel.setChannelType(2); |
| | | deviceChannel.setChannelId(catalog.getId()); |
| | | deviceChannel.setName(catalog.getName()); |
| | | deviceChannel.setLongitude(0.0); |
| | | deviceChannel.setLatitude(0.0); |
| | | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| | | deviceChannel.setManufacture("wvp-pro"); |
| | | deviceChannel.setStatus(1); |
| | |
| | | deviceChannel.setParentId(catalog.getParentId()); |
| | | deviceChannel.setRegisterWay(1); |
| | | deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); |
| | | deviceChannel.setModel("live"); |
| | | deviceChannel.setOwner("wvp-pro"); |
| | | deviceChannel.setSecrecy("0"); |
| | | allChannels.add(deviceChannel); |
| | | } |
| | | } |
| | |
| | | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| | | } |
| | | DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); |
| | | // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 |
| | | deviceChannel.setChannelType(0); |
| | | deviceChannel.setParental(0); |
| | | deviceChannel.setParentId(channel.getCatalogId()); |
| | | deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6)); |
| | |
| | | gbStream.setCatalogId(null); |
| | | } |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 |
| | | deviceChannel.setChannelType(1); |
| | | deviceChannel.setChannelId(gbStream.getGbId()); |
| | | deviceChannel.setName(gbStream.getName()); |
| | | deviceChannel.setLongitude(gbStream.getLongitude()); |
| | |
| | | return result; |
| | | } |
| | | |
| | | public int createRTPServer(MediaServerItem mediaServerItem, String streamId) { |
| | | public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc) { |
| | | int result = -1; |
| | | // 查询此rtp server 是否已经存在 |
| | | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| | |
| | | param.put("enable_tcp", 1); |
| | | param.put("stream_id", streamId); |
| | | param.put("port", 0); |
| | | param.put("ssrc", ssrc); |
| | | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| | | |
| | | if (openRtpServerResultJson != null) { |
| | |
| | | |
| | | void updateVmServer(List<MediaServerItem> mediaServerItemList); |
| | | |
| | | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId); |
| | | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck); |
| | | |
| | | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback); |
| | | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck, boolean isPlayback); |
| | | |
| | | void closeRTPServer(String deviceId, String channelId, String ssrc); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId) { |
| | | return openRTPServer(mediaServerItem, streamId, false); |
| | | public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck) { |
| | | return openRTPServer(mediaServerItem, streamId, ssrcCheck,false); |
| | | } |
| | | |
| | | @Override |
| | | public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback) { |
| | | public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck, boolean isPlayback) { |
| | | if (mediaServerItem == null || mediaServerItem.getId() == null) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | int rtpServerPort = mediaServerItem.getRtpProxyPort(); |
| | | if (mediaServerItem.isRtpEnable()) { |
| | | rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId); |
| | | rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0); |
| | | } |
| | | redisUtil.set(key, mediaServerItem); |
| | | return new SSRCInfo(rtpServerPort, ssrc, streamId); |
| | |
| | | if (mediaServerItem.isRtpEnable()) { |
| | | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| | | } |
| | | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); |
| | | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck()); |
| | | play(mediaServerItem, ssrcInfo, device, channelId, (mediaServerItemInUse, response)->{ |
| | | if (hookEvent != null) { |
| | | hookEvent.response(mediaServerItem, response); |
| | |
| | | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| | | } |
| | | if (ssrcInfo == null) { |
| | | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); |
| | | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck()); |
| | | } |
| | | |
| | | // 超时处理 |
| | |
| | | "subscribeCycleForMobilePosition," + |
| | | "mobilePositionSubmissionInterval," + |
| | | "subscribeCycleForAlarm," + |
| | | "ssrcCheck," + |
| | | "online" + |
| | | ") VALUES (" + |
| | | "#{deviceId}," + |
| | |
| | | "#{subscribeCycleForMobilePosition}," + |
| | | "#{mobilePositionSubmissionInterval}," + |
| | | "#{subscribeCycleForAlarm}," + |
| | | "#{ssrcCheck}," + |
| | | "#{online}" + |
| | | ")") |
| | | int add(Device device); |
| | |
| | | "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" + |
| | | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" + |
| | | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" + |
| | | "<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" + |
| | | "WHERE deviceId='${deviceId}'"+ |
| | | " </script>"}) |
| | | int update(Device device); |
| | |
| | | <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
| | | <el-form ref="form" :rules="rules" :model="form" label-width="140px" > |
| | | <el-form-item label="节点编号" prop="id" > |
| | | <el-input v-model="form.id" :disabled="isEdit"></el-input> |
| | | <el-tooltip class="item" effect="dark" content="" placement="top-start"> |
| | | <div slot="content"> |
| | | 建议的类型: |
| | | <br/> |
| | |   行政区划(可选2位/4位/6位/8位/10位数字,例如:130432,表示河北省邯郸市广平县) |
| | | <br/> |
| | |   业务分组(第11、12、13位215,例如:34020000002150000001) |
| | | <br/> |
| | |   虚拟组织(第11、12、13位216,例如:34020000002160000001) |
| | | </div> |
| | | <el-input v-model="form.id" :disabled="isEdit"></el-input> |
| | | </el-tooltip> |
| | | </el-form-item> |
| | | <el-form-item label="节点名称" prop="name"> |
| | | <el-input v-model="form.name" clearable></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | <el-form-item> |
| | | <div style="float: right;"> |
| | | <el-button type="primary" @click="onSubmit" >确认</el-button> |
| | |
| | | <el-form-item v-if="form.subscribeCycleForMobilePosition > 0" label="移动位置报送间隔" prop="subscribeCycleForCatalog" > |
| | | <el-input v-model="form.mobilePositionSubmissionInterval" clearable ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="其他选项"> |
| | | <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div style="float: right;"> |
| | | <el-button type="primary" @click="onSubmit" >确认</el-button> |