优化流信息存储的兼容性

This commit is contained in:
lin
2025-10-29 15:56:29 +08:00
parent 952d38d69b
commit 091d6e67ee
4 changed files with 12 additions and 6 deletions

View File

@@ -213,7 +213,7 @@ public class Device {
@Schema(description = "所属服务Id")
private String serverId;
public boolean isWgs84() {
public boolean checkWgs84() {
return geoCoordSys.equalsIgnoreCase("WGS84");
}
}

View File

@@ -124,7 +124,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
catalogChannelEvent.getChannel().setDataDeviceId(device.getId());
if (catalogChannelEvent.getChannel().getLongitude() > 0
&& catalogChannelEvent.getChannel().getLatitude() > 0) {
if (device.isWgs84()) {
if (device.checkWgs84()) {
catalogChannelEvent.getChannel().setGbLongitude(catalogChannelEvent.getChannel().getLongitude());
catalogChannelEvent.getChannel().setGbLatitude(catalogChannelEvent.getChannel().getLatitude());
}else {

View File

@@ -106,7 +106,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
if (streamAuthorityInfo != null) {
mediaInfo.setCallId(streamAuthorityInfo.getCallId());
}
redisTemplate.opsForValue().set(key, mediaInfo);
redisTemplate.opsForValue().set(key, JSON.toJSONString(mediaInfo));
}
@Override
@@ -130,7 +130,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type.toUpperCase() + "_*_*_" + mediaServerId;
List<Object> streams = RedisUtil.scan(redisTemplate, key);
for (Object stream : streams) {
MediaInfo mediaInfo = (MediaInfo)redisTemplate.opsForValue().get(stream);
String mediaInfoJson = (String)redisTemplate.opsForValue().get(stream);
MediaInfo mediaInfo = JSON.parseObject(mediaInfoJson, MediaInfo.class);
result.add(mediaInfo);
}
return result;
@@ -251,7 +252,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
List<Object> keys = RedisUtil.scan(redisTemplate, scanKey);
if (keys.size() > 0) {
String key = (String) keys.get(0);
result = JsonUtil.redisJsonToObject(redisTemplate, key, MediaInfo.class);
String mediaInfoJson = (String)redisTemplate.opsForValue().get(key);
result = JSON.parseObject(mediaInfoJson, MediaInfo.class);
}
return result;
@@ -265,7 +267,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
List<Object> keys = RedisUtil.scan(redisTemplate, scanKey);
if (keys.size() > 0) {
String key = (String) keys.get(0);
result = JsonUtil.redisJsonToObject(redisTemplate, key, MediaInfo.class);
String mediaInfoJson = (String)redisTemplate.opsForValue().get(key);
result = JSON.parseObject(mediaInfoJson, MediaInfo.class);
}
return result;

View File

@@ -335,6 +335,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
}
if (!mediaInfoList.isEmpty()) {
for (MediaInfo mediaInfo : mediaInfoList) {
if (mediaInfo == null) {
continue;
}
streamInfoPushItemMap.put(mediaInfo.getApp() + mediaInfo.getStream(), mediaInfo);
}
}