Commit 562dbb0857e4e6f7a250d69752270c0c165d5141

Authored by 648540858
2 parents 2e7c9a73 6eed486f

Merge remote-tracking branch 'origin/main-dev' into main-dev

# Conflicts:
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
... ... @@ -40,6 +40,7 @@ import javax.sip.SipFactory;
40 40 import javax.sip.header.CallIdHeader;
41 41 import javax.sip.message.Request;
42 42 import java.text.ParseException;
  43 +import java.util.ArrayList;
43 44 import java.util.List;
44 45  
45 46 /**
... ... @@ -696,7 +697,6 @@ public class SIPCommander implements ISIPCommander {
696 697 streamSession.removeByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getCallId());
697 698 Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());
698 699 sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent);
699   -
700 700 }
701 701 }
702 702  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
... ... @@ -217,7 +217,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
217 217 if (mediaServerItem != null) {
218 218 mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcTransaction.getSsrc());
219 219 }
220   - streamSession.removeByCallId(device.getDeviceId(), channel.getChannelId(), ssrcTransaction.getCallId());
  220 + streamSession.removeByCallId(device.getDeviceId(), channel.getChannelId(), ssrcTransaction.getCallId());
221 221 if (ssrcTransaction.getType() == InviteSessionType.BROADCAST) {
222 222 // 查找来源的对讲设备,发送停止
223 223 Device sourceDevice = storager.queryVideoDeviceByPlatformIdAndChannelId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
... ...
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,13 +318,17 @@ public class ZLMHttpHookListener {
318 318 result.setEnable_audio(true);
319 319 }
320 320 }
  321 + } else if (param.getApp().equals("broadcast")) {
  322 + result.setEnable_audio(true);
  323 + } else if (param.getApp().equals("talk")) {
  324 + result.setEnable_audio(true);
321 325 }
322 326 if (param.getApp().equalsIgnoreCase("rtp")) {
323 327 String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_RTP_INFO + userSetting.getServerId() + "_" + param.getStream();
324   - OtherRtpSendInfo otherRtpSendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(receiveKey);
  328 + OtherRtpSendInfo otherRtpSendInfo = (OtherRtpSendInfo) redisTemplate.opsForValue().get(receiveKey);
325 329  
326 330 String receiveKeyForPS = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_" + param.getStream();
327   - OtherPsSendInfo otherPsSendInfo = (OtherPsSendInfo)redisTemplate.opsForValue().get(receiveKeyForPS);
  331 + OtherPsSendInfo otherPsSendInfo = (OtherPsSendInfo) redisTemplate.opsForValue().get(receiveKeyForPS);
328 332 if (otherRtpSendInfo != null || otherPsSendInfo != null) {
329 333 result.setEnable_mp4(true);
330 334 }
... ... @@ -347,13 +351,10 @@ public class ZLMHttpHookListener {
347 351 logger.info("[ZLM HOOK] 流注销, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
348 352 }
349 353  
350   - JSONObject ret = new JSONObject();
351   - ret.put("code", 0);
352   - ret.put("msg", "success");
353   - MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
354 354 JSONObject json = (JSONObject) JSON.toJSON(param);
355 355 taskExecutor.execute(() -> {
356 356 ZlmHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_stream_changed, json);
  357 + MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
357 358 if (mediaInfo == null) {
358 359 logger.info("[ZLM HOOK] 流变化未找到ZLM, {}", param.getMediaServerId());
359 360 return;
... ... @@ -500,7 +501,7 @@ public class ZLMHttpHookListener {
500 501 GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
501 502 if (gbStream != null) {
502 503 if (userSetting.isUsePushingAsStatus()) {
503   - eventPublisher.catalogEventPublishForStream(null, gbStream, param.isRegist()?CatalogEvent.ON:CatalogEvent.OFF);
  504 + eventPublisher.catalogEventPublishForStream(null, gbStream, param.isRegist() ? CatalogEvent.ON : CatalogEvent.OFF);
504 505 }
505 506 }
506 507 if (type != null) {
... ... @@ -524,33 +525,31 @@ public class ZLMHttpHookListener {
524 525 ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
525 526 Device device = deviceService.getDevice(platformId);
526 527  
527   - try {
528   - if (platform != null) {
529   - commanderFroPlatform.streamByeCmd(platform, sendRtpItem);
530   - redisCatchStorage.deleteSendRTPServer(platformId, sendRtpItem.getChannelId(),
531   - sendRtpItem.getCallId(), sendRtpItem.getStream());
532   - } else {
533   - cmder.streamByeCmd(device, sendRtpItem.getChannelId(), param.getStream(), sendRtpItem.getCallId());
534   - if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST)
535   - || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) {
536   - AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
537   - if (audioBroadcastCatch != null) {
538   - // 来自上级平台的停止对讲
539   - logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
540   - audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
541   - }
  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());
542 542 }
543 543 }
544   - } catch (SipException | InvalidArgumentException | ParseException |
545   - SsrcTransactionNotFoundException e) {
546   - logger.error("[命令发送失败] 发送BYE: {}", e.getMessage());
547 544 }
  545 + } catch (SipException | InvalidArgumentException | ParseException |
  546 + SsrcTransactionNotFoundException e) {
  547 + logger.error("[命令发送失败] 发送BYE: {}", e.getMessage());
548 548 }
549 549 }
550 550 }
551 551 }
552 552 }
553   -
554 553 }
555 554 });
556 555 return HookResult.SUCCESS();
... ... @@ -612,14 +611,14 @@ public class ZLMHttpHookListener {
612 611 if (info != null) {
613 612 cmder.streamByeCmd(device, inviteInfo.getChannelId(),
614 613 inviteInfo.getStream(), null);
615   - }else {
  614 + } else {
616 615 logger.info("[无人观看] 未找到设备的点播信息: {}, 流:{}", inviteInfo.getDeviceId(), param.getStream());
617 616 }
618 617 } catch (InvalidArgumentException | ParseException | SipException |
619 618 SsrcTransactionNotFoundException e) {
620 619 logger.error("[无人观看]点播, 发送BYE失败 {}", e.getMessage());
621 620 }
622   - }else {
  621 + } else {
623 622 logger.info("[无人观看] 未找到设备: {},流:{}", inviteInfo.getDeviceId(), param.getStream());
624 623 }
625 624  
... ... @@ -729,7 +728,7 @@ public class ZLMHttpHookListener {
729 728 });
730 729 }
731 730 return result;
732   - }else if(s.length == 4){
  731 + } else if (s.length == 4) {
733 732 // 此时为录像回放, 录像回放格式为> 设备ID_通道ID_开始时间_结束时间
734 733 String startTimeStr = s[2];
735 734 String endTimeStr = s[3];
... ... @@ -763,14 +762,14 @@ public class ZLMHttpHookListener {
763 762  
764 763 if (!exist) {
765 764 SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaInfo, param.getStream(), null,
766   - device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
  765 + device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
767 766 playService.playBack(mediaInfo, ssrcInfo, deviceId, channelId, startTime, endTime, (code, message, data) -> {
768 767 msg.setData(new HookResult(code, message));
769 768 resultHolder.invokeResult(msg);
770 769 });
771 770 }
772 771 return result;
773   - }else {
  772 + } else {
774 773 defaultResult.setResult(HookResult.SUCCESS());
775 774 return defaultResult;
776 775 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -21,24 +21,24 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
21 21 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
22 22 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
23 23 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
24   -import com.genersoft.iot.vmp.media.zlm.*;
25   -import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
26   -import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
27   -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
28 24 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
29 25 import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
30 26 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
31 27 import com.genersoft.iot.vmp.media.zlm.dto.*;
  28 +import com.genersoft.iot.vmp.media.zlm.*;
  29 +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
  30 +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
  31 +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
32 32 import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
33 33 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam;
34 34 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
35 35 import com.genersoft.iot.vmp.service.*;
  36 +import com.genersoft.iot.vmp.service.bean.*;
36 37 import com.genersoft.iot.vmp.service.bean.ErrorCallback;
37 38 import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
38 39 import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
39 40 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
40 41 import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener;
41   -import com.genersoft.iot.vmp.service.bean.*;
42 42 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
43 43 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
44 44 import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper;
... ... @@ -101,19 +101,13 @@ public class PlayServiceImpl implements IPlayService {
101 101 private IInviteStreamService inviteStreamService;
102 102  
103 103 @Autowired
104   - private SendRtpPortManager sendRtpPortManager;
105   -
106   - @Autowired
107 104 private ZlmHttpHookSubscribe subscribe;
108 105  
109 106 @Autowired
110   - private ZLMRESTfulUtils zlmresTfulUtils;
111   -
112   - @Autowired
113   - private AssistRESTfulUtils assistRESTfulUtils;
  107 + private SendRtpPortManager sendRtpPortManager;
114 108  
115 109 @Autowired
116   - private ZLMServerFactory zlmServerFactory;
  110 + private ZLMRESTfulUtils zlmresTfulUtils;
117 111  
118 112 @Autowired
119 113 private IMediaService mediaService;
... ...