Merge branch 'wvp-28181-2.0' into wvp-28181-record
# Conflicts: # sql/2.6.9更新.sql
This commit is contained in:
@@ -520,16 +520,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
|
||||
|
||||
// 目录订阅相关的信息
|
||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||
// 若已开启订阅,但订阅周期不同,则先取消
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
|
||||
removeCatalogSubscribe(deviceInStore);
|
||||
}
|
||||
// 开启订阅
|
||||
addCatalogSubscribe(deviceInStore);
|
||||
}
|
||||
}else if (device.getSubscribeCycleForCatalog() == 0) {
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
|
||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
||||
addCatalogSubscribe(deviceInStore);
|
||||
}else if (device.getSubscribeCycleForCatalog() == 0) {
|
||||
// 取消订阅
|
||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
||||
removeCatalogSubscribe(deviceInStore);
|
||||
}
|
||||
}
|
||||
@@ -544,6 +546,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
}else if (device.getSubscribeCycleForMobilePosition() == 0) {
|
||||
if (deviceInStore.getSubscribeCycleForMobilePosition() != 0) {
|
||||
deviceInStore.setMobilePositionSubmissionInterval(device.getMobilePositionSubmissionInterval());
|
||||
deviceInStore.setSubscribeCycleForMobilePosition(device.getSubscribeCycleForMobilePosition());
|
||||
// 取消订阅
|
||||
removeMobilePositionSubscribe(deviceInStore);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
|
||||
":" + inviteInfo.getDeviceId() +
|
||||
":" + inviteInfo.getChannelId() +
|
||||
":" + inviteInfo.getStream() +
|
||||
":" + inviteInfo.getSsrcInfo().getSsrc();
|
||||
":" + ssrc;
|
||||
if (inviteInfoInDb.getSsrcInfo() != null) {
|
||||
inviteInfoInDb.getSsrcInfo().setSsrc(ssrc);
|
||||
}
|
||||
|
||||
@@ -35,15 +35,19 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 视频代理业务
|
||||
@@ -560,4 +564,43 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
|
||||
return new ResourceBaseInfo(total, online);
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "* 0/10 * * * ?")
|
||||
public void asyncCheckStreamProxyStatus() {
|
||||
|
||||
List<MediaServerItem> all = mediaServerService.getAllOnline();
|
||||
|
||||
if (CollectionUtils.isEmpty(all)){
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, MediaServerItem> serverItemMap = all.stream().collect(Collectors.toMap(MediaServerItem::getId, Function.identity(), (m1, m2) -> m1));
|
||||
|
||||
List<StreamProxyItem> list = videoManagerStorager.getStreamProxyListForEnable(true);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return;
|
||||
}
|
||||
|
||||
for (StreamProxyItem streamProxyItem : list) {
|
||||
|
||||
MediaServerItem mediaServerItem = serverItemMap.get(streamProxyItem.getMediaServerId());
|
||||
|
||||
// TODO 支持其他 schema
|
||||
JSONObject mediaInfo = zlmresTfulUtils.isMediaOnline(mediaServerItem, streamProxyItem.getApp(), streamProxyItem.getStream(), "rtsp");
|
||||
|
||||
if (mediaInfo == null){
|
||||
streamProxyItem.setStatus(false);
|
||||
} else {
|
||||
if (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")) {
|
||||
streamProxyItem.setStatus(true);
|
||||
} else {
|
||||
streamProxyItem.setStatus(false);
|
||||
}
|
||||
}
|
||||
|
||||
updateStreamProxy(streamProxyItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,6 +506,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
stream.setUpdateTime(DateUtil.getNow());
|
||||
stream.setCreateTime(DateUtil.getNow());
|
||||
stream.setServerId(userSetting.getServerId());
|
||||
stream.setMediaServerId(mediaConfig.getId());
|
||||
stream.setSelf(true);
|
||||
stream.setPushIng(true);
|
||||
|
||||
// 放在事务内执行
|
||||
boolean result = false;
|
||||
|
||||
Reference in New Issue
Block a user