Browse Source

处理空指针

pull/93/head
panlinlin 4 years ago
parent
commit
ab13017117
  1. 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java
  2. 21
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
  3. 10
      web_src/src/components/dialog/StreamProxyEdit.vue

1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java

@ -48,6 +48,7 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor {
String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser(); String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser();
String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser(); String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser();
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId); SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId);
if (sendRtpItem == null) return;
String streamId = sendRtpItem.getStreamId(); String streamId = sendRtpItem.getStreamId();
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("vhost","__defaultVhost__"); param.put("vhost","__defaultVhost__");

21
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@ -295,25 +295,26 @@ public class ZLMHttpHookListener {
String streamId = json.getString("stream"); String streamId = json.getString("stream");
String app = json.getString("app"); String app = json.getString("app");
StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
if ("rtp".equals(app)){ if ("rtp".equals(app)){
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
ret.put("code", 0); ret.put("code", 0);
ret.put("close", true); ret.put("close", true);
if (streamInfo != null) { StreamInfo streamInfoForPlayCatch = redisCatchStorage.queryPlayByStreamId(streamId);
if (redisCatchStorage.isChannelSendingRTP(streamInfo.getChannelId())) { if (streamInfoForPlayCatch != null) {
if (redisCatchStorage.isChannelSendingRTP(streamInfoForPlayCatch.getChannelId())) {
ret.put("close", false); ret.put("close", false);
} else { } else {
cmder.streamByeCmd(streamInfo.getDeviceID(), streamInfo.getChannelId()); cmder.streamByeCmd(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId());
redisCatchStorage.stopPlay(streamInfo); redisCatchStorage.stopPlay(streamInfoForPlayCatch);
storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); storager.stopPlay(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId());
} }
}else{ }else{
cmder.streamByeCmd(streamInfo.getDeviceID(), streamInfo.getChannelId()); StreamInfo streamInfoForPlayBackCatch = redisCatchStorage.queryPlaybackByStreamId(streamId);
streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId); if (streamInfoForPlayBackCatch != null) {
redisCatchStorage.stopPlayback(streamInfo); cmder.streamByeCmd(streamInfoForPlayBackCatch.getDeviceID(), streamInfoForPlayBackCatch.getChannelId());
redisCatchStorage.stopPlayback(streamInfoForPlayBackCatch);
}
} }
return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
}else { }else {

10
web_src/src/components/dialog/StreamProxyEdit.vue

@ -62,14 +62,14 @@
<el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox> <el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox>
<el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox> <el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div style="float: right;"> <div style="float: right;">
<el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button> <el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button>
<el-button @click="close">取消</el-button> <el-button @click="close">取消</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -110,7 +110,7 @@ export default {
type: "default", type: "default",
app: null, app: null,
stream: null, stream: null,
url: "rtmp://58.200.131.2:1935/livetv/hunantv", url: "rtmp://58.200.131.2/livetv/cctv5hd",
src_url: null, src_url: null,
timeout_ms: null, timeout_ms: null,
ffmpeg_cmd_key: null, ffmpeg_cmd_key: null,
@ -120,7 +120,7 @@ export default {
enable_hls: true, enable_hls: true,
enable_mp4: false, enable_mp4: false,
}, },
rules: { rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }], name: [{ required: true, message: "请输入名称", trigger: "blur" }],
app: [{ required: true, message: "请输入应用名", trigger: "blur" }], app: [{ required: true, message: "请输入应用名", trigger: "blur" }],
@ -148,7 +148,7 @@ export default {
var that = this; var that = this;
that.$axios({ that.$axios({
method: 'post', method: 'post',
url:`/api/proxy/save`, url:`/api/proxy/save`,
data: that.proxyParam data: that.proxyParam
}).then(function (res) { }).then(function (res) {
console.log(res); console.log(res);

Loading…
Cancel
Save