修复国标录像下载

This commit is contained in:
648540858
2024-09-10 16:50:54 +08:00
parent 7cc4c9d14a
commit 3140672e63
13 changed files with 163 additions and 112 deletions

View File

@@ -6,6 +6,8 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -21,6 +23,7 @@ public class HookSubscribe {
*/
private final long subscribeExpire = 5 * 60 * 1000;
@FunctionalInterface
public interface Event{
void response(HookData data);
@@ -75,12 +78,11 @@ public class HookSubscribe {
if (hookSubscribeEvent != null) {
HookData data = HookData.getInstance(event);
hookSubscribeEvent.response(data);
}else {
}
}
public void addSubscribe(Hook hook, HookSubscribe.Event event) {
System.out.println("add==" + hook.toString());
if (hook.getExpireTime() == null) {
hook.setExpireTime(System.currentTimeMillis() + subscribeExpire);
}
@@ -106,4 +108,8 @@ public class HookSubscribe {
}
}
}
public List<Hook> getAll() {
return new ArrayList<>(allHook.values());
}
}

View File

@@ -82,7 +82,9 @@ public class ZLMHttpHookListener {
log.info("[ZLM HOOK] 播放鉴权 失败:{}->{}", param.getMediaServerId(), param);
return new HookResult(401, "Unauthorized");
}
log.info("[ZLM HOOK] 播放鉴权成功:{}->{}", param.getMediaServerId(), param);
if (log.isDebugEnabled()){
log.debug("[ZLM HOOK] 播放鉴权成功:{}->{}", param.getMediaServerId(), param);
}
return HookResult.SUCCESS();
}

View File

@@ -179,7 +179,9 @@ public class ZLMRESTfulUtils {
Request request = new Request.Builder()
.url(httpBuilder.build())
.build();
log.info(request.toString());
if (log.isDebugEnabled()){
log.debug(request.toString());
}
try {
OkHttpClient client = getClient();
Response response = client.newCall(request).execute();

View File

@@ -39,7 +39,6 @@ public class ZLMServerFactory {
int result = -1;
// 查询此rtp server 是否已经存在
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId);
log.info(JSONObject.toJSONString(rtpInfo));
if(rtpInfo.getInteger("code") == 0){
if (rtpInfo.getBoolean("exist")) {
result = rtpInfo.getInteger("local_port");
@@ -87,7 +86,6 @@ public class ZLMServerFactory {
}
JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param);
log.info(JSONObject.toJSONString(openRtpServerResultJson));
if (openRtpServerResultJson != null) {
if (openRtpServerResultJson.getInteger("code") == 0) {
result= openRtpServerResultJson.getInteger("port");