将device信息写入redis以提高sip处理速度
This commit is contained in:
@@ -63,4 +63,6 @@ public interface IStreamPushService {
|
||||
void zlmServerOffline(String mediaServerId);
|
||||
|
||||
void clean();
|
||||
|
||||
boolean saveToRandomGB();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
// 超时处理
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user