临时提交
parent
6dc64c05ee
commit
7e89b5f97f
|
@ -33,6 +33,9 @@ public class StreamProxy extends CommonGBChannel {
|
||||||
@Schema(description = "流媒体服务ID")
|
@Schema(description = "流媒体服务ID")
|
||||||
private String mediaServerId;
|
private String mediaServerId;
|
||||||
|
|
||||||
|
@Schema(description = "服务ID")
|
||||||
|
private String serverId;
|
||||||
|
|
||||||
@Schema(description = "拉流地址")
|
@Schema(description = "拉流地址")
|
||||||
private String srcUrl;
|
private String srcUrl;
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,12 @@ public class StreamProxyParam {
|
||||||
private boolean enableDisableNoneReader;
|
private boolean enableDisableNoneReader;
|
||||||
|
|
||||||
|
|
||||||
public StreamProxy buildStreamProxy() {
|
public StreamProxy buildStreamProxy(String serverId) {
|
||||||
StreamProxy streamProxy = new StreamProxy();
|
StreamProxy streamProxy = new StreamProxy();
|
||||||
streamProxy.setApp(app);
|
streamProxy.setApp(app);
|
||||||
streamProxy.setStream(stream);
|
streamProxy.setStream(stream);
|
||||||
streamProxy.setMediaServerId(mediaServerId);
|
streamProxy.setMediaServerId(mediaServerId);
|
||||||
|
streamProxy.setServerId(serverId);
|
||||||
streamProxy.setSrcUrl(url);
|
streamProxy.setSrcUrl(url);
|
||||||
streamProxy.setTimeout(timeoutMs/1000);
|
streamProxy.setTimeout(timeoutMs/1000);
|
||||||
streamProxy.setRtspType(rtpType);
|
streamProxy.setRtspType(rtpType);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.streamProxy.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
|
@ -19,7 +20,6 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ public class StreamProxyController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IStreamProxyPlayService streamProxyPlayService;
|
private IStreamProxyPlayService streamProxyPlayService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSetting userSetting;
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "分页查询流代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "分页查询流代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "page", description = "当前页")
|
@Parameter(name = "page", description = "当前页")
|
||||||
|
@ -121,6 +124,7 @@ public class StreamProxyController {
|
||||||
if (ObjectUtils.isEmpty(param.getGbId())) {
|
if (ObjectUtils.isEmpty(param.getGbId())) {
|
||||||
param.setGbDeviceId(null);
|
param.setGbDeviceId(null);
|
||||||
}
|
}
|
||||||
|
param.setServerId(userSetting.getServerId());
|
||||||
streamProxyService.add(param);
|
streamProxyService.add(param);
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.genersoft.iot.vmp.streamProxy.service.impl;
|
package com.genersoft.iot.vmp.streamProxy.service.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||||
|
@ -27,12 +28,16 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMediaServerService mediaServerService;
|
private IMediaServerService mediaServerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserSetting userSetting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo start(int id) {
|
public StreamInfo start(int id) {
|
||||||
StreamProxy streamProxy = streamProxyMapper.select(id);
|
StreamProxy streamProxy = streamProxyMapper.select(id);
|
||||||
if (streamProxy == null) {
|
if (streamProxy == null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
|
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
|
||||||
}
|
}
|
||||||
|
|
||||||
return startProxy(streamProxy);
|
return startProxy(streamProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +46,10 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
|
||||||
if (!streamProxy.isEnable()) {
|
if (!streamProxy.isEnable()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (!userSetting.getServerId().equals(streamProxy.getServerId())) {
|
||||||
|
return redisRpcService.play(id, callback);
|
||||||
|
}
|
||||||
|
|
||||||
MediaServer mediaServer;
|
MediaServer mediaServer;
|
||||||
String mediaServerId = streamProxy.getMediaServerId();
|
String mediaServerId = streamProxy.getMediaServerId();
|
||||||
if (mediaServerId == null) {
|
if (mediaServerId == null) {
|
||||||
|
@ -86,9 +95,6 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
|
||||||
}else {
|
}else {
|
||||||
mediaServerService.stopProxy(mediaServer, streamProxy.getStreamKey());
|
mediaServerService.stopProxy(mediaServer, streamProxy.getStreamKey());
|
||||||
}
|
}
|
||||||
streamProxy.setMediaServerId(mediaServer.getId());
|
|
||||||
streamProxy.setStreamKey(null);
|
|
||||||
streamProxy.setPulling(false);
|
|
||||||
streamProxyMapper.removeStream(streamProxy.getId());
|
streamProxyMapper.removeStream(streamProxy.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||||
if (param.getMediaServerId().equals("auto")) {
|
if (param.getMediaServerId().equals("auto")) {
|
||||||
param.setMediaServerId(null);
|
param.setMediaServerId(null);
|
||||||
}
|
}
|
||||||
StreamProxy streamProxy = param.buildStreamProxy();
|
StreamProxy streamProxy = param.buildStreamProxy(userSetting.getServerId());
|
||||||
|
|
||||||
if (streamProxyInDb == null) {
|
if (streamProxyInDb == null) {
|
||||||
add(streamProxy);
|
add(streamProxy);
|
||||||
|
|
|
@ -29,7 +29,6 @@ create table wvp_device
|
||||||
custom_name character varying(255),
|
custom_name character varying(255),
|
||||||
sdp_ip character varying(50),
|
sdp_ip character varying(50),
|
||||||
local_ip character varying(50),
|
local_ip character varying(50),
|
||||||
server_id character varying(50),
|
|
||||||
password character varying(255),
|
password character varying(255),
|
||||||
as_message_channel bool default false,
|
as_message_channel bool default false,
|
||||||
keepalive_interval_time integer,
|
keepalive_interval_time integer,
|
||||||
|
@ -309,6 +308,7 @@ create table wvp_stream_proxy
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
update_time character varying(50),
|
update_time character varying(50),
|
||||||
stream_key character varying(255),
|
stream_key character varying(255),
|
||||||
|
server_id character varying(50),
|
||||||
enable_disable_none_reader bool default false,
|
enable_disable_none_reader bool default false,
|
||||||
constraint uk_stream_proxy_app_stream unique (app, stream)
|
constraint uk_stream_proxy_app_stream unique (app, stream)
|
||||||
);
|
);
|
||||||
|
|
|
@ -325,6 +325,7 @@ create table wvp_stream_proxy
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
update_time character varying(50),
|
update_time character varying(50),
|
||||||
stream_key character varying(255),
|
stream_key character varying(255),
|
||||||
|
server_id character varying(50),
|
||||||
enable_disable_none_reader bool default false,
|
enable_disable_none_reader bool default false,
|
||||||
constraint uk_stream_proxy_app_stream unique (app, stream)
|
constraint uk_stream_proxy_app_stream unique (app, stream)
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
/*
|
||||||
|
* WVP RPC 调用
|
||||||
|
*/
|
||||||
|
alter table wvp_device add server_id character varying(50);
|
||||||
|
alter table wvp_media_server add server_id character varying(50);
|
||||||
|
alter table wvp_stream_proxy add server_id character varying(50);
|
Loading…
Reference in New Issue