From d8d9f76d899e23befca9466bc8dd6505c7102478 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 9 Aug 2024 17:55:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9AWVP=E7=9A=84?= =?UTF-8?q?=E6=8E=A8=E6=B5=81=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/service/redisMsg/control/RedisRpcController.java | 9 +++++---- .../service/redisMsg/service/RedisRpcServiceImpl.java | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcController.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcController.java index c624b1a7..cdd4f4a9 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcController.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/control/RedisRpcController.java @@ -174,19 +174,20 @@ public class RedisRpcController { if (streamInfoInServer != null) { log.info("[redis-rpc] 监听流上线时发现流已存在直接返回: {}/{}", streamInfo.getApp(), streamInfo.getStream()); RedisRpcResponse response = request.getResponse(); - response.setBody(streamInfoInServer); + response.setBody(JSONObject.toJSONString(streamInfoInServer)); response.setStatusCode(200); return response; } // 监听流上线。 流上线直接发送sendRtpItem消息给实际的信令处理者 - Hook hook = Hook.getInstance(HookType.on_media_arrival, streamInfo.getApp(), streamInfo.getStream(), null); + Hook hook = Hook.getInstance(HookType.on_media_arrival, streamInfo.getApp(), streamInfo.getStream()); hookSubscribe.addSubscribe(hook, (hookData) -> { log.info("[redis-rpc] 监听流上线,流已上线: {}/{}", streamInfo.getApp(), streamInfo.getStream()); // 读取redis中的上级点播信息,生成sendRtpItm发送出去 RedisRpcResponse response = request.getResponse(); - response.setBody(mediaServerService.getStreamInfoByAppAndStream(hookData.getMediaServer(), + StreamInfo streamInfoByAppAndStream = mediaServerService.getStreamInfoByAppAndStream(hookData.getMediaServer(), streamInfo.getApp(), streamInfo.getStream(), hookData.getMediaInfo(), - hookData.getMediaInfo() != null ? hookData.getMediaInfo().getCallId() : null)); + hookData.getMediaInfo() != null ? hookData.getMediaInfo().getCallId() : null); + response.setBody(JSONObject.toJSONString(streamInfoByAppAndStream)); response.setStatusCode(200); // 手动发送结果 sendResponse(response); diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java index 0a748e3d..76ccfeab 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/service/RedisRpcServiceImpl.java @@ -164,6 +164,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { streamInfoParam.setStream(stream); RedisRpcRequest request = buildRequest("onStreamOnlineEvent", streamInfoParam); hookSubscribe.addSubscribe(hook, (hookData) -> { + log.info("[请求所有WVP监听流上线] 监听流上线 {}/{}", app, stream); if (callback != null) { callback.run(mediaServerService.getStreamInfoByAppAndStream(hookData.getMediaServer(), app, stream, hookData.getMediaInfo(), @@ -181,7 +182,7 @@ public class RedisRpcServiceImpl implements IRedisRpcService { log.info("[请求所有WVP监听流上线] 流上线 {}/{}", app, stream); if (callback != null) { - callback.run((StreamInfo) response.getBody()); + callback.run(JSON.parseObject(response.getBody().toString(), StreamInfo.class)); } hookSubscribe.removeSubscribe(hook); });