Merge pull request #878 from callinglove/wvp-28181-2.0
修复 启用代理失败: ->缺少必要参数:"src_url","dst_url","timeout_ms"sip
commit
0c5b30e74f
|
@ -496,13 +496,13 @@ public class ZLMHttpHookListener {
|
||||||
// 拉流代理
|
// 拉流代理
|
||||||
StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
|
StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
|
||||||
if (streamProxyItem != null) {
|
if (streamProxyItem != null) {
|
||||||
if (streamProxyItem.isEnable_remove_none_reader()) {
|
if (streamProxyItem.isEnableRemoveNoneReader()) {
|
||||||
// 无人观看自动移除
|
// 无人观看自动移除
|
||||||
ret.put("close", true);
|
ret.put("close", true);
|
||||||
streamProxyService.del(param.getApp(), param.getStream());
|
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);
|
logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", param.getApp(), param.getStream(), url);
|
||||||
} else if (streamProxyItem.isEnable_disable_none_reader()) {
|
} else if (streamProxyItem.isEnableDisableNoneReader()) {
|
||||||
// 无人观看停用
|
// 无人观看停用
|
||||||
ret.put("close", true);
|
ret.put("close", true);
|
||||||
// 修改数据
|
// 修改数据
|
||||||
|
@ -587,7 +587,7 @@ public class ZLMHttpHookListener {
|
||||||
} else {
|
} else {
|
||||||
// 拉流代理
|
// 拉流代理
|
||||||
StreamProxyItem streamProxyByAppAndStream = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
|
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());
|
streamProxyService.start(param.getApp(), param.getStream());
|
||||||
}
|
}
|
||||||
DeferredResult<HookResult> result = new DeferredResult<>();
|
DeferredResult<HookResult> result = new DeferredResult<>();
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class StreamProxyItem extends GbStream {
|
||||||
@Schema(description = "流ID")
|
@Schema(description = "流ID")
|
||||||
private String stream;
|
private String stream;
|
||||||
@Schema(description = "流媒体服务ID")
|
@Schema(description = "流媒体服务ID")
|
||||||
private String mediaServerId;
|
private String media_server_id;
|
||||||
@Schema(description = "拉流地址")
|
@Schema(description = "拉流地址")
|
||||||
private String url;
|
private String url;
|
||||||
@Schema(description = "拉流地址")
|
@Schema(description = "拉流地址")
|
||||||
|
@ -41,7 +41,7 @@ public class StreamProxyItem extends GbStream {
|
||||||
@Schema(description = "是否 无人观看时自动停用")
|
@Schema(description = "是否 无人观看时自动停用")
|
||||||
private boolean enable_disable_none_reader;
|
private boolean enable_disable_none_reader;
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private String createTime;
|
private String create_time;
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
|
@ -73,12 +73,12 @@ public class StreamProxyItem extends GbStream {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMediaServerId() {
|
public String getMediaServerId() {
|
||||||
return mediaServerId;
|
return media_server_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMediaServerId(String mediaServerId) {
|
public void setMediaServerId(String mediaServerId) {
|
||||||
this.mediaServerId = mediaServerId;
|
this.media_server_id = mediaServerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
|
@ -89,43 +89,43 @@ public class StreamProxyItem extends GbStream {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSrc_url() {
|
public String getSrcUrl() {
|
||||||
return src_url;
|
return src_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSrc_url(String src_url) {
|
public void setSrcUrl(String src_url) {
|
||||||
this.src_url = src_url;
|
this.src_url = src_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDst_url() {
|
public String getDstUrl() {
|
||||||
return dst_url;
|
return dst_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDst_url(String dst_url) {
|
public void setDstUrl(String dst_url) {
|
||||||
this.dst_url = dst_url;
|
this.dst_url = dst_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeout_ms() {
|
public int getTimeoutMs() {
|
||||||
return timeout_ms;
|
return timeout_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeout_ms(int timeout_ms) {
|
public void setTimeoutMs(int timeout_ms) {
|
||||||
this.timeout_ms = timeout_ms;
|
this.timeout_ms = timeout_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFfmpeg_cmd_key() {
|
public String getFfmpegCmdKey() {
|
||||||
return ffmpeg_cmd_key;
|
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;
|
this.ffmpeg_cmd_key = ffmpeg_cmd_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRtp_type() {
|
public String getRtpType() {
|
||||||
return rtp_type;
|
return rtp_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRtp_type(String rtp_type) {
|
public void setRtpType(String rtp_type) {
|
||||||
this.rtp_type = rtp_type;
|
this.rtp_type = rtp_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,45 +137,45 @@ public class StreamProxyItem extends GbStream {
|
||||||
this.enable = enable;
|
this.enable = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnable_mp4() {
|
public boolean isEnableMp4() {
|
||||||
return enable_mp4;
|
return enable_mp4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnable_mp4(boolean enable_mp4) {
|
public void setEnableMp4(boolean enable_mp4) {
|
||||||
this.enable_mp4 = enable_mp4;
|
this.enable_mp4 = enable_mp4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCreateTime() {
|
public String getCreateTime() {
|
||||||
return createTime;
|
return create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCreateTime(String createTime) {
|
public void setCreateTime(String create_time) {
|
||||||
this.createTime = createTime;
|
this.create_time = create_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnable_remove_none_reader() {
|
public boolean isEnableRemoveNoneReader() {
|
||||||
return enable_remove_none_reader;
|
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;
|
this.enable_remove_none_reader = enable_remove_none_reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnable_disable_none_reader() {
|
public boolean isEnableDisableNoneReader() {
|
||||||
return enable_disable_none_reader;
|
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;
|
this.enable_disable_none_reader = enable_disable_none_reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnable_audio() {
|
public boolean isEnableAudio() {
|
||||||
return enable_audio;
|
return enable_audio;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnable_audio(boolean enable_audio) {
|
public void setEnableAudio(boolean enable_audio) {
|
||||||
this.enable_audio = enable_audio;
|
this.enable_audio = enable_audio;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(),
|
String dstUrl = String.format("rtmp://%s:%s/%s/%s", "127.0.0.1", mediaInfo.getRtmpPort(), param.getApp(),
|
||||||
param.getStream() );
|
param.getStream() );
|
||||||
param.setDst_url(dstUrl);
|
param.setDstUrl(dstUrl);
|
||||||
StringBuffer resultMsg = new StringBuffer();
|
StringBuffer resultMsg = new StringBuffer();
|
||||||
param.setMediaServerId(mediaInfo.getId());
|
param.setMediaServerId(mediaInfo.getId());
|
||||||
boolean saveResult;
|
boolean saveResult;
|
||||||
|
@ -127,7 +127,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||||
resultMsg.append(", 但是启用失败,请检查流地址是否可用");
|
resultMsg.append(", 但是启用失败,请检查流地址是否可用");
|
||||||
param.setEnable(false);
|
param.setEnable(false);
|
||||||
// 直接移除
|
// 直接移除
|
||||||
if (param.isEnable_remove_none_reader()) {
|
if (param.isEnableRemoveNoneReader()) {
|
||||||
del(param.getApp(), param.getStream());
|
del(param.getApp(), param.getStream());
|
||||||
}else {
|
}else {
|
||||||
updateStreamProxy(param);
|
updateStreamProxy(param);
|
||||||
|
@ -228,11 +228,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||||
}
|
}
|
||||||
if ("default".equals(param.getType())){
|
if ("default".equals(param.getType())){
|
||||||
result = zlmresTfulUtils.addStreamProxy(mediaServerItem, param.getApp(), param.getStream(), param.getUrl(),
|
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())) {
|
}else if ("ffmpeg".equals(param.getType())) {
|
||||||
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrc_url(), param.getDst_url(),
|
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrcUrl(), param.getDstUrl(),
|
||||||
param.getTimeout_ms() + "", param.isEnable_audio(), param.isEnable_mp4(),
|
param.getTimeoutMs() + "", param.isEnableAudio(), param.isEnableMp4(),
|
||||||
param.getFfmpeg_cmd_key());
|
param.getFfmpegCmdKey());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||||
updateStreamProxy(streamProxy);
|
updateStreamProxy(streamProxy);
|
||||||
}else {
|
}else {
|
||||||
logger.info("启用代理失败: {}/{}->{}({})", app, stream, jsonObject.getString("msg"),
|
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;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue