将device信息写入redis以提高sip处理速度

This commit is contained in:
648540858
2021-12-13 17:20:23 +08:00
parent b6fa459bc3
commit bc0319b3f3
12 changed files with 111 additions and 10 deletions

View File

@@ -63,4 +63,6 @@ public interface IStreamPushService {
void zlmServerOffline(String mediaServerId);
void clean();
boolean saveToRandomGB();
}

View File

@@ -96,7 +96,7 @@ public class PlayServiceImpl implements IPlayService {
resultHolder.invokeResult(msg);
return playResult;
}
Device device = storager.queryVideoDevice(deviceId);
Device device = redisCatchStorage.getDevice(deviceId);
StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId);
playResult.setDevice(device);
// 超时处理

View File

@@ -255,4 +255,30 @@ public class StreamPushServiceImpl implements IStreamPushService {
public void clean() {
}
@Override
public boolean saveToRandomGB() {
List<StreamPushItem> streamPushItems = streamPushMapper.selectAll();
long gbId = 100001;
for (StreamPushItem streamPushItem : streamPushItems) {
streamPushItem.setStreamType("push");
streamPushItem.setStatus(true);
streamPushItem.setGbId("34020000004111" + gbId);
gbId ++;
}
int limitCount = 30;
if (streamPushItems.size() > limitCount) {
for (int i = 0; i < streamPushItems.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > streamPushItems.size()) {
toIndex = streamPushItems.size();
}
gbStreamMapper.batchAdd(streamPushItems.subList(i, toIndex));
}
}else {
gbStreamMapper.batchAdd(streamPushItems);
}
return true;
}
}