Commit 5e34039deffa57fc50e93e45b6fa6879ce70e552
1 parent
3e2486d0
支持对接第三方PS流
Showing
2 changed files
with
8 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -29,6 +29,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | @@ -29,6 +29,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | ||
| 29 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 29 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 30 | import com.genersoft.iot.vmp.utils.DateUtil; | 30 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 31 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | 31 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 32 | +import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo; | ||
| 32 | import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo; | 33 | import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo; |
| 33 | import com.genersoft.iot.vmp.vmanager.bean.StreamContent; | 34 | import com.genersoft.iot.vmp.vmanager.bean.StreamContent; |
| 34 | import org.slf4j.Logger; | 35 | import org.slf4j.Logger; |
src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java
| @@ -6,12 +6,13 @@ import com.genersoft.iot.vmp.conf.DynamicTask; | @@ -6,12 +6,13 @@ import com.genersoft.iot.vmp.conf.DynamicTask; | ||
| 6 | import com.genersoft.iot.vmp.conf.UserSetting; | 6 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 7 | import com.genersoft.iot.vmp.conf.exception.ControllerException; | 7 | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 8 | import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; | 8 | import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; |
| 9 | -import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 9 | +import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| 10 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; | 10 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; |
| 11 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | 11 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; |
| 12 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRtpServerTimeout; | 12 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRtpServerTimeout; |
| 13 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | 13 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; |
| 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 15 | +import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam; | ||
| 15 | import com.genersoft.iot.vmp.service.IMediaServerService; | 16 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 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.ErrorCode; | 18 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| @@ -45,7 +46,7 @@ public class PsController { | @@ -45,7 +46,7 @@ public class PsController { | ||
| 45 | private final static Logger logger = LoggerFactory.getLogger(PsController.class); | 46 | private final static Logger logger = LoggerFactory.getLogger(PsController.class); |
| 46 | 47 | ||
| 47 | @Autowired | 48 | @Autowired |
| 48 | - private ZLMRTPServerFactory zlmServerFactory; | 49 | + private ZLMServerFactory zlmServerFactory; |
| 49 | 50 | ||
| 50 | @Autowired | 51 | @Autowired |
| 51 | private ZlmHttpHookSubscribe hookSubscribe; | 52 | private ZlmHttpHookSubscribe hookSubscribe; |
| @@ -109,8 +110,9 @@ public class PsController { | @@ -109,8 +110,9 @@ public class PsController { | ||
| 109 | HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(stream, String.valueOf(ssrcInt), mediaServerItem.getId()); | 110 | HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(stream, String.valueOf(ssrcInt), mediaServerItem.getId()); |
| 110 | // 订阅 zlm启动事件, 新的zlm也会从这里进入系统 | 111 | // 订阅 zlm启动事件, 新的zlm也会从这里进入系统 |
| 111 | hookSubscribe.addSubscribe(hookSubscribeForRtpServerTimeout, | 112 | hookSubscribe.addSubscribe(hookSubscribeForRtpServerTimeout, |
| 112 | - (mediaServerItemInUse, response)->{ | ||
| 113 | - if (stream.equals(response.getString("stream_id"))) { | 113 | + (mediaServerItemInUse, hookParam)->{ |
| 114 | + OnRtpServerTimeoutHookParam serverTimeoutHookParam = (OnRtpServerTimeoutHookParam) hookParam; | ||
| 115 | + if (stream.equals(serverTimeoutHookParam.getStream_id())) { | ||
| 114 | logger.info("[第三方PS服务对接->开启收流和获取发流信息] 等待收流超时 callId->{}, 发送回调", callId); | 116 | logger.info("[第三方PS服务对接->开启收流和获取发流信息] 等待收流超时 callId->{}, 发送回调", callId); |
| 115 | // 将信息写入redis中,以备后用 | 117 | // 将信息写入redis中,以备后用 |
| 116 | redisTemplate.delete(receiveKey); | 118 | redisTemplate.delete(receiveKey); |
| @@ -159,7 +161,7 @@ public class PsController { | @@ -159,7 +161,7 @@ public class PsController { | ||
| 159 | zlmServerFactory.closeRtpServer(mediaServerItem,stream); | 161 | zlmServerFactory.closeRtpServer(mediaServerItem,stream); |
| 160 | String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_*_" + stream; | 162 | String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_*_" + stream; |
| 161 | List<Object> scan = RedisUtil.scan(redisTemplate, receiveKey); | 163 | List<Object> scan = RedisUtil.scan(redisTemplate, receiveKey); |
| 162 | - if (scan.size() > 0) { | 164 | + if (!scan.isEmpty()) { |
| 163 | for (Object key : scan) { | 165 | for (Object key : scan) { |
| 164 | // 将信息写入redis中,以备后用 | 166 | // 将信息写入redis中,以备后用 |
| 165 | redisTemplate.delete(key); | 167 | redisTemplate.delete(key); |