Commit ab13017117b18427bb5ee687c9a1b3fd5a94f2ae
1 parent
6e67b190
处理空指针
Showing
3 changed files
with
17 additions
and
15 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java
| @@ -48,6 +48,7 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor { | @@ -48,6 +48,7 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 48 | String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser(); | 48 | String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser(); |
| 49 | String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser(); | 49 | String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser(); |
| 50 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId); | 50 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId); |
| 51 | + if (sendRtpItem == null) return; | ||
| 51 | String streamId = sendRtpItem.getStreamId(); | 52 | String streamId = sendRtpItem.getStreamId(); |
| 52 | Map<String, Object> param = new HashMap<>(); | 53 | Map<String, Object> param = new HashMap<>(); |
| 53 | param.put("vhost","__defaultVhost__"); | 54 | param.put("vhost","__defaultVhost__"); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -295,25 +295,26 @@ public class ZLMHttpHookListener { | @@ -295,25 +295,26 @@ public class ZLMHttpHookListener { | ||
| 295 | 295 | ||
| 296 | String streamId = json.getString("stream"); | 296 | String streamId = json.getString("stream"); |
| 297 | String app = json.getString("app"); | 297 | String app = json.getString("app"); |
| 298 | - StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); | ||
| 299 | - | ||
| 300 | 298 | ||
| 301 | if ("rtp".equals(app)){ | 299 | if ("rtp".equals(app)){ |
| 302 | JSONObject ret = new JSONObject(); | 300 | JSONObject ret = new JSONObject(); |
| 303 | ret.put("code", 0); | 301 | ret.put("code", 0); |
| 304 | ret.put("close", true); | 302 | ret.put("close", true); |
| 305 | - if (streamInfo != null) { | ||
| 306 | - if (redisCatchStorage.isChannelSendingRTP(streamInfo.getChannelId())) { | 303 | + StreamInfo streamInfoForPlayCatch = redisCatchStorage.queryPlayByStreamId(streamId); |
| 304 | + if (streamInfoForPlayCatch != null) { | ||
| 305 | + if (redisCatchStorage.isChannelSendingRTP(streamInfoForPlayCatch.getChannelId())) { | ||
| 307 | ret.put("close", false); | 306 | ret.put("close", false); |
| 308 | } else { | 307 | } else { |
| 309 | - cmder.streamByeCmd(streamInfo.getDeviceID(), streamInfo.getChannelId()); | ||
| 310 | - redisCatchStorage.stopPlay(streamInfo); | ||
| 311 | - storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | 308 | + cmder.streamByeCmd(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId()); |
| 309 | + redisCatchStorage.stopPlay(streamInfoForPlayCatch); | ||
| 310 | + storager.stopPlay(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId()); | ||
| 312 | } | 311 | } |
| 313 | }else{ | 312 | }else{ |
| 314 | - cmder.streamByeCmd(streamInfo.getDeviceID(), streamInfo.getChannelId()); | ||
| 315 | - streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId); | ||
| 316 | - redisCatchStorage.stopPlayback(streamInfo); | 313 | + StreamInfo streamInfoForPlayBackCatch = redisCatchStorage.queryPlaybackByStreamId(streamId); |
| 314 | + if (streamInfoForPlayBackCatch != null) { | ||
| 315 | + cmder.streamByeCmd(streamInfoForPlayBackCatch.getDeviceID(), streamInfoForPlayBackCatch.getChannelId()); | ||
| 316 | + redisCatchStorage.stopPlayback(streamInfoForPlayBackCatch); | ||
| 317 | + } | ||
| 317 | } | 318 | } |
| 318 | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); | 319 | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); |
| 319 | }else { | 320 | }else { |
web_src/src/components/dialog/StreamProxyEdit.vue
| @@ -62,14 +62,14 @@ | @@ -62,14 +62,14 @@ | ||
| 62 | <el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox> | 62 | <el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox> |
| 63 | <el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox> | 63 | <el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox> |
| 64 | </div> | 64 | </div> |
| 65 | - | 65 | + |
| 66 | </el-form-item> | 66 | </el-form-item> |
| 67 | <el-form-item> | 67 | <el-form-item> |
| 68 | <div style="float: right;"> | 68 | <div style="float: right;"> |
| 69 | <el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button> | 69 | <el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button> |
| 70 | <el-button @click="close">取消</el-button> | 70 | <el-button @click="close">取消</el-button> |
| 71 | </div> | 71 | </div> |
| 72 | - | 72 | + |
| 73 | </el-form-item> | 73 | </el-form-item> |
| 74 | </el-form> | 74 | </el-form> |
| 75 | </div> | 75 | </div> |
| @@ -110,7 +110,7 @@ export default { | @@ -110,7 +110,7 @@ export default { | ||
| 110 | type: "default", | 110 | type: "default", |
| 111 | app: null, | 111 | app: null, |
| 112 | stream: null, | 112 | stream: null, |
| 113 | - url: "rtmp://58.200.131.2:1935/livetv/hunantv", | 113 | + url: "rtmp://58.200.131.2/livetv/cctv5hd", |
| 114 | src_url: null, | 114 | src_url: null, |
| 115 | timeout_ms: null, | 115 | timeout_ms: null, |
| 116 | ffmpeg_cmd_key: null, | 116 | ffmpeg_cmd_key: null, |
| @@ -120,7 +120,7 @@ export default { | @@ -120,7 +120,7 @@ export default { | ||
| 120 | enable_hls: true, | 120 | enable_hls: true, |
| 121 | enable_mp4: false, | 121 | enable_mp4: false, |
| 122 | }, | 122 | }, |
| 123 | - | 123 | + |
| 124 | rules: { | 124 | rules: { |
| 125 | name: [{ required: true, message: "请输入名称", trigger: "blur" }], | 125 | name: [{ required: true, message: "请输入名称", trigger: "blur" }], |
| 126 | app: [{ required: true, message: "请输入应用名", trigger: "blur" }], | 126 | app: [{ required: true, message: "请输入应用名", trigger: "blur" }], |
| @@ -148,7 +148,7 @@ export default { | @@ -148,7 +148,7 @@ export default { | ||
| 148 | var that = this; | 148 | var that = this; |
| 149 | that.$axios({ | 149 | that.$axios({ |
| 150 | method: 'post', | 150 | method: 'post', |
| 151 | - url:`/api/proxy/save`, | 151 | + url:`/api/proxy/save`, |
| 152 | data: that.proxyParam | 152 | data: that.proxyParam |
| 153 | }).then(function (res) { | 153 | }).then(function (res) { |
| 154 | console.log(res); | 154 | console.log(res); |