| | |
| | | import org.springframework.transaction.TransactionDefinition; |
| | | import org.springframework.transaction.TransactionStatus; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | |
| | | logger.info("media server [ {} ] ssrcConfig is null", mediaServerItem.getId()); |
| | | return null; |
| | | }else { |
| | | String ssrc = null; |
| | | String ssrc; |
| | | if (presetSsrc != null) { |
| | | ssrc = presetSsrc; |
| | | }else { |
| | |
| | | } |
| | | final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + serverItem.getId(); |
| | | dynamicTask.stop(zlmKeepaliveKey); |
| | | dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), serverItem.getHookAliveInterval() * 1000); |
| | | dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), (serverItem.getHookAliveInterval() + 5) * 1000); |
| | | publisher.zlmOnlineEventPublish(serverItem.getId()); |
| | | logger.info("[ZLM] 连接成功 {} - {}:{} ", |
| | | zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); |
| | |
| | | @Override |
| | | public void zlmServerOffline(String mediaServerId) { |
| | | delete(mediaServerId); |
| | | final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + mediaServerId; |
| | | dynamicTask.stop(zlmKeepaliveKey); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | // 获取分数最低的,及并发最低的 |
| | | Set<Object> objects = RedisUtil.ZRange(key, 0, -1); |
| | | Set<Object> objects = RedisUtil.zRange(key, 0, -1); |
| | | ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects); |
| | | |
| | | String mediaServerId = (String)mediaServerObjectS.get(0); |
| | |
| | | } |
| | | final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + mediaServerItem.getId(); |
| | | dynamicTask.stop(zlmKeepaliveKey); |
| | | dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(mediaServerItem), mediaServerItem.getHookAliveInterval() * 1000); |
| | | dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(mediaServerItem), (mediaServerItem.getHookAliveInterval() + 5) * 1000); |
| | | } |
| | | |
| | | private MediaServerItem getOneFromDatabase(String mediaServerId) { |