mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-06-29 21:47:50 +08:00
Compare commits
4 Commits
36772969d0
...
f5de3301f2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5de3301f2 | ||
|
|
a9ad7cf5a8 | ||
|
|
b760458e4e | ||
|
|
fd3dc4dada |
@ -95,43 +95,52 @@ public class SSRCFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rebuild() {
|
void rebuild() {
|
||||||
List<MediaServer> servers = mediaServerService.getAll();
|
try {
|
||||||
for (MediaServer server : servers) {
|
List<MediaServer> servers = mediaServerService.getAll();
|
||||||
if (server.isRtpEnable() && userSetting.getSsrcRandom()) {
|
for (MediaServer server : servers) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
synchronized (lockMap.computeIfAbsent(server.getId(), k -> new Object())) {
|
|
||||||
BitSet bits = new BitSet(10000);
|
|
||||||
int count = 0;
|
|
||||||
try {
|
try {
|
||||||
ZLMResult<?> result = zlmresTfulUtils.getMediaList(server, null, null, "rtsp", null);
|
if (server.isRtpEnable() && userSetting.getSsrcRandom()) {
|
||||||
if (result != null && result.getCode() == 0 && result.getData() != null) {
|
continue;
|
||||||
List<JSONObject> list = (List<JSONObject>) result.getData();
|
|
||||||
for (JSONObject obj : list) {
|
|
||||||
if (obj.getIntValue("originType") != 3) continue;
|
|
||||||
String originUrl = obj.getString("originUrl");
|
|
||||||
if (originUrl == null) continue;
|
|
||||||
int idx = originUrl.lastIndexOf("/rtp/");
|
|
||||||
if (idx == -1) continue;
|
|
||||||
try {
|
|
||||||
int suffix = (int) (Long.parseLong(originUrl.substring(idx + 5), 16) % 10000);
|
|
||||||
bits.set(suffix);
|
|
||||||
count++;
|
|
||||||
} catch (NumberFormatException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
synchronized (lockMap.computeIfAbsent(server.getId(), k -> new Object())) {
|
||||||
log.warn("[SSRC重建] 查询媒体节点 {} 失败: {}", server.getId(), e.getMessage());
|
BitSet bits = new BitSet(10000);
|
||||||
}
|
int count = 0;
|
||||||
usedMap.put(server.getId(), bits);
|
try {
|
||||||
if (count > 8000) {
|
ZLMResult<?> result = zlmresTfulUtils.getMediaList(server, null, null, "rtsp", null);
|
||||||
log.info("[SSRC重建] 媒体节点 {} 的SSRC使用率已超过80%,请注意扩展服务提升性能", server.getId());
|
if (result != null && result.getCode() == 0 && result.getData() != null) {
|
||||||
}
|
List<JSONObject> list = (List<JSONObject>) result.getData();
|
||||||
if (log.isDebugEnabled()) {
|
for (JSONObject obj : list) {
|
||||||
log.debug("[SSRC重建] 节点 {} 已占用 {} 个SSRC", server.getId(), count);
|
if (obj.getIntValue("originType") != 3) continue;
|
||||||
|
String originUrl = obj.getString("originUrl");
|
||||||
|
if (originUrl == null) continue;
|
||||||
|
int idx = originUrl.lastIndexOf("/rtp/");
|
||||||
|
if (idx == -1) continue;
|
||||||
|
try {
|
||||||
|
int suffix = (int) (Long.parseLong(originUrl.substring(idx + 5), 16) % 10000);
|
||||||
|
bits.set(suffix);
|
||||||
|
count++;
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usedMap.put(server.getId(), bits);
|
||||||
|
if (count > 8000) {
|
||||||
|
log.info("[SSRC重建] 媒体节点 {} 的SSRC使用率已超过80%,请注意扩展服务提升性能", server.getId());
|
||||||
|
}
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("[SSRC重建] 节点 {} 已占用 {} 个SSRC", server.getId(), count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[SSRC重建] 查询媒体节点 {} 失败: {}", server.getId(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.warn("[SSRC重建] 处理媒体节点 {} 失败: {}", server.getId(), e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("[SSRC] 重建SSRC失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,10 +148,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
planArray: function(array) {
|
planArray: {
|
||||||
for (let i = 0; i < array.length; i++) {
|
handler(array) {
|
||||||
this.weekData[i].data = array[i].data
|
if (!array || !array.length) {
|
||||||
}
|
return
|
||||||
|
}
|
||||||
|
for (let i = 0; i < array.length; i++) {
|
||||||
|
this.weekData[i].data = array[i].data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user