Commit cb1f1417b622b20e94133d89c6cb7fa9cbe6f4ed

Authored by 648540858
1 parent 0a245c4c

兼容回复的invite 200OK消息中缺少ssrc(y字段)的情况

src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -314,7 +314,13 @@ public class PlayServiceImpl implements IPlayService { @@ -314,7 +314,13 @@ public class PlayServiceImpl implements IPlayService {
314 if (!device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE")) { 314 if (!device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE")) {
315 return; 315 return;
316 } 316 }
317 - String substring = contentString.substring(0, contentString.indexOf("y=")); 317 +
  318 + String substring;
  319 + if (contentString.indexOf("y=") > 0) {
  320 + substring = contentString.substring(0, contentString.indexOf("y="));
  321 + }else {
  322 + substring = contentString;
  323 + }
318 try { 324 try {
319 SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring); 325 SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring);
320 int port = -1; 326 int port = -1;
@@ -568,6 +574,10 @@ public class PlayServiceImpl implements IPlayService { @@ -568,6 +574,10 @@ public class PlayServiceImpl implements IPlayService {
568 ResponseEvent responseEvent = (ResponseEvent) eventResult.event; 574 ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
569 String contentString = new String(responseEvent.getResponse().getRawContent()); 575 String contentString = new String(responseEvent.getResponse().getRawContent());
570 String ssrcInResponse = SipUtils.getSsrcFromSdp(contentString); 576 String ssrcInResponse = SipUtils.getSsrcFromSdp(contentString);
  577 + // 兼容回复的消息中缺少ssrc(y字段)的情况
  578 + if (ssrcInResponse == null) {
  579 + ssrcInResponse = ssrcInfo.getSsrc();
  580 + }
571 if (ssrcInfo.getSsrc().equals(ssrcInResponse)) { 581 if (ssrcInfo.getSsrc().equals(ssrcInResponse)) {
572 // ssrc 一致 582 // ssrc 一致
573 if (mediaServerItem.isRtpEnable()) { 583 if (mediaServerItem.isRtpEnable()) {