修复 启用代理失败: ->缺少必要参数:"src_url","dst_url","timeout_ms"

pull/878/head
yanggs 2023-06-01 13:30:48 +08:00
parent 314423bd01
commit 51c19c397d
3 changed files with 36 additions and 36 deletions

View File

@ -496,13 +496,13 @@ public class ZLMHttpHookListener {
// 拉流代理
StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
if (streamProxyItem != null) {
if (streamProxyItem.isEnable_remove_none_reader()) {
if (streamProxyItem.isEnableRemoveNoneReader()) {
// 无人观看自动移除
ret.put("close", true);
streamProxyService.del(param.getApp(), param.getStream());
String url = streamProxyItem.getUrl() != null ? streamProxyItem.getUrl() : streamProxyItem.getSrc_url();
String url = streamProxyItem.getUrl() != null ? streamProxyItem.getUrl() : streamProxyItem.getSrcUrl();
logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", param.getApp(), param.getStream(), url);
} else if (streamProxyItem.isEnable_disable_none_reader()) {
} else if (streamProxyItem.isEnableDisableNoneReader()) {
// 无人观看停用
ret.put("close", true);
// 修改数据
@ -587,7 +587,7 @@ public class ZLMHttpHookListener {
} else {
// 拉流代理
StreamProxyItem streamProxyByAppAndStream = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
if (streamProxyByAppAndStream != null && streamProxyByAppAndStream.isEnable_disable_none_reader()) {
if (streamProxyByAppAndStream != null && streamProxyByAppAndStream.isEnableDisableNoneReader()) {
streamProxyService.start(param.getApp(), param.getStream());
}
DeferredResult<HookResult> result = new DeferredResult<>();

View File

@ -16,7 +16,7 @@ public class StreamProxyItem extends GbStream {
@Schema(description = "流ID")
private String stream;
@Schema(description = "流媒体服务ID")
private String mediaServerId;
private String media_server_id;
@Schema(description = "拉流地址")
private String url;
@Schema(description = "拉流地址")
@ -41,7 +41,7 @@ public class StreamProxyItem extends GbStream {
@Schema(description = "是否 无人观看时自动停用")
private boolean enable_disable_none_reader;
@Schema(description = "创建时间")
private String createTime;
private String create_time;
public String getType() {
return type;
@ -73,12 +73,12 @@ public class StreamProxyItem extends GbStream {
@Override
public String getMediaServerId() {
return mediaServerId;
return media_server_id;
}
@Override
public void setMediaServerId(String mediaServerId) {
this.mediaServerId = mediaServerId;
this.media_server_id = mediaServerId;
}
public String getUrl() {
@ -89,43 +89,43 @@ public class StreamProxyItem extends GbStream {
this.url = url;
}
public String getSrc_url() {
public String getSrcUrl() {
return src_url;
}
public void setSrc_url(String src_url) {
public void setSrcUrl(String src_url) {
this.src_url = src_url;
}
public String getDst_url() {
public String getDstUrl() {
return dst_url;
}
public void setDst_url(String dst_url) {
public void setDstUrl(String dst_url) {
this.dst_url = dst_url;
}
public int getTimeout_ms() {
public int getTimeoutMs() {
return timeout_ms;
}
public void setTimeout_ms(int timeout_ms) {
public void setTimeoutMs(int timeout_ms) {
this.timeout_ms = timeout_ms;
}
public String getFfmpeg_cmd_key() {
public String getFfmpegCmdKey() {
return ffmpeg_cmd_key;
}
public void setFfmpeg_cmd_key(String ffmpeg_cmd_key) {
public void setFfmpegCmdKey(String ffmpeg_cmd_key) {
this.ffmpeg_cmd_key = ffmpeg_cmd_key;
}
public String getRtp_type() {
public String getRtpType() {
return rtp_type;
}
public void setRtp_type(String rtp_type) {
public void setRtpType(String rtp_type) {
this.rtp_type = rtp_type;
}
@ -137,45 +137,45 @@ public class StreamProxyItem extends GbStream {
this.enable = enable;
}
public boolean isEnable_mp4() {
public boolean isEnableMp4() {
return enable_mp4;
}
public void setEnable_mp4(boolean enable_mp4) {
public void setEnableMp4(boolean enable_mp4) {
this.enable_mp4 = enable_mp4;
}
@Override
public String getCreateTime() {
return createTime;
return create_time;
}
@Override
public void setCreateTime(String createTime) {
this.createTime = createTime;
public void setCreateTime(String create_time) {
this.create_time = create_time;
}
public boolean isEnable_remove_none_reader() {
public boolean isEnableRemoveNoneReader() {
return enable_remove_none_reader;
}
public void setEnable_remove_none_reader(boolean enable_remove_none_reader) {
public void setEnableRemoveNoneReader(boolean enable_remove_none_reader) {
this.enable_remove_none_reader = enable_remove_none_reader;
}
public boolean isEnable_disable_none_reader() {
public boolean isEnableDisableNoneReader() {
return enable_disable_none_reader;
}
public void setEnable_disable_none_reader(boolean enable_disable_none_reader) {
public void setEnableDisableNoneReader(boolean enable_disable_none_reader) {
this.enable_disable_none_reader = enable_disable_none_reader;
}
public boolean isEnable_audio() {
public boolean isEnableAudio() {
return enable_audio;
}
public void setEnable_audio(boolean enable_audio) {
public void setEnableAudio(boolean enable_audio) {
this.enable_audio = enable_audio;
}
}

View File

@ -106,7 +106,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
String dstUrl = String.format("rtmp://%s:%s/%s/%s", "127.0.0.1", mediaInfo.getRtmpPort(), param.getApp(),
param.getStream() );
param.setDst_url(dstUrl);
param.setDstUrl(dstUrl);
StringBuffer resultMsg = new StringBuffer();
param.setMediaServerId(mediaInfo.getId());
boolean saveResult;
@ -127,7 +127,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
resultMsg.append(", 但是启用失败,请检查流地址是否可用");
param.setEnable(false);
// 直接移除
if (param.isEnable_remove_none_reader()) {
if (param.isEnableRemoveNoneReader()) {
del(param.getApp(), param.getStream());
}else {
updateStreamProxy(param);
@ -228,11 +228,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
if ("default".equals(param.getType())){
result = zlmresTfulUtils.addStreamProxy(mediaServerItem, param.getApp(), param.getStream(), param.getUrl(),
param.isEnable_audio(), param.isEnable_mp4(), param.getRtp_type());
param.isEnableAudio(), param.isEnableMp4(), param.getRtpType());
}else if ("ffmpeg".equals(param.getType())) {
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrc_url(), param.getDst_url(),
param.getTimeout_ms() + "", param.isEnable_audio(), param.isEnable_mp4(),
param.getFfmpeg_cmd_key());
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrcUrl(), param.getDstUrl(),
param.getTimeoutMs() + "", param.isEnableAudio(), param.isEnableMp4(),
param.getFfmpegCmdKey());
}
return result;
}
@ -286,7 +286,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
updateStreamProxy(streamProxy);
}else {
logger.info("启用代理失败: {}/{}->{}({})", app, stream, jsonObject.getString("msg"),
streamProxy.getSrc_url() == null? streamProxy.getUrl():streamProxy.getSrc_url());
streamProxy.getSrcUrl() == null? streamProxy.getUrl():streamProxy.getSrcUrl());
}
}
return result;