Commit 23ce55260fdb9277cd72987c1e6a3d4e058f3bb4

Authored by 648540858
1 parent b63a89a0

修复级联点播

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
1 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
2 2  
3 3 import com.alibaba.fastjson2.JSONObject;
  4 +import com.genersoft.iot.vmp.common.StreamInfo;
4 5 import com.genersoft.iot.vmp.conf.DynamicTask;
5 6 import com.genersoft.iot.vmp.conf.UserSetting;
6 7 import com.genersoft.iot.vmp.gb28181.bean.*;
... ... @@ -454,21 +455,17 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
454 455 });
455 456 } else {
456 457 sendRtpItem.setPlayType(InviteStreamType.PLAY);
457   - SsrcTransaction playTransaction = sessionManager.getSsrcTransaction(device.getDeviceId(), channelId, "play", null);
458   - if (playTransaction != null) {
459   - Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, "rtp", playTransaction.getStream());
  458 +// SsrcTransaction playTransaction = sessionManager.getSsrcTransaction(device.getDeviceId(), channelId, "play", null);
  459 + StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(device.getDeviceId(), channelId);
  460 + if (streamInfo != null) {
  461 + Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, streamInfo.getApp(), streamInfo.getStream());
460 462 if (!streamReady) {
461   - boolean hasRtpServer = mediaServerService.checkRtpServer(mediaServerItem, "rtp", playTransaction.getStream());
462   - if (hasRtpServer) {
463   - logger.info("[上级点播]已经开启rtpServer但是尚未收到流,开启监听流的到来");
464   - HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", playTransaction.getStream(), true, "rtsp", mediaServerItem.getId());
465   - zlmHttpHookSubscribe.addSubscribe(hookSubscribe, hookEvent);
466   - }else {
467   - playTransaction = null;
468   - }
  463 + redisCatchStorage.stopPlay(streamInfo);
  464 + storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
  465 + streamInfo = null;
469 466 }
470 467 }
471   - if (playTransaction == null) {
  468 + if (streamInfo == null) {
472 469 String streamId = null;
473 470 if (mediaServerItem.isRtpEnable()) {
474 471 streamId = String.format("%s_%s", device.getDeviceId(), channelId);
... ... @@ -488,7 +485,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
488 485 } else {
489 486 // 当前系统作为下级平台使用,当上级平台点播时不携带ssrc时,并且设备在当前系统中已经点播了。这个时候需要重新给生成一个ssrc,不使用默认的"0000000000"。
490 487 sendRtpItem.setSsrc(ssrc);
491   - sendRtpItem.setStreamId(playTransaction.getStream());
  488 + sendRtpItem.setStreamId(streamInfo.getStream());
492 489 // 写入redis, 超时时回复
493 490 redisCatchStorage.updateSendRTPSever(sendRtpItem);
494 491 JSONObject jsonObject = new JSONObject();
... ...