国标级联-修复拉流代理播放

pull/1411/head
648540858 2024-04-01 16:17:01 +08:00
parent 426ea72d7f
commit 722f1d0ee7
3 changed files with 9 additions and 5 deletions

View File

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

View File

@ -257,14 +257,13 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
public WVPResult<String> addStreamProxy(MediaServer mediaServer, String app, String stream, String url, boolean enableAudio, boolean enableMp4, String rtpType) { public WVPResult<String> addStreamProxy(MediaServer mediaServer, String app, String stream, String url, boolean enableAudio, boolean enableMp4, String rtpType) {
JSONObject jsonObject = zlmresTfulUtils.addStreamProxy(mediaServer, app, stream, url, enableAudio, enableMp4, rtpType); JSONObject jsonObject = zlmresTfulUtils.addStreamProxy(mediaServer, app, stream, url, enableAudio, enableMp4, rtpType);
if (jsonObject.getInteger("code") != 0) { if (jsonObject.getInteger("code") != 0) {
logger.warn("[addStreamProxy] 添加代理失败");
return WVPResult.fail(ErrorCode.ERROR100.getCode(), "添加代理失败"); return WVPResult.fail(ErrorCode.ERROR100.getCode(), "添加代理失败");
}else { }else {
JSONObject data = jsonObject.getJSONObject("data"); JSONObject data = jsonObject.getJSONObject("data");
if (data == null) { if (data == null) {
return WVPResult.fail(ErrorCode.ERROR100.getCode(), "代理结果异常: " + jsonObject); return WVPResult.fail(ErrorCode.ERROR100.getCode(), "代理结果异常: " + jsonObject);
}else { }else {
return WVPResult.success(""); return WVPResult.success(data.getString("key"));
} }
} }
} }

View File

@ -361,8 +361,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
result = mediaServerService.addStreamProxy(mediaServer, param.getApp(), param.getStream(), param.getUrl().trim(), result = mediaServerService.addStreamProxy(mediaServer, param.getApp(), param.getStream(), param.getUrl().trim(),
param.isEnableAudio(), param.isEnableMp4(), param.getRtpType()); param.isEnableAudio(), param.isEnableMp4(), param.getRtpType());
} }
System.out.println("addStreamProxyToZlm====");
System.out.println(result);
if (result != null && result.getCode() == 0) { if (result != null && result.getCode() == 0) {
String key = result.getData(); String key = result.getData();
if (key == null) { if (key == null) {
@ -381,6 +379,13 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
return null; return null;
} }
MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId());
if (mediaServer == null) {
return null;
}
List<StreamInfo> mediaList = mediaServerService.getMediaList(mediaServer, param.getApp(), param.getStream(), null);
if (mediaList.isEmpty()) {
return true;
}
Boolean result = false; Boolean result = false;
if ("ffmpeg".equalsIgnoreCase(param.getType())){ if ("ffmpeg".equalsIgnoreCase(param.getType())){
result = mediaServerService.delFFmpegSource(mediaServer, param.getStreamKey()); result = mediaServerService.delFFmpegSource(mediaServer, param.getStreamKey());