From 937e59143004b11a808eb93eb894ffe53871a19a Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期四, 15 四月 2021 17:48:52 +0800 Subject: [PATCH] 解决串流,解决编辑上级平台却新建了的问题 --- src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 93466b3..f2579cd 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.gb28181.bean.Device; @@ -83,6 +84,13 @@ }); } else { String streamId = streamInfo.getStreamId(); + if (streamId == null) { + RequestMessage msg = new RequestMessage(); + msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid); + msg.setData(String.format("鐐规挱澶辫触锛� redis缂撳瓨streamId绛変簬null")); + resultHolder.invokeResult(msg); + return playResult; + } JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId); if (rtpInfo != null && rtpInfo.getBoolean("exist")) { RequestMessage msg = new RequestMessage(); @@ -150,8 +158,9 @@ } public StreamInfo onPublishHandler(JSONObject resonse, String deviceId, String channelId, String uuid) { - String streamId = resonse.getString("id"); - StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream("rtp", streamId); + String streamId = resonse.getString("stream"); + JSONArray tracks = resonse.getJSONArray("tracks"); + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream("rtp", streamId, tracks); streamInfo.setDeviceID(deviceId); streamInfo.setChannelId(channelId); return streamInfo; -- Gitblit v1.8.0