[RPC] 添加拉流代理支持

This commit is contained in:
648540858
2024-12-31 11:19:01 +08:00
parent 26ee38aebe
commit a324e4c95a
7 changed files with 150 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcPlayService;
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
@@ -31,6 +32,9 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
@Autowired
private UserSetting userSetting;
@Autowired
private IRedisRpcPlayService redisRpcPlayService;
@Override
public StreamInfo start(int id) {
StreamProxy streamProxy = streamProxyMapper.select(id);
@@ -47,7 +51,7 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
return null;
}
if (!userSetting.getServerId().equals(streamProxy.getServerId())) {
return redisRpcService.play(id, callback);
return redisRpcPlayService.playProxy(streamProxy.getServerId(), streamProxy.getId());
}
MediaServer mediaServer;
@@ -74,6 +78,9 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
if (streamProxy == null) {
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
}
if (!userSetting.getServerId().equals(streamProxy.getServerId())) {
redisRpcPlayService.stopProxy(streamProxy.getServerId(), streamProxy.getId());
}
stopProxy(streamProxy);
}