临时提交

This commit is contained in:
648540858
2024-09-25 15:42:04 +08:00
parent abcaa32cec
commit 76d3a5d8e4
8 changed files with 41 additions and 40 deletions

View File

@@ -7,17 +7,17 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
public interface IRedisRpcService {
SendRtpInfo getSendRtpItem(Integer sendRtpChannelId);
SendRtpInfo getSendRtpItem(String callId);
WVPResult startSendRtp(Integer sendRtpChannelId, SendRtpInfo sendRtpItem);
WVPResult startSendRtp(String callId, SendRtpInfo sendRtpItem);
WVPResult stopSendRtp(Integer sendRtpChannelId);
WVPResult stopSendRtp(String callId);
long waitePushStreamOnline(SendRtpInfo sendRtpItem, CommonCallback<Integer> callback);
void stopWaitePushStreamOnline(SendRtpInfo sendRtpItem);
void rtpSendStopped(Integer sendRtpChannelId);
void rtpSendStopped(String callId);
void removeCallback(long key);

View File

@@ -9,7 +9,6 @@ import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcMessage;
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcRequest;
import com.genersoft.iot.vmp.conf.redis.bean.RedisRpcResponse;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.media.bean.MediaInfo;
@@ -20,7 +19,6 @@ import com.genersoft.iot.vmp.media.event.hook.HookType;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
import com.genersoft.iot.vmp.service.ISendRtpServerService;
import com.genersoft.iot.vmp.service.impl.SendRtpServerServiceImpl;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
@@ -61,9 +59,6 @@ public class RedisRpcController {
@Autowired
private ISIPCommanderForPlatform commanderFroPlatform;
@Autowired
private IPlatformService platformService;
@Autowired
private ISendRtpServerService sendRtpServerService;
@@ -72,10 +67,10 @@ public class RedisRpcController {
* 获取发流的信息
*/
public RedisRpcResponse getSendRtpItem(RedisRpcRequest request) {
String sendRtpItemKey = request.getParam().toString();
SendRtpInfo sendRtpItem = (SendRtpInfo) redisTemplate.opsForValue().get(sendRtpItemKey);
String callId = request.getParam().toString();
SendRtpInfo sendRtpItem = sendRtpServerService.queryByCallId(callId);
if (sendRtpItem == null) {
log.info("[redis-rpc] 获取发流的信息, 未找到redis中的发流信息 key{}", sendRtpItemKey);
log.info("[redis-rpc] 获取发流的信息, 未找到redis中的发流信息 callId{}", callId);
RedisRpcResponse response = request.getResponse();
response.setStatusCode(200);
return response;
@@ -104,10 +99,9 @@ public class RedisRpcController {
sendRtpItem.setSsrc(ssrc);
}
sendRtpServerService.update(sendRtpItem);
redisTemplate.opsForValue().set(sendRtpItemKey, sendRtpItem);
RedisRpcResponse response = request.getResponse();
response.setStatusCode(200);
response.setBody(sendRtpItemKey);
response.setBody(callId);
return response;
}
@@ -228,12 +222,12 @@ public class RedisRpcController {
* 开始发流
*/
public RedisRpcResponse startSendRtp(RedisRpcRequest request) {
String sendRtpItemKey = request.getParam().toString();
SendRtpInfo sendRtpItem = (SendRtpInfo) redisTemplate.opsForValue().get(sendRtpItemKey);
String callId = request.getParam().toString();
SendRtpInfo sendRtpItem = sendRtpServerService.queryByCallId(callId);
RedisRpcResponse response = request.getResponse();
response.setStatusCode(200);
if (sendRtpItem == null) {
log.info("[redis-rpc] 开始发流, 未找到redis中的发流信息 key{}", sendRtpItemKey);
log.info("[redis-rpc] 开始发流, 未找到redis中的发流信息 callId{}", callId);
WVPResult wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "未找到redis中的发流信息");
response.setBody(wvpResult);
return response;
@@ -271,12 +265,12 @@ public class RedisRpcController {
* 停止发流
*/
public RedisRpcResponse stopSendRtp(RedisRpcRequest request) {
String sendRtpItemKey = request.getParam().toString();
SendRtpInfo sendRtpItem = (SendRtpInfo) redisTemplate.opsForValue().get(sendRtpItemKey);
String callId = request.getParam().toString();
SendRtpInfo sendRtpItem = sendRtpServerService.queryByCallId(callId);
RedisRpcResponse response = request.getResponse();
response.setStatusCode(200);
if (sendRtpItem == null) {
log.info("[redis-rpc] 停止推流, 未找到redis中的发流信息 key{}", sendRtpItemKey);
log.info("[redis-rpc] 停止推流, 未找到redis中的发流信息 key{}", callId);
WVPResult wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "未找到redis中的发流信息");
response.setBody(wvpResult);
return response;

View File

@@ -57,8 +57,8 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public SendRtpInfo getSendRtpItem(Integer sendRtpItemKey) {
RedisRpcRequest request = buildRequest("getSendRtpItem", sendRtpItemKey);
public SendRtpInfo getSendRtpItem(String callId) {
RedisRpcRequest request = buildRequest("getSendRtpItem", callId);
RedisRpcResponse response = redisRpcConfig.request(request, 10);
if (response.getBody() == null) {
return null;
@@ -67,23 +67,23 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public WVPResult startSendRtp(Integer sendRtpItemKey, SendRtpInfo sendRtpItem) {
public WVPResult startSendRtp(String callId, SendRtpInfo sendRtpItem) {
log.info("[请求其他WVP] 开始推流wvp{} {}/{}", sendRtpItem.getServerId(), sendRtpItem.getApp(), sendRtpItem.getStream());
RedisRpcRequest request = buildRequest("startSendRtp", sendRtpItemKey);
RedisRpcRequest request = buildRequest("startSendRtp", callId);
request.setToId(sendRtpItem.getServerId());
RedisRpcResponse response = redisRpcConfig.request(request, 10);
return JSON.parseObject(response.getBody().toString(), WVPResult.class);
}
@Override
public WVPResult stopSendRtp(Integer sendRtpItemKey) {
SendRtpInfo sendRtpItem = (SendRtpInfo)redisTemplate.opsForValue().get(sendRtpItemKey);
public WVPResult stopSendRtp(String callId) {
SendRtpInfo sendRtpItem = (SendRtpInfo)redisTemplate.opsForValue().get(callId);
if (sendRtpItem == null) {
log.info("[请求其他WVP] 停止推流, 未找到redis中的发流信息 key{}", sendRtpItemKey);
log.info("[请求其他WVP] 停止推流, 未找到redis中的发流信息 key{}", callId);
return WVPResult.fail(ErrorCode.ERROR100.getCode(), "未找到发流信息");
}
log.info("[请求其他WVP] 停止推流wvp{} {}/{}", sendRtpItem.getServerId(), sendRtpItem.getApp(), sendRtpItem.getStream());
RedisRpcRequest request = buildRequest("stopSendRtp", sendRtpItemKey);
RedisRpcRequest request = buildRequest("stopSendRtp", callId);
request.setToId(sendRtpItem.getServerId());
RedisRpcResponse response = redisRpcConfig.request(request, 10);
return JSON.parseObject(response.getBody().toString(), WVPResult.class);
@@ -141,13 +141,13 @@ public class RedisRpcServiceImpl implements IRedisRpcService {
}
@Override
public void rtpSendStopped(Integer sendRtpItemKey) {
SendRtpInfo sendRtpItem = (SendRtpInfo)redisTemplate.opsForValue().get(sendRtpItemKey);
public void rtpSendStopped(String callId) {
SendRtpInfo sendRtpItem = (SendRtpInfo)redisTemplate.opsForValue().get(callId);
if (sendRtpItem == null) {
log.info("[停止WVP监听流上线] 未找到redis中的发流信息 key{}", sendRtpItemKey);
log.info("[停止WVP监听流上线] 未找到redis中的发流信息 key{}", callId);
return;
}
RedisRpcRequest request = buildRequest("rtpSendStopped", sendRtpItemKey);
RedisRpcRequest request = buildRequest("rtpSendStopped", callId);
request.setToId(sendRtpItem.getServerId());
redisRpcConfig.request(request, 10);
}