From eecffb51169300b9e226bd24bb0a0db10724a379 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 29 Oct 2020 10:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=AD=E6=B5=81=E5=90=8E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=B8=85=E9=99=A4Redis=E4=B8=AD=E7=9A=84=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=9D=A1=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/media/zlm/ZLMHttpHookListener.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 6fd4cf5b..bb111a38 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -142,7 +142,7 @@ public class ZLMHttpHookListener { storager.startPlay(streamInfoForPlay); } - StreamInfo streamInfoForPlayBack = storager.queryPlayBlackBySSRC(ssrc); + StreamInfo streamInfoForPlayBack = storager.queryPlaybackBySSRC(ssrc); if ("rtp".equals(app) && streamInfoForPlayBack != null ) { MediaServerConfig mediaInfo = storager.getMediaInfo(); streamInfoForPlayBack.setFlv(String.format("http://%s:%s/rtp/%s.flv", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId)); @@ -150,7 +150,7 @@ public class ZLMHttpHookListener { streamInfoForPlayBack.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtmpPort(), streamId)); streamInfoForPlayBack.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId)); streamInfoForPlayBack.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtspPort(), streamId)); - storager.startPlayBlack(streamInfoForPlayBack); + storager.startPlayback(streamInfoForPlayBack); } // TODO Auto-generated method stub @@ -261,7 +261,12 @@ public class ZLMHttpHookListener { String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16)); StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc); if ("rtp".equals(app) && !regist ) { - storager.stopPlay(streamInfo); + if (streamInfo!=null){ + storager.stopPlay(streamInfo); + }else{ + streamInfo = storager.queryPlaybackBySSRC(ssrc); + storager.stopPlayback(streamInfo); + } } @@ -288,6 +293,13 @@ public class ZLMHttpHookListener { String ssrc = String.format("%010d", numb); cmder.streamByeCmd(ssrc); + StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc); + if (streamInfo!=null){ + storager.stopPlay(streamInfo); + }else{ + streamInfo = storager.queryPlaybackBySSRC(ssrc); + storager.stopPlayback(streamInfo); + } JSONObject ret = new JSONObject(); ret.put("code", 0);