Commit 5e34039deffa57fc50e93e45b6fa6879ce70e552

Authored by 648540858
1 parent 3e2486d0

支持对接第三方PS流

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