mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 22:47:49 +08:00
Compare commits
2 Commits
8e49008a06
...
5e9bc1fdca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9bc1fdca | ||
|
|
111274c08a |
@ -147,8 +147,8 @@ public interface PlatformChannelMapper {
|
|||||||
" <if test='query != null'> " +
|
" <if test='query != null'> " +
|
||||||
" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') OR wpgc.custom_device_id LIKE concat('%',#{query},'%') " +
|
" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') OR wpgc.custom_device_id LIKE concat('%',#{query},'%') " +
|
||||||
" OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') OR wpgc.custom_name LIKE concat('%',#{query},'%'))</if> " +
|
" OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') OR wpgc.custom_name LIKE concat('%',#{query},'%'))</if> " +
|
||||||
" <if test='online == true'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'ON'</if> " +
|
" <if test='online == true'> AND coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) = 'ON'</if> " +
|
||||||
" <if test='online == false'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF'</if> " +
|
" <if test='online == false'> AND coalesce(wpgc.custom_status, wdc.gb_status, wdc.status) = 'OFF'</if> " +
|
||||||
" <if test='hasShare == true'> AND wpgc.platform_id = #{platformId}</if> " +
|
" <if test='hasShare == true'> AND wpgc.platform_id = #{platformId}</if> " +
|
||||||
" <if test='hasShare == false'> AND wpgc.platform_id is null</if> " +
|
" <if test='hasShare == false'> AND wpgc.platform_id is null</if> " +
|
||||||
" <if test='dataType != null'> AND wdc.data_type = #{dataType}</if> " +
|
" <if test='dataType != null'> AND wdc.data_type = #{dataType}</if> " +
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate<Object, Object> redisTemplate;
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SendRtpInfo createSendRtpInfo(MediaServer mediaServer, String ip, Integer port, String ssrc, String requesterId,
|
public SendRtpInfo createSendRtpInfo(MediaServer mediaServer, String ip, Integer port, String ssrc, String requesterId,
|
||||||
@ -230,31 +230,27 @@ public class SendRtpServerServiceImpl implements ISendRtpServerService {
|
|||||||
log.warn("{}获取redis连接信息失败", mediaServer.getId());
|
log.warn("{}获取redis连接信息失败", mediaServer.getId());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return getSendPort(startPort, endPort, sendIndexKey, sendRtpSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized int getSendPort(int startPort, int endPort, String sendIndexKey, Set<Integer> sendRtpPortSet){
|
|
||||||
// TODO 这里改为只取偶数端口
|
|
||||||
RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(sendIndexKey , redisTemplate.getConnectionFactory());
|
RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(sendIndexKey , redisTemplate.getConnectionFactory());
|
||||||
if (redisAtomicInteger.get() < startPort) {
|
if (redisAtomicInteger.get() < startPort) {
|
||||||
redisAtomicInteger.set(startPort);
|
redisAtomicInteger.set(startPort);
|
||||||
return startPort;
|
return startPort;
|
||||||
}else {
|
}else {
|
||||||
int port = redisAtomicInteger.getAndIncrement();
|
for (int i = 0; i < endPort - startPort; i++) {
|
||||||
if (port > endPort) {
|
int port = redisAtomicInteger.getAndIncrement();
|
||||||
redisAtomicInteger.set(startPort);
|
if (port > endPort) {
|
||||||
if (sendRtpPortSet.contains(startPort)) {
|
redisAtomicInteger.set(startPort);
|
||||||
return getSendPort(startPort, endPort, sendIndexKey, sendRtpPortSet);
|
if (sendRtpSet.contains(startPort)) {
|
||||||
}else {
|
continue;
|
||||||
return startPort;
|
}else {
|
||||||
|
return startPort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!sendRtpSet.contains(port)) {
|
||||||
|
return port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sendRtpPortSet.contains(port)) {
|
|
||||||
return getSendPort(startPort, endPort, sendIndexKey, sendRtpPortSet);
|
|
||||||
}else {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
log.warn("{}获取发送端口失败, 无可用端口", mediaServer.getId());
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user