Commit ffdc1c9acd43c26ce45dd372b7fb8bba27240c46

Authored by xp.Huang
2 parents bd891886 ca5d2c22

Merge branch 'gbt2818_0226' into 'master_dev'

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

See merge request yunteng/thingskit!349
@@ -48,7 +48,8 @@ public class VideoChanelDTO extends TenantDTO { @@ -48,7 +48,8 @@ public class VideoChanelDTO extends TenantDTO {
48 48
49 @ApiModelProperty(value = "是否有子设备:0没有 1有") 49 @ApiModelProperty(value = "是否有子设备:0没有 1有")
50 private Integer parental; 50 private Integer parental;
51 - 51 + @ApiModelProperty(value = "摄像头总通道数")
  52 + private Integer sumNum;
52 @ApiModelProperty(value = "信令安全模式缺省为0; 0:不采用;2:S/MIME 签名方式;3:S/\n" + "MIME加密签名同时采用方式;4:数字摘要方式") 53 @ApiModelProperty(value = "信令安全模式缺省为0; 0:不采用;2:S/MIME 签名方式;3:S/\n" + "MIME加密签名同时采用方式;4:数字摘要方式")
53 private Integer safetyWay; 54 private Integer safetyWay;
54 55
@@ -84,7 +84,6 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent @@ -84,7 +84,6 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent
84 private final UserSetting userSetting; 84 private final UserSetting userSetting;
85 private final TKSipCommanderService commanderService; 85 private final TKSipCommanderService commanderService;
86 private final DataDecodingEncodingService encodingService; 86 private final DataDecodingEncodingService encodingService;
87 - private final VideoStreamSessionManager videoStreamSessionManager;  
88 private TransportService transportService; 87 private TransportService transportService;
89 private DigestServerAuthenticationHelper authenticationHelper; 88 private DigestServerAuthenticationHelper authenticationHelper;
90 89
@@ -94,7 +93,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent @@ -94,7 +93,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent
94 93
95 @Getter 94 @Getter
96 private final ConcurrentHashMap<DeviceId, String> onlineDevice = new ConcurrentHashMap<>(); 95 private final ConcurrentHashMap<DeviceId, String> onlineDevice = new ConcurrentHashMap<>();
97 - 96 + private final ConcurrentHashMap<String, List<VideoChanelDTO>> deviceNewChanel = new ConcurrentHashMap<>();
98 private static final Map<String, ISIPRequestProcessor> requestProcessorMap = 97 private static final Map<String, ISIPRequestProcessor> requestProcessorMap =
99 new ConcurrentHashMap<>(); 98 new ConcurrentHashMap<>();
100 private static final Map<String, ISIPResponseProcessor> responseProcessorMap = 99 private static final Map<String, ISIPResponseProcessor> responseProcessorMap =
@@ -521,8 +520,23 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent @@ -521,8 +520,23 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent
521 break; 520 break;
522 case Catalog: 521 case Catalog:
523 List<VideoChanelDTO> channelDTO = TKXmlUtil.channelInfoBuilder(devSession, rootElement); 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 break; 540 break;
527 default: 541 default:
528 } 542 }
@@ -208,6 +208,7 @@ public class TKXmlUtil { @@ -208,6 +208,7 @@ public class TKXmlUtil {
208 Optional.ofNullable(deviceChannel).ifPresent(c->{ 208 Optional.ofNullable(deviceChannel).ifPresent(c->{
209 TKSipUtils.updateGps(deviceChannel, device.getGeoCoordSys()); 209 TKSipUtils.updateGps(deviceChannel, device.getGeoCoordSys());
210 deviceChannel.setCameraCode(device.getCameraCode()); 210 deviceChannel.setCameraCode(device.getCameraCode());
  211 + deviceChannel.setSumNum(sumNum);
211 result.add(deviceChannel); 212 result.add(deviceChannel);
212 }); 213 });
213 } 214 }