Commit eecffb51169300b9e226bd24bb0a0db10724a379
1 parent
edc16ec4
断流后自动清除Redis中的播放条目
Showing
1 changed file
with
15 additions
and
3 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -142,7 +142,7 @@ public class ZLMHttpHookListener { |
| 142 | 142 | storager.startPlay(streamInfoForPlay); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - StreamInfo streamInfoForPlayBack = storager.queryPlayBlackBySSRC(ssrc); | |
| 145 | + StreamInfo streamInfoForPlayBack = storager.queryPlaybackBySSRC(ssrc); | |
| 146 | 146 | if ("rtp".equals(app) && streamInfoForPlayBack != null ) { |
| 147 | 147 | MediaServerConfig mediaInfo = storager.getMediaInfo(); |
| 148 | 148 | streamInfoForPlayBack.setFlv(String.format("http://%s:%s/rtp/%s.flv", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId)); |
| ... | ... | @@ -150,7 +150,7 @@ public class ZLMHttpHookListener { |
| 150 | 150 | streamInfoForPlayBack.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtmpPort(), streamId)); |
| 151 | 151 | streamInfoForPlayBack.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId)); |
| 152 | 152 | streamInfoForPlayBack.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtspPort(), streamId)); |
| 153 | - storager.startPlayBlack(streamInfoForPlayBack); | |
| 153 | + storager.startPlayback(streamInfoForPlayBack); | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // TODO Auto-generated method stub |
| ... | ... | @@ -261,7 +261,12 @@ public class ZLMHttpHookListener { |
| 261 | 261 | String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16)); |
| 262 | 262 | StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc); |
| 263 | 263 | if ("rtp".equals(app) && !regist ) { |
| 264 | - storager.stopPlay(streamInfo); | |
| 264 | + if (streamInfo!=null){ | |
| 265 | + storager.stopPlay(streamInfo); | |
| 266 | + }else{ | |
| 267 | + streamInfo = storager.queryPlaybackBySSRC(ssrc); | |
| 268 | + storager.stopPlayback(streamInfo); | |
| 269 | + } | |
| 265 | 270 | } |
| 266 | 271 | |
| 267 | 272 | |
| ... | ... | @@ -288,6 +293,13 @@ public class ZLMHttpHookListener { |
| 288 | 293 | String ssrc = String.format("%010d", numb); |
| 289 | 294 | |
| 290 | 295 | cmder.streamByeCmd(ssrc); |
| 296 | + StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc); | |
| 297 | + if (streamInfo!=null){ | |
| 298 | + storager.stopPlay(streamInfo); | |
| 299 | + }else{ | |
| 300 | + streamInfo = storager.queryPlaybackBySSRC(ssrc); | |
| 301 | + storager.stopPlayback(streamInfo); | |
| 302 | + } | |
| 291 | 303 | |
| 292 | 304 | JSONObject ret = new JSONObject(); |
| 293 | 305 | ret.put("code", 0); | ... | ... |