修复拉流代理相关问题
This commit is contained in:
@@ -178,11 +178,13 @@ public class StreamProxyController {
|
||||
@ResponseBody
|
||||
@Operation(summary = "启用代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "id", description = "代理Id", required = true)
|
||||
public void start(int id){
|
||||
log.info("启用代理: " + id);
|
||||
boolean result = streamProxyService.start(id);
|
||||
if (!result) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
public StreamContent start(int id){
|
||||
log.info("播放代理: " + id);
|
||||
StreamInfo streamInfo = streamProxyService.start(id);
|
||||
if (streamInfo == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg());
|
||||
}else {
|
||||
return new StreamContent(streamInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ public class StreamProxyProvider {
|
||||
}
|
||||
|
||||
public String selectForEnableInMediaServer(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + String.format(" WHERE st.enable=%s and st.media_server_id= %s order by st.create_time desc",
|
||||
return getBaseSelectSql() + String.format(" WHERE st.enable=%s and st.media_server_id= '%s' order by st.create_time desc",
|
||||
params.get("enable"), params.get("mediaServerId"));
|
||||
}
|
||||
|
||||
public String selectOneByAppAndStream(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + String.format(" WHERE st.app=%s AND st.stream=%s order by st.create_time desc",
|
||||
return getBaseSelectSql() + String.format(" WHERE st.app='%s' AND st.stream='%s' order by st.create_time desc",
|
||||
params.get("app"), params.get("stream"));
|
||||
}
|
||||
|
||||
|
||||
@@ -93,5 +93,5 @@ public interface IStreamProxyService {
|
||||
|
||||
void delete(int id);
|
||||
|
||||
boolean start(int id);
|
||||
StreamInfo start(int id);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,8 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
}
|
||||
|
||||
private void delete(StreamProxy streamProxy) {
|
||||
if (streamProxy.getPulling()) {
|
||||
assert streamProxy != null;
|
||||
if (streamProxy.getPulling() != null && streamProxy.getPulling()) {
|
||||
stopProxy(streamProxy);
|
||||
}
|
||||
if(streamProxy.getGbId() > 0) {
|
||||
@@ -441,13 +442,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean start(int id) {
|
||||
public StreamInfo start(int id) {
|
||||
StreamProxy streamProxy = streamProxyMapper.select(id);
|
||||
if (streamProxy == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
|
||||
}
|
||||
StreamInfo streamInfo = startProxy(streamProxy);
|
||||
return streamInfo != null;
|
||||
return startProxy(streamProxy);
|
||||
}
|
||||
|
||||
private StreamInfo startProxy(StreamProxy streamProxy){
|
||||
|
||||
Reference in New Issue
Block a user