Commit ca5d2c22a83ff6b1604acf57a5b47de2100f980a

Authored by 芯火源
1 parent bd891886

fix: 摄像头多通道同步问题修复

... ... @@ -48,7 +48,8 @@ public class VideoChanelDTO extends TenantDTO {
48 48
49 49 @ApiModelProperty(value = "是否有子设备:0没有 1有")
50 50 private Integer parental;
51   -
  51 + @ApiModelProperty(value = "摄像头总通道数")
  52 + private Integer sumNum;
52 53 @ApiModelProperty(value = "信令安全模式缺省为0; 0:不采用;2:S/MIME 签名方式;3:S/\n" + "MIME加密签名同时采用方式;4:数字摘要方式")
53 54 private Integer safetyWay;
54 55
... ...
... ... @@ -84,7 +84,6 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent
84 84 private final UserSetting userSetting;
85 85 private final TKSipCommanderService commanderService;
86 86 private final DataDecodingEncodingService encodingService;
87   - private final VideoStreamSessionManager videoStreamSessionManager;
88 87 private TransportService transportService;
89 88 private DigestServerAuthenticationHelper authenticationHelper;
90 89
... ... @@ -94,7 +93,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent
94 93
95 94 @Getter
96 95 private final ConcurrentHashMap<DeviceId, String> onlineDevice = new ConcurrentHashMap<>();
97   -
  96 + private final ConcurrentHashMap<String, List<VideoChanelDTO>> deviceNewChanel = new ConcurrentHashMap<>();
98 97 private static final Map<String, ISIPRequestProcessor> requestProcessorMap =
99 98 new ConcurrentHashMap<>();
100 99 private static final Map<String, ISIPResponseProcessor> responseProcessorMap =
... ... @@ -521,8 +520,23 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent
521 520 break;
522 521 case Catalog:
523 522 List<VideoChanelDTO> channelDTO = TKXmlUtil.channelInfoBuilder(devSession, rootElement);
524   - byte[] channaelMsgBytes = encodingService.encode(channelDTO);
525   - msgBuilder.setContext(ByteString.copyFrom(channaelMsgBytes));
  523 + String cameraCode = devSession.getCameraCode();
  524 + int channelNum =1;
  525 + if(!channelDTO.isEmpty()){
  526 + channelNum = channelDTO.get(0).getSumNum();
  527 + List<VideoChanelDTO> itemChanel = new ArrayList<>();
  528 + if(deviceNewChanel.containsKey(cameraCode)){
  529 + itemChanel =deviceNewChanel.get(cameraCode);
  530 + }else{
  531 + deviceNewChanel.put(cameraCode,itemChanel);
  532 + }
  533 + itemChanel.addAll(channelDTO);
  534 + }
  535 + if(channelNum == deviceNewChanel.get(cameraCode).size()){
  536 + byte[] channaelMsgBytes = encodingService.encode(deviceNewChanel.get(cameraCode));
  537 + msgBuilder.setContext(ByteString.copyFrom(channaelMsgBytes));
  538 + deviceNewChanel.remove(cameraCode);
  539 + }
526 540 break;
527 541 default:
528 542 }
... ...
... ... @@ -208,6 +208,7 @@ public class TKXmlUtil {
208 208 Optional.ofNullable(deviceChannel).ifPresent(c->{
209 209 TKSipUtils.updateGps(deviceChannel, device.getGeoCoordSys());
210 210 deviceChannel.setCameraCode(device.getCameraCode());
  211 + deviceChannel.setSumNum(sumNum);
211 212 result.add(deviceChannel);
212 213 });
213 214 }
... ...