Commit 6eed486ff1866c6d3ca7240e6c9cd1a5b4d5c6b7

Authored by 648540858
1 parent 9a96597e

合并主线

src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
... ... @@ -267,7 +267,7 @@ public class ZLMHttpHookListener {
267 267 result.setEnable_mp4(userSetting.isRecordPushLive());
268 268 }
269 269 // 国标流
270   - if ("rtp".equals(param.getApp()) ) {
  270 + if ("rtp".equals(param.getApp())) {
271 271  
272 272 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream());
273 273  
... ... @@ -318,18 +318,17 @@ public class ZLMHttpHookListener {
318 318 result.setEnable_audio(true);
319 319 }
320 320 }
321   - }
322   - else if (param.getApp().equals("broadcast")) {
  321 + } else if (param.getApp().equals("broadcast")) {
323 322 result.setEnable_audio(true);
324   - }else if (param.getApp().equals("talk")) {
  323 + } else if (param.getApp().equals("talk")) {
325 324 result.setEnable_audio(true);
326 325 }
327 326 if (param.getApp().equalsIgnoreCase("rtp")) {
328 327 String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_RTP_INFO + userSetting.getServerId() + "_" + param.getStream();
329   - OtherRtpSendInfo otherRtpSendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(receiveKey);
  328 + OtherRtpSendInfo otherRtpSendInfo = (OtherRtpSendInfo) redisTemplate.opsForValue().get(receiveKey);
330 329  
331 330 String receiveKeyForPS = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_" + param.getStream();
332   - OtherPsSendInfo otherPsSendInfo = (OtherPsSendInfo)redisTemplate.opsForValue().get(receiveKeyForPS);
  331 + OtherPsSendInfo otherPsSendInfo = (OtherPsSendInfo) redisTemplate.opsForValue().get(receiveKeyForPS);
333 332 if (otherRtpSendInfo != null || otherPsSendInfo != null) {
334 333 result.setEnable_mp4(true);
335 334 }
... ... @@ -352,13 +351,10 @@ public class ZLMHttpHookListener {
352 351 logger.info("[ZLM HOOK] 流注销, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
353 352 }
354 353  
355   - JSONObject ret = new JSONObject();
356   - ret.put("code", 0);
357   - ret.put("msg", "success");
358   - MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
359 354 JSONObject json = (JSONObject) JSON.toJSON(param);
360 355 taskExecutor.execute(() -> {
361 356 ZlmHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_stream_changed, json);
  357 + MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
362 358 if (mediaInfo == null) {
363 359 logger.info("[ZLM HOOK] 流变化未找到ZLM, {}", param.getMediaServerId());
364 360 return;
... ... @@ -505,7 +501,7 @@ public class ZLMHttpHookListener {
505 501 GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
506 502 if (gbStream != null) {
507 503 if (userSetting.isUsePushingAsStatus()) {
508   - eventPublisher.catalogEventPublishForStream(null, gbStream, param.isRegist()?CatalogEvent.ON:CatalogEvent.OFF);
  504 + eventPublisher.catalogEventPublishForStream(null, gbStream, param.isRegist() ? CatalogEvent.ON : CatalogEvent.OFF);
509 505 }
510 506 }
511 507 if (type != null) {
... ... @@ -529,33 +525,31 @@ public class ZLMHttpHookListener {
529 525 ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
530 526 Device device = deviceService.getDevice(platformId);
531 527  
532   - try {
533   - if (platform != null) {
534   - commanderFroPlatform.streamByeCmd(platform, sendRtpItem);
535   - redisCatchStorage.deleteSendRTPServer(platformId, sendRtpItem.getChannelId(),
536   - sendRtpItem.getCallId(), sendRtpItem.getStream());
537   - } else {
538   - cmder.streamByeCmd(device, sendRtpItem.getChannelId(), param.getStream(), sendRtpItem.getCallId());
539   - if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST)
540   - || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) {
541   - AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
542   - if (audioBroadcastCatch != null) {
543   - // 来自上级平台的停止对讲
544   - logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
545   - audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
546   - }
  528 + try {
  529 + if (platform != null) {
  530 + commanderFroPlatform.streamByeCmd(platform, sendRtpItem);
  531 + redisCatchStorage.deleteSendRTPServer(platformId, sendRtpItem.getChannelId(),
  532 + sendRtpItem.getCallId(), sendRtpItem.getStream());
  533 + } else {
  534 + cmder.streamByeCmd(device, sendRtpItem.getChannelId(), param.getStream(), sendRtpItem.getCallId());
  535 + if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST)
  536 + || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) {
  537 + AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
  538 + if (audioBroadcastCatch != null) {
  539 + // 来自上级平台的停止对讲
  540 + logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
  541 + audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
547 542 }
548 543 }
549   - } catch (SipException | InvalidArgumentException | ParseException |
550   - SsrcTransactionNotFoundException e) {
551   - logger.error("[命令发送失败] 发送BYE: {}", e.getMessage());
552 544 }
  545 + } catch (SipException | InvalidArgumentException | ParseException |
  546 + SsrcTransactionNotFoundException e) {
  547 + logger.error("[命令发送失败] 发送BYE: {}", e.getMessage());
553 548 }
554 549 }
555 550 }
556 551 }
557 552 }
558   -
559 553 }
560 554 });
561 555 return HookResult.SUCCESS();
... ... @@ -617,14 +611,14 @@ public class ZLMHttpHookListener {
617 611 if (info != null) {
618 612 cmder.streamByeCmd(device, inviteInfo.getChannelId(),
619 613 inviteInfo.getStream(), null);
620   - }else {
  614 + } else {
621 615 logger.info("[无人观看] 未找到设备的点播信息: {}, 流:{}", inviteInfo.getDeviceId(), param.getStream());
622 616 }
623 617 } catch (InvalidArgumentException | ParseException | SipException |
624 618 SsrcTransactionNotFoundException e) {
625 619 logger.error("[无人观看]点播, 发送BYE失败 {}", e.getMessage());
626 620 }
627   - }else {
  621 + } else {
628 622 logger.info("[无人观看] 未找到设备: {},流:{}", inviteInfo.getDeviceId(), param.getStream());
629 623 }
630 624  
... ... @@ -734,7 +728,7 @@ public class ZLMHttpHookListener {
734 728 });
735 729 }
736 730 return result;
737   - }else if(s.length == 4){
  731 + } else if (s.length == 4) {
738 732 // 此时为录像回放, 录像回放格式为> 设备ID_通道ID_开始时间_结束时间
739 733 String startTimeStr = s[2];
740 734 String endTimeStr = s[3];
... ... @@ -768,14 +762,14 @@ public class ZLMHttpHookListener {
768 762  
769 763 if (!exist) {
770 764 SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaInfo, param.getStream(), null,
771   - device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
  765 + device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
772 766 playService.playBack(mediaInfo, ssrcInfo, deviceId, channelId, startTime, endTime, (code, message, data) -> {
773 767 msg.setData(new HookResult(code, message));
774 768 resultHolder.invokeResult(msg);
775 769 });
776 770 }
777 771 return result;
778   - }else {
  772 + } else {
779 773 defaultResult.setResult(HookResult.SUCCESS());
780 774 return defaultResult;
781 775 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -108,12 +108,6 @@ public class PlayServiceImpl implements IPlayService {
108 108 private ZLMRESTfulUtils zlmresTfulUtils;
109 109  
110 110 @Autowired
111   - private ZLMServerFactory zlmServerFactory;
112   -
113   - @Autowired
114   - private AssistRESTfulUtils assistRESTfulUtils;
115   -
116   - @Autowired
117 111 private IMediaService mediaService;
118 112  
119 113 @Autowired
... ...