Commit 47526e241e4df66886623fba187ad85b6796c59f
1 parent
9b62fbe4
修复多wvp推流时,收到停止消息数据处理失败问题
Showing
2 changed files
with
19 additions
and
12 deletions
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java
| @@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | @@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | ||
| 13 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 13 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 14 | import com.genersoft.iot.vmp.service.IMediaServerService; | 14 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 15 | import com.genersoft.iot.vmp.service.bean.*; | 15 | import com.genersoft.iot.vmp.service.bean.*; |
| 16 | +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 16 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 17 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 17 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 18 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 18 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| @@ -77,6 +78,9 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -77,6 +78,9 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 77 | @Autowired | 78 | @Autowired |
| 78 | private IMediaServerService mediaServerService; | 79 | private IMediaServerService mediaServerService; |
| 79 | 80 | ||
| 81 | + @Autowired | ||
| 82 | + private IRedisCatchStorage redisCatchStorage; | ||
| 83 | + | ||
| 80 | 84 | ||
| 81 | @Autowired | 85 | @Autowired |
| 82 | private DynamicTask dynamicTask; | 86 | private DynamicTask dynamicTask; |
| @@ -322,6 +326,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | @@ -322,6 +326,7 @@ public class RedisGbPlayMsgListener implements MessageListener { | ||
| 322 | responseSendItemMsg.setSendRtpItem(sendRtpItem); | 326 | responseSendItemMsg.setSendRtpItem(sendRtpItem); |
| 323 | responseSendItemMsg.setMediaServerItem(mediaServerItem); | 327 | responseSendItemMsg.setMediaServerItem(mediaServerItem); |
| 324 | result.setData(responseSendItemMsg); | 328 | result.setData(responseSendItemMsg); |
| 329 | + redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 325 | 330 | ||
| 326 | WvpRedisMsg response = WvpRedisMsg.getResponseInstance( | 331 | WvpRedisMsg response = WvpRedisMsg.getResponseInstance( |
| 327 | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, JSON.toJSONString(result) | 332 | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, JSON.toJSONString(result) |
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java
| @@ -73,12 +73,20 @@ public class RedisPushStreamCloseResponseListener implements MessageListener { | @@ -73,12 +73,20 @@ public class RedisPushStreamCloseResponseListener implements MessageListener { | ||
| 73 | MessageForPushChannel pushChannel = JSON.parseObject(message.getBody(), MessageForPushChannel.class); | 73 | MessageForPushChannel pushChannel = JSON.parseObject(message.getBody(), MessageForPushChannel.class); |
| 74 | StreamPushItem push = streamPushService.getPush(pushChannel.getApp(), pushChannel.getStream()); | 74 | StreamPushItem push = streamPushService.getPush(pushChannel.getApp(), pushChannel.getStream()); |
| 75 | if (push != null) { | 75 | if (push != null) { |
| 76 | - if (redisCatchStorage.isChannelSendingRTP(push.getGbId())) { | ||
| 77 | - List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId( | ||
| 78 | - push.getGbId()); | ||
| 79 | - if (sendRtpItems.size() > 0) { | ||
| 80 | - for (SendRtpItem sendRtpItem : sendRtpItems) { | ||
| 81 | - ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId()); | 76 | + List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId( |
| 77 | + push.getGbId()); | ||
| 78 | + if (!sendRtpItems.isEmpty()) { | ||
| 79 | + for (SendRtpItem sendRtpItem : sendRtpItems) { | ||
| 80 | + ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId()); | ||
| 81 | + if (parentPlatform != null) { | ||
| 82 | + redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStreamId()); | ||
| 83 | + try { | ||
| 84 | + commanderFroPlatform.streamByeCmd(parentPlatform, sendRtpItem); | ||
| 85 | + } catch (SipException | InvalidArgumentException | ParseException e) { | ||
| 86 | + logger.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage()); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + if (push.isSelf()) { | ||
| 82 | // 停止向上级推流 | 90 | // 停止向上级推流 |
| 83 | String streamId = sendRtpItem.getStreamId(); | 91 | String streamId = sendRtpItem.getStreamId(); |
| 84 | Map<String, Object> param = new HashMap<>(); | 92 | Map<String, Object> param = new HashMap<>(); |
| @@ -90,12 +98,6 @@ public class RedisPushStreamCloseResponseListener implements MessageListener { | @@ -90,12 +98,6 @@ public class RedisPushStreamCloseResponseListener implements MessageListener { | ||
| 90 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 98 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 91 | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStreamId()); | 99 | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStreamId()); |
| 92 | zlmServerFactory.stopSendRtpStream(mediaInfo, param); | 100 | zlmServerFactory.stopSendRtpStream(mediaInfo, param); |
| 93 | - | ||
| 94 | - try { | ||
| 95 | - commanderFroPlatform.streamByeCmd(parentPlatform, sendRtpItem); | ||
| 96 | - } catch (SipException | InvalidArgumentException | ParseException e) { | ||
| 97 | - logger.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage()); | ||
| 98 | - } | ||
| 99 | if (InviteStreamType.PUSH == sendRtpItem.getPlayType()) { | 101 | if (InviteStreamType.PUSH == sendRtpItem.getPlayType()) { |
| 100 | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, | 102 | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, |
| 101 | sendRtpItem.getApp(), sendRtpItem.getStreamId(), sendRtpItem.getChannelId(), | 103 | sendRtpItem.getApp(), sendRtpItem.getStreamId(), sendRtpItem.getChannelId(), |