Browse Source

添加对可能空指针的判断

pull/324/head
648540858 3 years ago
parent
commit
8cfff8db97
  1. 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
  2. 6
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java

@ -225,6 +225,7 @@ public class SIPRequestHeaderProvider {
public Request createInfoRequest(Device device, StreamInfo streamInfo, String content, Long cseq) public Request createInfoRequest(Device device, StreamInfo streamInfo, String content, Long cseq)
throws PeerUnavailableException, ParseException, InvalidArgumentException { throws PeerUnavailableException, ParseException, InvalidArgumentException {
Request request = null; Request request = null;
if (streamInfo == null) return null;
Dialog dialog = streamSession.getDialog(streamInfo.getDeviceID(), streamInfo.getChannelId()); Dialog dialog = streamSession.getDialog(streamInfo.getDeviceID(), streamInfo.getChannelId());
SipURI requestLine = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), SipURI requestLine = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(),

6
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@ -1589,6 +1589,9 @@ public class SIPCommander implements ISIPCommander {
content.append("CSeq: " + cseq + "\r\n"); content.append("CSeq: " + cseq + "\r\n");
content.append("PauseTime: now\r\n"); content.append("PauseTime: now\r\n");
Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
if (request == null) {
return;
}
logger.info(request.toString()); logger.info(request.toString());
ClientTransaction clientTransaction = null; ClientTransaction clientTransaction = null;
if ("TCP".equals(device.getTransport())) { if ("TCP".equals(device.getTransport())) {
@ -1617,6 +1620,7 @@ public class SIPCommander implements ISIPCommander {
content.append("CSeq: " + cseq + "\r\n"); content.append("CSeq: " + cseq + "\r\n");
content.append("Range: npt=now-\r\n"); content.append("Range: npt=now-\r\n");
Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
if (request == null) return;
logger.info(request.toString()); logger.info(request.toString());
ClientTransaction clientTransaction = null; ClientTransaction clientTransaction = null;
if ("TCP".equals(device.getTransport())) { if ("TCP".equals(device.getTransport())) {
@ -1645,6 +1649,7 @@ public class SIPCommander implements ISIPCommander {
content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n"); content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n");
Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
if (request == null) return;
logger.info(request.toString()); logger.info(request.toString());
ClientTransaction clientTransaction = null; ClientTransaction clientTransaction = null;
if ("TCP".equals(device.getTransport())) { if ("TCP".equals(device.getTransport())) {
@ -1672,6 +1677,7 @@ public class SIPCommander implements ISIPCommander {
content.append("CSeq: " + cseq + "\r\n"); content.append("CSeq: " + cseq + "\r\n");
content.append("Scale: " + String.format("%.1f",speed) + "\r\n"); content.append("Scale: " + String.format("%.1f",speed) + "\r\n");
Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq); Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
if (request == null) return;
logger.info(request.toString()); logger.info(request.toString());
ClientTransaction clientTransaction = null; ClientTransaction clientTransaction = null;
if ("TCP".equals(device.getTransport())) { if ("TCP".equals(device.getTransport())) {

Loading…
Cancel
Save